Skip to content

Commit 8005421

Browse files
committed
num -> numeric, prob -> classprob for #65
1 parent 4385332 commit 8005421

30 files changed

+97
-97
lines changed

NAMESPACE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ S3method(predict_classprob,"_lognet")
1919
S3method(predict_classprob,"_multnet")
2020
S3method(predict_classprob,model_fit)
2121
S3method(predict_confint,model_fit)
22-
S3method(predict_num,"_elnet")
23-
S3method(predict_num,model_fit)
22+
S3method(predict_numeric,"_elnet")
23+
S3method(predict_numeric,model_fit)
2424
S3method(predict_predint,model_fit)
2525
S3method(predict_quantile,model_fit)
2626
S3method(predict_raw,"_elnet")
@@ -92,8 +92,8 @@ export(predict_classprob)
9292
export(predict_classprob.model_fit)
9393
export(predict_confint)
9494
export(predict_confint.model_fit)
95-
export(predict_num)
96-
export(predict_num.model_fit)
95+
export(predict_numeric)
96+
export(predict_numeric.model_fit)
9797
export(predict_predint)
9898
export(predict_predint.model_fit)
9999
export(predict_quantile)

R/boost_tree.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ xgb_by_tree <- function(tree, object, new_data, type, ...) {
394394
pred <- boost_tree_xgboost_data$classes$post(pred, object)
395395
pred <- tibble(.pred = factor(pred, levels = object$lvl))
396396
} else {
397-
pred <- boost_tree_xgboost_data$prob$post(pred, object)
397+
pred <- boost_tree_xgboost_data$classprob$post(pred, object)
398398
pred <- as_tibble(pred)
399399
names(pred) <- paste0(".pred_", names(pred))
400400
}

R/boost_tree_data.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ boost_tree_xgboost_data <-
3131
verbose = 0
3232
)
3333
),
34-
pred = list(
34+
numeric = list(
3535
pre = NULL,
3636
post = NULL,
3737
func = c(fun = "xgb_pred"),
@@ -58,7 +58,7 @@ boost_tree_xgboost_data <-
5858
newdata = quote(new_data)
5959
)
6060
),
61-
prob = list(
61+
classprob = list(
6262
pre = NULL,
6363
post = function(x, object) {
6464
if (is.vector(x)) {
@@ -106,7 +106,7 @@ boost_tree_C5.0_data <-
106106
newdata = quote(new_data)
107107
)
108108
),
109-
prob = list(
109+
classprob = list(
110110
pre = NULL,
111111
post = function(x, object) {
112112
as_tibble(x)
@@ -142,7 +142,7 @@ boost_tree_spark_data <-
142142
seed = expr(sample.int(10^5, 1))
143143
)
144144
),
145-
pred = list(
145+
numeric = list(
146146
pre = NULL,
147147
post = format_spark_num,
148148
func = c(pkg = "sparklyr", fun = "ml_predict"),
@@ -162,7 +162,7 @@ boost_tree_spark_data <-
162162
dataset = quote(new_data)
163163
)
164164
),
165-
prob = list(
165+
classprob = list(
166166
pre = NULL,
167167
post = format_spark_probs,
168168
func = c(pkg = "sparklyr", fun = "ml_predict"),

R/linear_reg.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,12 @@ predict._elnet <-
219219
}
220220

221221
#' @export
222-
predict_num._elnet <- function(object, new_data, ...) {
222+
predict_numeric._elnet <- function(object, new_data, ...) {
223223
if (any(names(enquos(...)) == "newdata"))
224224
stop("Did you mean to use `new_data` instead of `newdata`?", call. = FALSE)
225225

226226
object$spec <- eval_args(object$spec)
227-
predict_num.model_fit(object, new_data = new_data, ...)
227+
predict_numeric.model_fit(object, new_data = new_data, ...)
228228
}
229229

230230
#' @export

R/linear_reg_data.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ linear_reg_lm_data <-
3030
func = c(pkg = "stats", fun = "lm"),
3131
defaults = list()
3232
),
33-
pred = list(
33+
numeric = list(
3434
pre = NULL,
3535
post = NULL,
3636
func = c(fun = "predict"),
@@ -100,7 +100,7 @@ linear_reg_glmnet_data <-
100100
family = "gaussian"
101101
)
102102
),
103-
pred = list(
103+
numeric = list(
104104
pre = NULL,
105105
post = organize_glmnet_pred,
106106
func = c(fun = "predict"),
@@ -135,7 +135,7 @@ linear_reg_stan_data <-
135135
family = expr(stats::gaussian)
136136
)
137137
),
138-
pred = list(
138+
numeric = list(
139139
pre = NULL,
140140
post = NULL,
141141
func = c(fun = "predict"),
@@ -224,7 +224,7 @@ linear_reg_spark_data <-
224224
protect = c("x", "formula", "weight_col"),
225225
func = c(pkg = "sparklyr", fun = "ml_linear_regression")
226226
),
227-
pred = list(
227+
numeric = list(
228228
pre = NULL,
229229
post = function(results, object) {
230230
results <- dplyr::rename(results, pred = prediction)

R/logistic_reg_data.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ logistic_reg_glm_data <-
4444
type = "response"
4545
)
4646
),
47-
prob = list(
47+
classprob = list(
4848
pre = NULL,
4949
post = function(x, object) {
5050
x <- tibble(v1 = 1 - x, v2 = x)
@@ -121,7 +121,7 @@ logistic_reg_glmnet_data <-
121121
s = quote(object$spec$args$penalty)
122122
)
123123
),
124-
prob = list(
124+
classprob = list(
125125
pre = NULL,
126126
post = organize_glmnet_prob,
127127
func = c(fun = "predict"),
@@ -170,7 +170,7 @@ logistic_reg_stan_data <-
170170
newdata = quote(new_data)
171171
)
172172
),
173-
prob = list(
173+
classprob = list(
174174
pre = NULL,
175175
post = function(x, object) {
176176
x <- object$fit$family$linkinv(x)
@@ -278,7 +278,7 @@ logistic_reg_spark_data <-
278278
dataset = quote(new_data)
279279
)
280280
),
281-
prob = list(
281+
classprob = list(
282282
pre = NULL,
283283
post = format_spark_probs,
284284
func = c(pkg = "sparklyr", fun = "ml_predict"),

R/mars_data.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ mars_earth_data <-
2323
func = c(pkg = "earth", fun = "earth"),
2424
defaults = list(keepxy = TRUE)
2525
),
26-
pred = list(
26+
numeric = list(
2727
pre = NULL,
2828
post = maybe_multivariate,
2929
func = c(fun = "predict"),
@@ -48,7 +48,7 @@ mars_earth_data <-
4848
type = "response"
4949
)
5050
),
51-
prob = list(
51+
classprob = list(
5252
pre = NULL,
5353
post = function(x, object) {
5454
x <- x[,1]

R/mlp_data.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mlp_keras_data <-
2525
func = c(pkg = "parsnip", fun = "keras_mlp"),
2626
defaults = list()
2727
),
28-
pred = list(
28+
numeric = list(
2929
pre = NULL,
3030
post = maybe_multivariate,
3131
func = c(fun = "predict"),
@@ -47,7 +47,7 @@ mlp_keras_data <-
4747
x = quote(as.matrix(new_data))
4848
)
4949
),
50-
prob = list(
50+
classprob = list(
5151
pre = NULL,
5252
post = function(x, object) {
5353
x <- as_tibble(x)
@@ -81,7 +81,7 @@ mlp_nnet_data <-
8181
func = c(pkg = "nnet", fun = "nnet"),
8282
defaults = list(trace = FALSE)
8383
),
84-
pred = list(
84+
numeric = list(
8585
pre = NULL,
8686
post = maybe_multivariate,
8787
func = c(fun = "predict"),

R/multinom_reg_data.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ multinom_reg_glmnet_data <-
4040
s = quote(object$spec$args$penalty)
4141
)
4242
),
43-
prob = list(
43+
classprob = list(
4444
pre = check_glmnet_lambda,
4545
post = organize_multnet_prob,
4646
func = c(fun = "predict"),
@@ -85,7 +85,7 @@ multinom_reg_spark_data <-
8585
dataset = quote(new_data)
8686
)
8787
),
88-
prob = list(
88+
classprob = list(
8989
pre = NULL,
9090
post = format_spark_probs,
9191
func = c(pkg = "sparklyr", fun = "ml_predict"),

R/nearest_neighbor_data.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ nearest_neighbor_kknn_data <-
2222
func = c(pkg = "kknn", fun = "train.kknn"),
2323
defaults = list()
2424
),
25-
pred = list(
26-
# seems unnecessary here as the predict_num catches it based on the
25+
numeric = list(
26+
# seems unnecessary here as the predict_numeric catches it based on the
2727
# model mode
2828
pre = function(x, object) {
2929
if (object$fit$response != "continuous") {
@@ -60,7 +60,7 @@ nearest_neighbor_kknn_data <-
6060
type = "raw"
6161
)
6262
),
63-
prob = list(
63+
classprob = list(
6464
pre = function(x, object) {
6565
if (!(object$fit$response %in% c("ordinal", "nominal"))) {
6666
stop("`kknn` model does not appear to use class predictions. Was ",

0 commit comments

Comments
 (0)