-
Notifications
You must be signed in to change notification settings - Fork 7
6. Roadmap
Right now the package 'works' in that it will generate models and go through the process to eventually produce predictions. It does not however work for all algorithms supported by the parsnip
package and therefore the tidymodels
ecosystem. It is the hope that this road map will help to address that. I think this can be done on a engine/function basis, for example gee/linear_reg()
. It was the aim to do all of the fitting, etc. dynamically, but this was thrwarted by the way in which some algorithms need to work, and because of this the tidymodels
team has created work around for them so that they can be supported by parsnip
however, you cannot use them in the tradition workflows
manner. This has been documented here with the gee algorithm.
This leaves us in the position to most likely having to refresh the way in which the package actually works, from the more heavy use of purrr
to iterate of dynamic lists to a more robust method dispatch way of doing things.
https://rstudio.github.io/r-manuals/r-exts/Generic-functions-and-methods.html
https://adv-r.hadley.nz/s3.html#s3-methods
https://github.com/tidymodels/broom/tree/main
https://www.tidymodels.org/learn/develop/broom/
https://adv-r.hadley.nz/index.html
The workflow is considered fast when a recipe is passed or is created dynamically with zero input, this does not mean it will be correct or what is needed, just that it is done on the fly quickly.
Current state of algorithm as of December 4th, 2023:
.parsnip_eng = "lm"
.parsnip_fns = "linear_reg"
rec_obj <- recipe(mpg ~ ., data = mtcars)
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "linear_reg",
.parsnip_eng = "lm"
)
fr$model_spec[[1]]
fr$wflw[[1]]
fr$fitted_wflw[[1]]
fr$fitted_wflw[[1]] |> broom::tidy()
fr$fitted_wflw[[1]] |> broom::glance()
fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
fr$pred_wflw[[1]]
> fr$model_spec[[1]]
Linear Regression Model Specification (regression)
Computational engine: lm
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Regression Model Specification (regression)
Computational engine: lm
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
stats::lm(formula = ..y ~ ., data = data)
Coefficients:
(Intercept) cyl disp hp drat wt qsec
21.78132 -0.80763 0.02319 -0.02797 -0.10038 -3.64608 0.62728
vs am gear carb
0.58327 2.77856 0.37366 0.13047
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 11 × 5
term estimate std.error statistic p.value
<chr> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 21.8 21.1 1.03 0.320
2 cyl -0.808 1.25 -0.647 0.529
3 disp 0.0232 0.0278 0.834 0.419
4 hp -0.0280 0.0280 -0.998 0.337
5 drat -0.100 1.90 -0.0529 0.959
6 wt -3.65 2.41 -1.51 0.155
7 qsec 0.627 0.782 0.802 0.437
8 vs 0.583 2.33 0.251 0.806
9 am 2.78 2.51 1.11 0.289
10 gear 0.374 1.67 0.224 0.826
11 carb 0.130 1.06 0.123 0.904
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 1 × 12
r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC deviance df.residual nobs
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <int> <int>
1 0.863 0.758 2.74 8.20 0.000390 10 -50.9 126. 140. 97.7 13 24
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 22.7
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 22.2
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 26.3
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 21.8
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 18.0
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 20.8
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 15.1
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 23.1
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 24.0
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 18.5
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 26.3
2 21.8
3 15.1
4 14.0
5 12.7
6 27.3
7 17.4
8 17.5
.parsnip_eng = "brulee"
.parsnip_fns = "linear_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "linear_reg",
.parsnip_eng = "brulee"
)
Error in !self$..refer_to_state_dict..: invalid argument type
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 brulee regression linear_reg <spec[+]> <workflow> <workflow> <NULL>
> fr$model_spec[[1]]
Linear Regression Model Specification (regression)
Computational engine: brulee
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Regression Model Specification (regression)
Computational engine: brulee
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear regression
24 samples, 10 features, numeric outcome
weight decay: 0.001
batch size: 22
scaled validation loss after 1 epoch: 16.6
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class brulee_linear_reg
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class brulee_linear_reg
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
Error in !self$..refer_to_state_dict.. : invalid argument type
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "gee"
.parsnip_fns = "linear_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "linear_reg",
.parsnip_eng = "gee"
)
> fr$model_spec[[1]]
Linear Regression Model Specification (regression)
Computational engine: gee
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Variables
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
Outcomes: outcome_var
Predictors: predictor_vars
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Regression Model Specification (regression)
Computational engine: gee
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Variables
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
Outcomes: outcome_var
Predictors: predictor_vars
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
GEE: GENERALIZED LINEAR MODELS FOR DEPENDENT DATA
gee S-function, version 4.13 modified 98/01/27 (1998)
Model:
Link: Identity
Variance to Mean Relation: Gaussian
Correlation Structure: Independent
Call:
gee::gee(formula = mpg ~ disp + hp + drat + wt + qsec + vs +
am + gear + carb, id = data$cyl, data = data, family = gaussian)
Number of observations : 24
Maximum cluster size : 4
Coefficients:
(Intercept) disp hp drat wt qsec vs
2.772481358 0.012291451 -0.001785185 2.555081075 -2.868239428 0.764672142 0.308871461
am gear carb
3.809941720 0.670775437 -1.001749335
Estimated Scale Parameter: 6.299191
Number of Iterations: 1
Working Correlation[1:4,1:4]
[,1] [,2] [,3] [,4]
[1,] 1 0 0 0
[2,] 0 1 0 0
[3,] 0 0 0 0
[4,] 0 0 0 0
Returned Error Value:
[1] 0
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 10 × 6
term estimate std.error statistic p.value ``
<chr> <dbl> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 2.77 15.1 0.183 6.91 0.401
2 disp 0.0123 0.0182 0.676 0.0130 0.948
3 hp -0.00179 0.0234 -0.0764 0.0142 -0.126
4 drat 2.56 1.78 1.43 0.626 4.08
5 wt -2.87 2.09 -1.37 1.81 -1.58
6 qsec 0.765 0.724 1.06 0.346 2.21
7 vs 0.309 2.16 0.143 1.06 0.290
8 am 3.81 2.21 1.72 1.85 2.06
9 gear 0.671 1.82 0.368 0.930 0.722
10 carb -1.00 0.894 -1.12 0.752 -1.33
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 1 × 8
null.deviance df.null logLik AIC BIC deviance df.residual nobs
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <int>
1 NA NA NA NA NA NA NA 24
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 22.1
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 21.8
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 27.1
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 20.6
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 18.1
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 19.3
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 14.8
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 21.0
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 23.8
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 17.7
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 14.8
2 21.0
3 15.5
4 16.3
5 17.7
6 27.4
7 22.6
8 25.6
.parsnip_eng = "glm"
.parsnip_fns = "linear_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "linear_reg",
.parsnip_eng = "glm"
)
> fr$model_spec[[1]]
Linear Regression Model Specification (regression)
Computational engine: glm
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Regression Model Specification (regression)
Computational engine: glm
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call: stats::glm(formula = ..y ~ ., family = stats::gaussian, data = data)
Coefficients:
(Intercept) cyl disp hp drat wt qsec
18.91748 -0.25686 0.02509 -0.02400 0.08744 -7.23026 1.15143
vs am gear carb
-0.07889 0.82917 0.32748 0.42705
Degrees of Freedom: 23 Total (i.e. Null); 13 Residual
Null Deviance: 872.7
Residual Deviance: 89.83 AIC: 123.8
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 11 × 5
term estimate std.error statistic p.value
<chr> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 18.9 21.3 0.887 0.391
2 cyl -0.257 1.41 -0.183 0.858
3 disp 0.0251 0.0212 1.18 0.257
4 hp -0.0240 0.0248 -0.969 0.350
5 drat 0.0874 1.79 0.0487 0.962
6 wt -7.23 2.45 -2.95 0.0113
7 qsec 1.15 0.785 1.47 0.166
8 vs -0.0789 2.95 -0.0267 0.979
9 am 0.829 2.60 0.319 0.755
10 gear 0.327 1.81 0.181 0.859
11 carb 0.427 1.02 0.419 0.682
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 1 × 8
null.deviance df.null logLik AIC BIC deviance df.residual nobs
<dbl> <int> <dbl> <dbl> <dbl> <dbl> <int> <int>
1 873. 23 -49.9 124. 138. 89.8 13 24
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 22.9
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 21.7
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 25.8
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 21.9
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 18.5
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 20.3
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 15.4
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 22.5
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 25.2
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 18.1
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 12.6
2 7.50
3 6.77
4 25.4
5 18.1
6 28.9
7 26.2
8 20.0
.parsnip_eng = "glmer"
.parsnip_fns = "linear_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "linear_reg",
.parsnip_eng = "glmer"
)
Error: No random effects terms specified in formula
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
Warning message:
There was 1 warning in `dplyr::mutate()`.
ℹ In argument: `fitted_wflw = internal_make_fitted_wflw(mod_tbl, splits_obj)`.
Caused by warning in `lme4::glmer()`:
! calling glmer() with family=gaussian (identity link) as a shortcut to lmer() is deprecated; please call lmer() directly
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 glmer regression linear_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Linear Regression Model Specification (regression)
Computational engine: glmer
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Regression Model Specification (regression)
Computational engine: glmer
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "glmnet"
.parsnip_fns = "linear_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "linear_reg",
.parsnip_eng = "glmnet"
)
Error in `.check_glmnet_penalty_fit()`:
! For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
• There are 0 values for `penalty`.
• To try multiple values for total regularization, use the tune package.
• To predict multiple penalties, use `multi_predict()`
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 glmnet regression linear_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Linear Regression Model Specification (regression)
Computational engine: glmnet
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Regression Model Specification (regression)
Computational engine: glmnet
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "gls"
.parsnip_fns = "linear_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "linear_reg",
.parsnip_eng = "gls"
)
> fr$model_spec[[1]]
Linear Regression Model Specification (regression)
Computational engine: gls
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Regression Model Specification (regression)
Computational engine: gls
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Generalized least squares fit by REML
Model: ..y ~ .
Data: data
Log-restricted-likelihood: -49.68099
Coefficients:
(Intercept) cyl disp hp drat wt qsec
-19.59286037 0.32629657 0.01919518 -0.01332160 -0.09600257 -5.78680096 2.57090463
vs am gear carb
-1.78348102 2.69856618 2.18246456 0.02194602
Degrees of freedom: 24 total; 13 residual
Residual standard error: 2.662756
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class gls
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class gls
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 22.3
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 22.2
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 26.3
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 21.7
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 17.7
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 21.8
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 13.1
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 23.3
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 30.4
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 17.7
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 26.3
2 17.7
3 30.4
4 16.6
5 11.5
6 8.58
7 10.1
8 29.0
.parsnip_eng = "lme"
.parsnip_fns = "linear_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "linear_reg",
.parsnip_eng = "lme"
)
Error in getGroups.data.frame(dataMix, groups): invalid formula for groups
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 lme regression linear_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Linear Regression Model Specification (regression)
Computational engine: lme
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Regression Model Specification (regression)
Computational engine: lme
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "lmer"
.parsnip_fns = "linear_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "linear_reg",
.parsnip_eng = "lmer"
)
Error: No random effects terms specified in formula
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 lmer regression linear_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Linear Regression Model Specification (regression)
Computational engine: lmer
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Regression Model Specification (regression)
Computational engine: lmer
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "stan"
.parsnip_fns = "linear_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "linear_reg",
.parsnip_eng = "stan"
)
> fr$model_spec[[1]]
Linear Regression Model Specification (regression)
Computational engine: stan
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Regression Model Specification (regression)
Computational engine: stan
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
stan_glm
family: gaussian [identity]
formula: ..y ~ .
observations: 24
predictors: 11
------
Median MAD_SD
(Intercept) 3.0 22.6
cyl 0.0 1.2
disp 0.0 0.0
hp 0.0 0.0
drat 2.7 2.1
wt -4.0 2.2
qsec 1.3 0.9
vs -1.5 2.4
am 3.4 2.6
gear -1.4 1.9
carb 0.5 1.0
Auxiliary parameter(s):
Median MAD_SD
sigma 2.6 0.5
------
* For help interpreting the printed output see ?print.stanreg
* For info on the priors used see ?prior_summary.stanreg
> fr$fitted_wflw[[1]] |> broom::tidy()
Error in warn_on_stanreg(x) :
The supplied model object seems to be outputted from the rstanarm package. Tidiers for mixed model output now live in the broom.mixed package.
> fr$fitted_wflw[[1]] |> broom::glance()
Error in warn_on_stanreg(x) :
The supplied model object seems to be outputted from the rstanarm package. Tidiers for mixed model output now live in the broom.mixed package.
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 23.8
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 23.4
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 24.1
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 19.5
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 17.9
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 18.2
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 15.4
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 20.3
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 24.0
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 17.8
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 23.8
2 19.5
3 15.4
4 20.3
5 13.2
6 26.5
7 15.1
8 23.4
.parsnip_eng = "stan_glmer"
.parsnip_fns = "linear_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "linear_reg",
.parsnip_eng = "stan_glmer"
)
Error: No random effects terms specified in formula
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 stan_glmer regression linear_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Linear Regression Model Specification (regression)
Computational engine: stan_glmer
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: linear_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Regression Model Specification (regression)
Computational engine: stan_glmer
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
Not implemented
.parsnip_eng = "Cubist"
.parsnip_fns = "cubsit_rules"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "cubist_rules",
.parsnip_eng = "Cubist"
)
> fr$model_spec[[1]]
Cubist Model Specification (regression)
Computational engine: Cubist
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: cubist_rules()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Cubist Model Specification (regression)
Computational engine: Cubist
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: cubist_rules()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
cubist.default(x = x, y = y, committees = 1)
Number of samples: 24
Number of predictors: 10
Number of committees: 1
Number of rules: 1
> fr$fitted_wflw[[1]] |> broom::tidy() |> unnest(cols = c(estimate, statistic))
# A tibble: 2 × 11
committee rule_num rule term estimate num_conditions coverage mean min max error
<int> <int> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1 1 <no conditions> (Interce… 28.7 0 24 20.1 10.4 33.9 3.08
2 1 1 <no conditions> disp -0.04 0 24 20.1 10.4 33.9 3.08
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class cubist
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 22.3
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 22.3
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 24.4
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 18.4
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 14.3
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 19.7
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 14.3
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 22.8
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 23.1
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 22.0
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 24.4
2 22.0
3 17.7
4 17.7
5 25.7
6 16.5
7 23.9
8 14.7
.parsnip_eng = "glm"
.parsnip_fns = "poisson_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "poisson_reg",
.parsnip_eng = "glm"
)
Warning message:
There were 21 warnings in `dplyr::mutate()`.
The first warning was:
ℹ In argument: `fitted_wflw = internal_make_fitted_wflw(mod_tbl, splits_obj)`.
Caused by warning in `dpois()`:
! non-integer x = 16.400000
ℹ Run dplyr::last_dplyr_warnings() to see the 20 remaining warnings.
> fr$model_spec[[1]]
Poisson Regression Model Specification (regression)
Computational engine: glm
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: poisson_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Poisson Regression Model Specification (regression)
Computational engine: glm
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: poisson_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call: stats::glm(formula = ..y ~ ., family = stats::poisson, data = data)
Coefficients:
(Intercept) cyl disp hp drat wt qsec
2.2690172 0.0633415 -0.0006075 -0.0006781 -0.0089000 -0.2240039 0.0577436
vs am gear carb
-0.0054883 0.1056335 0.0599864 -0.0120491
Degrees of Freedom: 23 Total (i.e. Null); 13 Residual
Null Deviance: 41.13
Residual Deviance: 2.54 AIC: Inf
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 11 × 5
term estimate std.error statistic p.value
<chr> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 2.27 1.65 1.38 0.168
2 cyl 0.0633 0.109 0.583 0.560
3 disp -0.000608 0.00218 -0.278 0.781
4 hp -0.000678 0.00243 -0.279 0.780
5 drat -0.00890 0.150 -0.0593 0.953
6 wt -0.224 0.186 -1.20 0.229
7 qsec 0.0577 0.0651 0.887 0.375
8 vs -0.00549 0.177 -0.0310 0.975
9 am 0.106 0.197 0.536 0.592
10 gear 0.0600 0.140 0.428 0.669
11 carb -0.0120 0.0825 -0.146 0.884
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 1 × 8
null.deviance df.null logLik AIC BIC deviance df.residual nobs
<dbl> <int> <dbl> <dbl> <dbl> <dbl> <int> <int>
1 41.1 23 -Inf Inf Inf 2.54 13 24
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 22.3
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 21.7
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 25.6
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 19.2
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 16.1
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 19.5
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 13.6
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 20.3
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 23.7
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 18.2
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 22.3
2 16.1
3 20.3
4 16.4
5 10.2
6 9.62
7 12.5
8 14.4
.parsnip_eng = "gee"
.parsnip_fns = "poisson_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "poisson_reg",
.parsnip_eng = "gee"
)
Error in terms.formula(f, specials = "id_var"): '.' in formula and no 'data' argument
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 gee regression poisson_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Poisson Regression Model Specification (regression)
Computational engine: gee
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: poisson_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Poisson Regression Model Specification (regression)
Computational engine: gee
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "glmer"
.parsnip_fns = "poisson_reg"
> fr <- fast_regression(
+ .data = mtcars,
+ .rec_obj = rec_obj,
+ .parsnip_fns = "poisson_reg",
+ .parsnip_eng = "glmer"
+ )
Error: No random effects terms specified in formula
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 glmer regression poisson_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Poisson Regression Model Specification (regression)
Computational engine: glmer
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: poisson_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Poisson Regression Model Specification (regression)
Computational engine: glmer
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "glmnet"
.parsnip_fns = "poisson_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "poisson_reg",
.parsnip_eng = "glmnet"
)
Error in `.check_glmnet_penalty_fit()`:
! For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
• There are 0 values for `penalty`.
• To try multiple values for total regularization, use the tune package.
• To predict multiple penalties, use `multi_predict()`
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 glmnet regression poisson_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Poisson Regression Model Specification (regression)
Computational engine: glmnet
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: poisson_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Poisson Regression Model Specification (regression)
Computational engine: glmnet
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "hurdle"
.parsnip_fns = "poisson_reg"
> fr <- fast_regression(
+ .data = mtcars,
+ .rec_obj = rec_obj,
+ .parsnip_fns = "poisson_reg",
+ .parsnip_eng = "hurdle"
+ )
Error in pscl::hurdle(formula = ..y ~ ., data = data): invalid dependent variable, minimum count is not zero
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 hurdle regression poisson_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Poisson Regression Model Specification (regression)
Computational engine: hurdle
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: poisson_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Poisson Regression Model Specification (regression)
Computational engine: hurdle
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "stan"
.parsnip_fns = "poisson_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "poisson_reg",
.parsnip_eng = "stan"
)
Error: All outcome values must be counts for Poisson models
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 stan regression poisson_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Poisson Regression Model Specification (regression)
Computational engine: stan
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: poisson_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Poisson Regression Model Specification (regression)
Computational engine: stan
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "stan_glmer"
.parsnip_fns = "poisson_reg"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "poisson_reg",
.parsnip_eng = "stan_glmer"
)
Error: No random effects terms specified in formula
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 stan_glmer regression poisson_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Poisson Regression Model Specification (regression)
Computational engine: stan_glmer
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: poisson_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Poisson Regression Model Specification (regression)
Computational engine: stan_glmer
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "zeroinfl"
.parsnip_fns = "poisson_reg"
> fr <- fast_regression(
+ .data = mtcars,
+ .rec_obj = rec_obj,
+ .parsnip_fns = "poisson_reg",
+ .parsnip_eng = "zeroinfl"
+ )
Error in pscl::zeroinfl(formula = ..y ~ ., data = data): invalid dependent variable, minimum count is not zero
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 zeroinfl regression poisson_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Poisson Regression Model Specification (regression)
Computational engine: zeroinfl
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: poisson_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Poisson Regression Model Specification (regression)
Computational engine: zeroinfl
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "earth"
.parsnip_fns = "bag_mars"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "bag_mars",
.parsnip_eng = "earth"
)> fr$model_spec[[1]]
Bagged MARS Model Specification (regression)
Computational engine: earth
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: bag_mars()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Bagged MARS Model Specification (regression)
Computational engine: earth
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: bag_mars()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Bagged MARS (regression with 11 members)
Variable importance scores include:
# A tibble: 3 × 4
term value std.error used
<chr> <dbl> <dbl> <int>
1 disp 19.2 15.3 3
2 wt 9.09 0 1
3 hp 6.66 5.89 2
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class bagger
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class bagger
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 21.8
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 20.2
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 24.1
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 20.1
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 14.7
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 19.7
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 13.3
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 19.5
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 20.1
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 18.7
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 14.7
2 11.6
3 26.1
4 16.1
5 14.3
6 27.1
7 16.7
8 19.0
.parsnip_eng = "rpart"
.parsnip_fns = "bag_tree"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "bag_tree",
.parsnip_eng = "rpart"
)
> fr$model_spec[[1]]
Bagged Decision Tree Model Specification (regression)
Main Arguments:
cost_complexity = 0
min_n = 2
Computational engine: rpart
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: bag_tree()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Bagged Decision Tree Model Specification (regression)
Main Arguments:
cost_complexity = 0
min_n = 2
Computational engine: rpart
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: bag_tree()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Bagged CART (regression with 11 members)
Variable importance scores include:
# A tibble: 10 × 4
term value std.error used
<chr> <dbl> <dbl> <int>
1 disp 571. 54.9 11
2 wt 569. 48.2 11
3 hp 470. 51.9 11
4 drat 399. 51.3 11
5 cyl 368. 37.3 11
6 am 215. 64.8 11
7 gear 193. 57.0 9
8 carb 65.4 33.9 9
9 qsec 64.7 15.5 11
10 vs 7.33 2.85 10
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class bagger
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class bagger
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 20.9
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 20.9
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 24.9
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 18.8
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 18.6
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 18
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 14.3
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 22.8
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 21.8
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 18.5
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 18.8
2 18.5
3 17.5
4 28.2
5 28.2
6 18.2
7 14.4
8 14.7
.parsnip_eng = "dbarts"
.parsnip_fns = "bart"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "bart",
.parsnip_eng = "dbart"
)
> fr$model_spec[[1]]
Call:
NULL
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: bart()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
NULL
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: bart()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
`NULL`()
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class bart
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class bart
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 21.0
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 20.9
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 25.2
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 20.5
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 17.7
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 18.9
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 14.3
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 23.4
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 22.8
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 18.0
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 23.4
2 17.9
3 13.0
4 30.8
5 27.3
6 19.2
7 20.6
8 26.2
.parsnip_eng = "xgboost"
.parsnip_fns = "boost_tree"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "boost_tree",
.parsnip_eng = "xgboost"
)
> fr$model_spec[[1]]
Boosted Tree Model Specification (regression)
Computational engine: xgboost
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: boost_tree()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Boosted Tree Model Specification (regression)
Computational engine: xgboost
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: boost_tree()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
##### xgb.Booster
raw: 20.2 Kb
call:
xgboost::xgb.train(params = list(eta = 0.3, max_depth = 6, gamma = 0,
colsample_bytree = 1, colsample_bynode = 1, min_child_weight = 1,
subsample = 1), data = x$data, nrounds = 15, watchlist = x$watchlist,
verbose = 0, nthread = 1, objective = "reg:squarederror")
params (as set within xgb.train):
eta = "0.3", max_depth = "6", gamma = "0", colsample_bytree = "1", colsample_bynode = "1", min_child_weight = "1", subsample = "1", nthread = "1", objective = "reg:squarederror", validate_parameters = "TRUE"
xgb.attributes:
niter
callbacks:
cb.evaluation.log()
# of features: 10
niter: 15
nfeatures : 10
evaluation_log:
iter training_rmse
1 15.2936282
2 11.3548484
---
14 0.6191974
15 0.5200460
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class xgb.Booster
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class xgb.Booster
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 20.9
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 20.9
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 22.4
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 21.3
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 18.3
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 20.1
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 14.3
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 24.1
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 20.9
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 18.7
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 20.1
2 20.9
3 15.2
4 15.2
5 10.3
6 30.4
7 22.3
8 13.8
.parsnip_eng = "lightgbm"
.parsnip_fns = "boost_tree"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "boost_tree",
.parsnip_eng = "lightgbm"
)
> fr$model_spec[[1]]
Boosted Tree Model Specification (regression)
Computational engine: lightgbm
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: boost_tree()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Boosted Tree Model Specification (regression)
Computational engine: lightgbm
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: boost_tree()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
<lgb.Booster>
Public:
add_valid: function (data, name)
best_iter: -1
best_score: NA
current_iter: function ()
dump_model: function (num_iteration = NULL, feature_importance_type = 0L)
eval: function (data, name, feval = NULL)
eval_train: function (feval = NULL)
eval_valid: function (feval = NULL)
finalize: function ()
initialize: function (params = list(), train_set = NULL, modelfile = NULL,
lower_bound: function ()
params: list
predict: function (data, start_iteration = NULL, num_iteration = NULL,
raw: NA
record_evals: list
reset_parameter: function (params, ...)
rollback_one_iter: function ()
save: function ()
save_model: function (filename, num_iteration = NULL, feature_importance_type = 0L)
save_model_to_string: function (num_iteration = NULL, feature_importance_type = 0L)
set_train_data_name: function (name)
to_predictor: function ()
update: function (train_set = NULL, fobj = NULL)
upper_bound: function ()
Private:
eval_names: NULL
get_eval_info: function ()
handle: lgb.Booster.handle
higher_better_inner_eval: NULL
init_predictor: NULL
inner_eval: function (data_name, data_idx, feval = NULL)
inner_predict: function (idx)
is_predicted_cur_iter: list
name_train_set: training
name_valid_sets: list
num_class: 1
num_dataset: 1
predict_buffer: list
set_objective_to_none: FALSE
train_set: lgb.Dataset, R6
train_set_version: 1
valid_sets: list
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class lgb.Booster
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class lgb.Booster
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 20.8
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 20.8
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 20.8
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 20.8
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 20.8
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 20.8
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 20.8
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 20.8
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 20.8
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 20.8
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 20.8
2 20.8
3 20.8
4 20.8
5 20.8
6 20.8
7 20.8
8 20.8
.parsnip_eng = "rpart"
.parsnip_fns = "decision_tree"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "decsion_tree",
.parsnip_eng = "rpart"
)
> fr$model_spec[[1]]
Decision Tree Model Specification (regression)
Computational engine: rpart
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: decision_tree()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Decision Tree Model Specification (regression)
Computational engine: rpart
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: decision_tree()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
n= 24
node), split, n, deviance, yval
* denotes terminal node
1) root 24 887.2696 20.37083
2) cyl>=5 15 125.4000 16.50000 *
3) cyl< 5 9 162.5356 26.82222 *
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class rpart
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class rpart
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 16.5
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 16.5
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 26.8
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 16.5
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 16.5
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 16.5
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 16.5
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 26.8
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 26.8
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 16.5
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 16.5
2 16.5
3 16.5
4 16.5
5 26.8
6 26.8
7 16.5
8 16.5
.parsnip_eng = "partykit"
.parsnip_fns = "decision_tree"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "decision_tree",
.parsnip_eng = "partykit"
)
> fr$model_spec[[1]]
Decision Tree Model Specification (regression)
Computational engine: partykit
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: decision_tree()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Decision Tree Model Specification (regression)
Computational engine: partykit
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: decision_tree()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Model formula:
..y ~ cyl + disp + hp + drat + wt + qsec + vs + am + gear + carb
Fitted party:
[1] root
| [2] wt <= 2.62: 27.000 (n = 7, err = 119.6)
| [3] wt > 2.62: 17.706 (n = 17, err = 256.5)
Number of inner nodes: 1
Number of terminal nodes: 2
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class constparty
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class constparty
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 27
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 17.7
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 27
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 17.7
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 17.7
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 17.7
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 17.7
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 17.7
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 17.7
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 17.7
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 27
2 17.7
3 17.7
4 17.7
5 27
6 17.7
7 17.7
8 17.7
.parsnip_eng = "nnet"
.parsnip_fns = "mlp"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "mlp",
.parsnip_eng = "nnet"
)
> fr$model_spec[[1]]
Single Layer Neural Network Model Specification (regression)
Computational engine: nnet
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: mlp()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Single Layer Neural Network Model Specification (regression)
Computational engine: nnet
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: mlp()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
a 10-5-1 network with 61 weights
inputs: cyl disp hp drat wt qsec vs am gear carb
output(s): ..y
options were - linear output units
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class nnet.formula
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class nnet.formula
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 20.4
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 20.4
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 20.4
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 20.4
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 20.4
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 20.4
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 20.4
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 20.4
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 20.4
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 20.4
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 20.4
2 20.4
3 20.4
4 20.4
5 20.4
6 20.4
7 20.4
8 20.4
.parsnip_eng = "brulee"
.parsnip_fns = "mlp"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "mlp",
.parsnip_eng = "brulee"
)
Error in !self$..refer_to_state_dict..: invalid argument type
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 brulee regression mlp <spec[+]> <workflow> <workflow> <NULL>
> fr$model_spec[[1]]
Single Layer Neural Network Model Specification (regression)
Computational engine: brulee
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: mlp()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Single Layer Neural Network Model Specification (regression)
Computational engine: brulee
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: mlp()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Multilayer perceptron
relu activation
3 hidden units, 37 model parameters
24 samples, 10 features, numeric outcome
weight decay: 0.001
dropout proportion: 0
batch size: 22
learn rate: 0.01
scaled validation loss after 1 epoch: 0.0719
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class brulee_mlp
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class brulee_mlp
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
Error in !self$..refer_to_state_dict.. : invalid argument type
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "ranger"
.parsnip_fns = "rand_forest"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "rand_forest",
.parsnip_eng = "ranger"
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 ranger regression rand_forest <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Random Forest Model Specification (regression)
Computational engine: ranger
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: rand_forest()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Random Forest Model Specification (regression)
Computational engine: ranger
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: rand_forest()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Ranger result
Call:
ranger::ranger(x = maybe_data_frame(x), y = y, num.threads = 1, verbose = FALSE, seed = sample.int(10^5, 1))
Type: Regression
Number of trees: 500
Sample size: 24
Number of independent variables: 10
Mtry: 3
Target node size: 5
Variable importance mode: none
Splitrule: variance
OOB prediction error (MSE): 7.843979
R squared (OOB): 0.7586553
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class ranger
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class ranger
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 20.4
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 20.4
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 24.4
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 20.2
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 17.1
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 19.3
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 15.0
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 23.3
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 22.7
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 19.0
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 20.4
2 22.7
3 12.8
4 29.1
5 15.4
6 16.6
7 25.3
8 23.4
.parsnip_eng = "randomForest"
.parsnip_fns = "rand_forest"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "rand_forest",
.parsnip_eng = "randomForest"
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 randomForest regression rand_forest <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Random Forest Model Specification (regression)
Computational engine: randomForest
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: rand_forest()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Random Forest Model Specification (regression)
Computational engine: randomForest
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: rand_forest()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
randomForest(x = maybe_data_frame(x), y = y)
Type of random forest: regression
Number of trees: 500
No. of variables tried at each split: 3
Mean of squared residuals: 7.740251
% Var explained: 75.1
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class randomForest
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class randomForest
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 20.8
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 20.8
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 25.3
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 19.8
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 16.5
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 18.9
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 14.5
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 22.2
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 21.8
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 18.7
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 16.5
2 22.2
3 21.8
4 18.7
5 12.8
6 29.3
7 23.9
8 29.0
.parsnip_eng = "LiblineaR"
.parsnip_fns = "svm_linear"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "svm_linear",
.parsnip_eng = "LiblineaR"
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 LiblineaR regression svm_linear <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Linear Support Vector Machine Model Specification (regression)
Computational engine: LiblineaR
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_linear()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Support Vector Machine Model Specification (regression)
Computational engine: LiblineaR
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_linear()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
$TypeDetail
[1] "L2-regularized L2-loss support vector regression primal (L2R_L2LOSS_SVR)"
$Type
[1] 11
$W
cyl disp hp drat wt qsec vs am gear
[1,] 0.1723388 -0.03297149 0.006179121 0.287736 0.08152064 1.303867 0.08269486 0.06042443 0.2763653
carb Bias
[1,] 0.001282229 0.06513631
$Bias
[1] 1
$NbClass
[1] 2
attr(,"class")
[1] "LiblineaR"
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 11 × 2
term estimate
<chr> <dbl>
1 cyl 0.172
2 disp -0.0330
3 hp 0.00618
4 drat 0.288
5 wt 0.0815
6 qsec 1.30
7 vs 0.0827
8 am 0.0604
9 gear 0.276
10 carb 0.00128
11 Bias 0.0651
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class LiblineaR
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 20.5
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 21.2
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 24.6
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 20.7
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 14.9
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 22.7
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 13.8
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 24.9
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 29.1
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 22.8
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 20.5
2 21.2
3 24.6
4 24.9
5 12.7
6 26.6
7 25.7
8 13.7
.parsnip_eng = "kernlab"
.parsnip_fns = "svm_linear"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 kernlab regression svm_linear <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Linear Support Vector Machine Model Specification (regression)
Computational engine: kernlab
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_linear()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Support Vector Machine Model Specification (regression)
Computational engine: kernlab
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_linear()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Support Vector Machine object of class "ksvm"
SV type: eps-svr (regression)
parameter : epsilon = 0.1 cost C = 1
Linear (vanilla) kernel function.
Number of Support Vectors : 21
Objective Function Value : -4.2668
Training error : 0.115856
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class ksvm
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class ksvm
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 23.3
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 23.9
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 24.0
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 19.4
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 18.1
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 19.0
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 13.8
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 22.0
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 28.8
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 18.6
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 23.3
2 23.9
3 13.8
4 28.8
5 17.9
6 15.4
7 22.3
8 20.2
.parsnip_eng = "mgcv"
.parsnip_fns = "gen_additive_mod"
> fr <- fast_regression(
+ .data = mtcars,
+ .rec_obj = rec_obj,
+ .parsnip_fns = "gen_additive_mod",
+ .parsnip_eng = "mgcv"
+ )
Error in `fit_xy()`:
! `fit()` must be used with GAM models (due to its use of formulas).
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 mgcv regression gen_additive_mod <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
GAM Model Specification (regression)
Computational engine: mgcv
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: gen_additive_mod()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
GAM Model Specification (regression)
Computational engine: mgcv
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "earth"
.parsnip_fns = "bag_mars"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "bag_mars",
.parsnip_eng = "earth"
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 earth regression bag_mars <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Bagged MARS Model Specification (regression)
Computational engine: earth
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: bag_mars()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Bagged MARS Model Specification (regression)
Computational engine: earth
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: bag_mars()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Bagged MARS (regression with 11 members)
Variable importance scores include:
# A tibble: 2 × 4
term value std.error used
<chr> <dbl> <dbl> <int>
1 disp 22.6 8.90 3
2 wt 3.62 0 1
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class bagger
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class bagger
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 20.6
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 20.0
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 23.7
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 18.2
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 14.2
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 19.3
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 14.7
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 25.2
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 25.8
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 20.2
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 20.0
2 14.2
3 20.4
4 29.8
5 24.5
6 16.3
7 16.1
8 13.2
.parsnip_eng = "earth"
.parsnip_fns = "mars"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "mars",
.parsnip_eng = "earth"
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 earth regression mars <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
MARS Model Specification (regression)
Computational engine: earth
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: mars()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
MARS Model Specification (regression)
Computational engine: earth
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: mars()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Selected 3 of 10 terms, and 2 of 10 predictors
Termination condition: GRSq -10 at 10 terms
Importance: disp, wt, cyl-unused, hp-unused, drat-unused, qsec-unused, vs-unused, am-unused, ...
Number of terms at each degree of interaction: 1 2 (additive model)
GCV 8.035727 RSS 120.8707 GRSq 0.7959198 RSq 0.8607317
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class earth
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class earth
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 19.5
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 19.5
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 26.2
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 18.5
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 17.8
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 17.8
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 17.4
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 21.2
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 22.0
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 17.8
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 19.5
2 17.8
3 30.4
4 17.8
5 16.6
6 24.6
7 18.5
8 17.4
.parsnip_eng = "kernlab"
.parsnip_fns = "svm_poly"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "svm_poly",
.parsnip_eng = "kernlab"
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 kernlab regression svm_poly <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Polynomial Support Vector Machine Model Specification (regression)
Computational engine: kernlab
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_poly()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Polynomial Support Vector Machine Model Specification (regression)
Computational engine: kernlab
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_poly()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Support Vector Machine object of class "ksvm"
SV type: eps-svr (regression)
parameter : epsilon = 0.1 cost C = 1
Polynomial kernel function.
Hyperparameters : degree = 1 scale = 1 offset = 1
Number of Support Vectors : 21
Objective Function Value : -4.2824
Training error : 0.122816
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class ksvm
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class ksvm
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 21.8
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 21.6
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 25.9
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 19.7
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 17.5
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 18.7
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 13.7
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 20.6
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 23.4
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 18.6
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 17.5
2 20.6
3 15.5
4 10.4
5 26.6
6 27.2
7 23.0
8 15.3
.parsnip_eng = "kernlab"
.parsnip_fns = "svm_rbf"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "svm_rbf",
.parsnip_eng = "kernlab"
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 kernlab regression svm_rbf <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Radial Basis Function Support Vector Machine Model Specification (regression)
Computational engine: kernlab
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_rbf()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Radial Basis Function Support Vector Machine Model Specification (regression)
Computational engine: kernlab
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_rbf()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Support Vector Machine object of class "ksvm"
SV type: eps-svr (regression)
parameter : epsilon = 0.1 cost C = 1
Gaussian Radial Basis kernel function.
Hyperparameter : sigma = 0.248260694687502
Number of Support Vectors : 20
Objective Function Value : -6.6151
Training error : 0.110756
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class ksvm
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class ksvm
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 20.7
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 20.6
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 23.5
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 20.3
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 18.0
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 18.9
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 14.9
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 21.4
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 22.2
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 19.8
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 20.6
2 21.4
3 19.8
4 15.6
5 14.6
6 27.1
7 16.2
8 20.0
.parsnip_eng = "xrf"
.parsnip_fns = "rule_fit"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "rule_fit",
.parsnip_eng = "xrf"
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 xrf regression rule_fit <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
RuleFit Model Specification (regression)
Computational engine: xrf
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: rule_fit()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
RuleFit Model Specification (regression)
Computational engine: xrf
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: rule_fit()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
An eXtreme RuleFit model of 47 rules.
Original Formula:
..y ~ cyl + disp + hp + drat + wt + qsec + vs + am + gear + carb
> fr$fitted_wflw[[1]] |> broom::tidy()
Error in `generics::tidy()`:
! Please choose a single numeric value of 'penalty'.
Run `rlang::last_trace()` to see where the error occurred.
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class xrf
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 21.0
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 20.9
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 22.7
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 18.5
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 18.7
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 18.3
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 13.9
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 24.3
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 22.2
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 18.6
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 18.5
2 13.9
3 15.1
4 15.3
5 33.0
6 22.6
7 32.9
8 20.8
.parsnip_eng = "kknn"
.parsnip_fns = "nearest_neighbor"
fr <- fast_regression(
.data = mtcars,
.rec_obj = rec_obj,
.parsnip_fns = "nearest_neighbor",
.parsnip_eng = "kknn"
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 kknn regression nearest_neighbor <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
K-Nearest Neighbor Model Specification (regression)
Computational engine: kknn
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: nearest_neighbor()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
K-Nearest Neighbor Model Specification (regression)
Computational engine: kknn
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: nearest_neighbor()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
kknn::train.kknn(formula = ..y ~ ., data = data, ks = min_rows(5, data, 5))
Type of response variable: continuous
minimal mean absolute error: 2.414144
Minimal mean squared error: 9.662884
Best kernel: optimal
Best k: 5
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class train.kknn
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class train.kknn
> fr$fitted_wflw[[1]] |> broom::augment(new_data = mtcars)
# A tibble: 32 × 12
mpg cyl disp hp drat wt qsec vs am gear carb .pred
* <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 21 6 160 110 3.9 2.62 16.5 0 1 4 4 21.2
2 21 6 160 110 3.9 2.88 17.0 0 1 4 4 21.2
3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1 26.4
4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1 20.7
5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2 18.0
6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1 19.9
7 14.3 8 360 245 3.21 3.57 15.8 0 0 3 4 15.6
8 24.4 4 147. 62 3.69 3.19 20 1 0 4 2 22.9
9 22.8 4 141. 95 3.92 3.15 22.9 1 0 4 2 22.9
10 19.2 6 168. 123 3.92 3.44 18.3 1 0 4 4 20.4
# ℹ 22 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 8 × 1
.pred
<dbl>
1 21.2
2 20.4
3 13.3
4 28.5
5 15.4
6 25.6
7 17.0
8 26.4
.parsnip_eng = "brulee"
.parsnip_fns = "logistic_reg"
library(tidyverse)
library(tidyAML)
library(tidymodels)
tidymodels::tidymodels_prefer()
load_deps()
base_tbl <- make_classification_base_tbl()
fns_count <- count(base_tbl, .parsnip_fns) |> arrange(desc(n))
df <- base_tbl |> left_join(fns_count, by = c(".parsnip_fns" = ".parsnip_fns"))
df_tbl <- as_tibble(Titanic) |> uncount(n) |> mutate(Survived = as.factor(Survived))
rec_obj <- recipe(Survived ~ ., data = df_tbl)
splits_obj <- create_splits(df_tbl, "initial_split")
pf <- "logistic_reg"
pe <- "brulee"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
Error in `brulee_logistic_reg_bridge()`:
! There were some non-numeric columns in the predictors. Please use a formula or recipe to encode all of the predictors as numeric.
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 brulee classification logistic_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Logistic Regression Model Specification (classification)
Computational engine: brulee
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: logistic_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Logistic Regression Model Specification (classification)
Computational engine: brulee
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "gee"
.plarsnip_fns = "logistic_reg"
pf <- "logistic_reg"
pe <- "gee"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
Error in terms.formula(f, specials = "id_var"): '.' in formula and no 'data' argument
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 gee classification logistic_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Logistic Regression Model Specification (classification)
Computational engine: gee
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: logistic_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Logistic Regression Model Specification (classification)
Computational engine: gee
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "glm"
.parsnip_fns = "logistic_reg"
pf <- "logistic_reg"
pe <- "glm"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 glm classification logistic_reg <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Logistic Regression Model Specification (classification)
Computational engine: glm
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: logistic_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Logistic Regression Model Specification (classification)
Computational engine: glm
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: logistic_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call: stats::glm(formula = ..y ~ ., family = stats::binomial, data = data)
Coefficients:
(Intercept) Class2nd Class3rd ClassCrew SexMale AgeChild
2.1412 -1.0462 -1.8510 -0.8996 -2.4625 0.9335
Degrees of Freedom: 1649 Total (i.e. Null); 1644 Residual
Null Deviance: 2085
Residual Deviance: 1654 AIC: 1666
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 6 × 5
term estimate std.error statistic p.value
<chr> <dbl> <dbl> <dbl> <dbl>
1 (Intercept) 2.14 0.195 11.0 3.94e-28
2 Class2nd -1.05 0.224 -4.66 3.15e- 6
3 Class3rd -1.85 0.198 -9.36 8.13e-21
4 ClassCrew -0.900 0.180 -5.00 5.59e- 7
5 SexMale -2.46 0.165 -15.0 1.32e-50
6 AgeChild 0.934 0.293 3.19 1.43e- 3
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 1 × 8
null.deviance df.null logLik AIC BIC deviance df.residual nobs
<dbl> <int> <dbl> <dbl> <dbl> <dbl> <int> <int>
1 2085. 1649 -827. 1666. 1698. 1654. 1644 1650
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.775 0.225
2 3rd Male Child No No 0.775 0.225
3 3rd Male Child No No 0.775 0.225
4 3rd Male Child No No 0.775 0.225
5 3rd Male Child No No 0.775 0.225
6 3rd Male Child No No 0.775 0.225
7 3rd Male Child No No 0.775 0.225
8 3rd Male Child No No 0.775 0.225
9 3rd Male Child No No 0.775 0.225
10 3rd Male Child No No 0.775 0.225
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 Yes
7 Yes
8 Yes
9 Yes
10 Yes
.parsnip_eng = "glmer"
.parsnip_fns = "logistic_reg"
pf <- "logistic_reg"
pe <- "glmer"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
Error: No random effects terms specified in formula
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 glmer classification logistic_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Logistic Regression Model Specification (classification)
Computational engine: glmer
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: logistic_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Logistic Regression Model Specification (classification)
Computational engine: glmer
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "glmnet"
.parsnip_fns = "logistic_reg"
pf <- "logistic_reg"
pe <- "glmnet"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
Error in `.check_glmnet_penalty_fit()`:
! For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
• There are 0 values for `penalty`.
• To try multiple values for total regularization, use the tune package.
• To predict multiple penalties, use `multi_predict()`
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 glmnet classification logistic_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Logistic Regression Model Specification (classification)
Computational engine: glmnet
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: logistic_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Logistic Regression Model Specification (classification)
Computational engine: glmnet
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "LiblineaR"
.plarsnip_fns = "logistic_reg"
pf <- "logistic_reg"
pe <- "LiblineaR"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
Error in `maybe_matrix()`:
! Some columns are non-numeric. The data cannot be converted to numeric matrix: 'Class', 'Sex', 'Age'.
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 LiblineaR classification logistic_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Logistic Regression Model Specification (classification)
Computational engine: LiblineaR
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: logistic_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Logistic Regression Model Specification (classification)
Computational engine: LiblineaR
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "MASS"
.parsnip_fns = "discrim_linear"
pf <- "discrim_linear"
pe <- "MASS"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 MASS classification discrim_linear <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Linear Discriminant Model Specification (classification)
Computational engine: MASS
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: discrim_linear()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Discriminant Model Specification (classification)
Computational engine: MASS
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: discrim_linear()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
lda(..y ~ ., data = data)
Prior probabilities of groups:
No Yes
0.6812121 0.3187879
Group means:
Class2nd Class3rd ClassCrew SexMale AgeChild
No 0.1156584 0.3532028 0.4475089 0.9137011 0.03647687
Yes 0.1730038 0.2509506 0.3079848 0.5190114 0.06463878
Coefficients of linear discriminants:
LD1
Class2nd -0.8787393
Class3rd -1.4672030
ClassCrew -0.8156807
SexMale -2.4878185
AgeChild 0.5469386
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class lda
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class lda
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.845 0.155
2 3rd Male Child No No 0.845 0.155
3 3rd Male Child No No 0.845 0.155
4 3rd Male Child No No 0.845 0.155
5 3rd Male Child No No 0.845 0.155
6 3rd Male Child No No 0.845 0.155
7 3rd Male Child No No 0.845 0.155
8 3rd Male Child No No 0.845 0.155
9 3rd Male Child No No 0.845 0.155
10 3rd Male Child No No 0.845 0.155
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 No
8 Yes
9 Yes
10 Yes
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "mda"
.parsnip_fns = "discrim_linear"
pf <- "discrim_linear"
pe <- "mda"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 mda classification discrim_linear <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Linear Discriminant Model Specification (classification)
Computational engine: mda
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: discrim_linear()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Discriminant Model Specification (classification)
Computational engine: mda
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: discrim_linear()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
mda::fda(formula = ..y ~ ., data = data, method = mda::gen.ridge,
keep.fitted = FALSE)
Dimension: 1
Percent Between-Group Variance Explained:
v1
100
Degrees of Freedom (per dimension): 4.96059
Training Misclassification Error: 0.22606 ( N = 1650 )
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class fda
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class fda
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.787 0.213
2 3rd Male Child No No 0.787 0.213
3 3rd Male Child No No 0.787 0.213
4 3rd Male Child No No 0.787 0.213
5 3rd Male Child No No 0.787 0.213
6 3rd Male Child No No 0.787 0.213
7 3rd Male Child No No 0.787 0.213
8 3rd Male Child No No 0.787 0.213
9 3rd Male Child No No 0.787 0.213
10 3rd Male Child No No 0.787 0.213
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 Yes
8 Yes
9 Yes
10 Yes
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "sda"
.parsnip_fns = "discrim_linear"
pf <- "discrim_linear"
pe <- "sda"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
Error in `maybe_matrix()`:
! Some columns are non-numeric. The data cannot be converted to numeric matrix: 'Class', 'Sex', 'Age'.
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 sda classification discrim_linear <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Linear Discriminant Model Specification (classification)
Computational engine: sda
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: discrim_linear()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Discriminant Model Specification (classification)
Computational engine: sda
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "sparsediscrim"
.parsnip_fns = "discrim_linear"
pf <- "discrim_linear"
pe <- "sparsediscrim"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
Error in `pred_to_matrix()`:
! When the predictors data were converted to a matrix, the matrix was no longer numeric. Were there non-numeric columns in the original data?
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 sparsediscrim classification discrim_linear <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Linear Discriminant Model Specification (classification)
Computational engine: sparsediscrim
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: discrim_linear()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Discriminant Model Specification (classification)
Computational engine: sparsediscrim
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "brulee"
.parsnip_fns = "multinom_reg"
pf <- "multinom_reg"
pe <- "brulee"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
Error in `brulee_multinomial_reg_bridge()`:
! There were some non-numeric columns in the predictors. Please use a formula or recipe to encode all of the predictors as numeric.
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 brulee classification multinom_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Multinomial Regression Model Specification (classification)
Computational engine: brulee
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: multinom_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Multinomial Regression Model Specification (classification)
Computational engine: brulee
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "glmnet"
.parsnip_fns = "multinom_reg"
pf <- "multinom_reg"
pe <- "glmnet"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
Error in `.check_glmnet_penalty_fit()`:
! For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
• There are 0 values for `penalty`.
• To try multiple values for total regularization, use the tune package.
• To predict multiple penalties, use `multi_predict()`
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 glmnet classification multinom_reg <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Multinomial Regression Model Specification (classification)
Computational engine: glmnet
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: multinom_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Multinomial Regression Model Specification (classification)
Computational engine: glmnet
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "nnet"
.parsnip_fns = "multinom_reg"
pf <- "multinom_reg"
pe <- "nnet"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 nnet classification multinom_reg <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Multinomial Regression Model Specification (classification)
Computational engine: nnet
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: multinom_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Multinomial Regression Model Specification (classification)
Computational engine: nnet
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: multinom_reg()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
nnet::multinom(formula = ..y ~ ., data = data, trace = FALSE)
Coefficients:
(Intercept) Class2nd Class3rd ClassCrew SexMale AgeChild
2.1674657 -1.1718691 -1.9039494 -0.8807591 -2.4949688 1.4503100
Residual Deviance: 1645.65
AIC: 1657.65
> fr$fitted_wflw[[1]] |> broom::tidy()
Error in model.frame.default(formula = ..y ~ ., data = data) :
'data' must be a data.frame, environment, or list
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 1 × 4
edf deviance AIC nobs
<dbl> <dbl> <dbl> <int>
1 6 1646. 1658. 1650
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 2,206
Class Sex Age Survived .pred_class .pred_1 .pred_2 .pred_3 .pred_4 .pred_5 .pred_6 .pred_7
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 3rd Male Child No No 0.314 0.314 0.314 0.314 0.314 0.314 0.314
2 3rd Male Child No No 0.314 0.314 0.314 0.314 0.314 0.314 0.314
3 3rd Male Child No No 0.314 0.314 0.314 0.314 0.314 0.314 0.314
4 3rd Male Child No No 0.314 0.314 0.314 0.314 0.314 0.314 0.314
5 3rd Male Child No No 0.314 0.314 0.314 0.314 0.314 0.314 0.314
6 3rd Male Child No No 0.314 0.314 0.314 0.314 0.314 0.314 0.314
7 3rd Male Child No No 0.314 0.314 0.314 0.314 0.314 0.314 0.314
8 3rd Male Child No No 0.314 0.314 0.314 0.314 0.314 0.314 0.314
9 3rd Male Child No No 0.314 0.314 0.314 0.314 0.314 0.314 0.314
10 3rd Male Child No No 0.314 0.314 0.314 0.314 0.314 0.314 0.314
# ℹ 2,191 more rows
# ℹ 2,194 more variables: .pred_8 <dbl>, .pred_9 <dbl>, .pred_10 <dbl>, .pred_11 <dbl>,
# .pred_12 <dbl>, .pred_13 <dbl>, .pred_14 <dbl>, .pred_15 <dbl>, .pred_16 <dbl>, .pred_17 <dbl>,
# .pred_18 <dbl>, .pred_19 <dbl>, .pred_20 <dbl>, .pred_21 <dbl>, .pred_22 <dbl>, .pred_23 <dbl>,
# .pred_24 <dbl>, .pred_25 <dbl>, .pred_26 <dbl>, .pred_27 <dbl>, .pred_28 <dbl>, .pred_29 <dbl>,
# .pred_30 <dbl>, .pred_31 <dbl>, .pred_32 <dbl>, .pred_33 <dbl>, .pred_34 <dbl>, .pred_35 <dbl>,
# .pred_36 <dbl>, .pred_37 <dbl>, .pred_38 <dbl>, .pred_39 <dbl>, .pred_40 <dbl>, .pred_41 <dbl>, …
# ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 No
8 No
9 No
10 No
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "MASS"
.parsnip_fns = "discrim_quad"
pf <- "discrim_quad"
pe <- "MASS"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 MASS classification discrim_quad <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Quadratic Discriminant Model Specification (classification)
Computational engine: MASS
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: discrim_quad()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Quadratic Discriminant Model Specification (classification)
Computational engine: MASS
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: discrim_quad()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
qda(..y ~ ., data = data)
Prior probabilities of groups:
No Yes
0.6769697 0.3230303
Group means:
Class2nd Class3rd ClassCrew SexMale AgeChild
No 0.1145927 0.3527305 0.4538944 0.9230081 0.03222919
Yes 0.1613508 0.2401501 0.3076923 0.5403377 0.06941839
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class qda
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class qda
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No Yes 0.00410 0.996
2 3rd Male Child No Yes 0.00410 0.996
3 3rd Male Child No Yes 0.00410 0.996
4 3rd Male Child No Yes 0.00410 0.996
5 3rd Male Child No Yes 0.00410 0.996
6 3rd Male Child No Yes 0.00410 0.996
7 3rd Male Child No Yes 0.00410 0.996
8 3rd Male Child No Yes 0.00410 0.996
9 3rd Male Child No Yes 0.00410 0.996
10 3rd Male Child No Yes 0.00410 0.996
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 Yes
2 Yes
3 Yes
4 Yes
5 Yes
6 Yes
7 Yes
8 Yes
9 Yes
10 Yes
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "sparsediscrim"
.parsnip_fns = "discrim_quad"
pf <- "discrim_quad"
pe <- "sparsediscrim"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
Error in `pred_to_matrix()`:
! When the predictors data were converted to a matrix, the matrix was no longer numeric. Were there non-numeric columns in the original data?
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 sparsediscrim classification discrim_quad <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Quadratic Discriminant Model Specification (classification)
Computational engine: sparsediscrim
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: discrim_quad()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Quadratic Discriminant Model Specification (classification)
Computational engine: sparsediscrim
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "brulee"
.parsnip_fns = "mlp"
pf <- "mlp"
pe <- "brulee"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
Error in `brulee_mlp_bridge()`:
! There were some non-numeric columns in the predictors. Please use a formula or recipe to encode all of the predictors as numeric.
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 brulee classification mlp <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Single Layer Neural Network Model Specification (classification)
Computational engine: brulee
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: mlp()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Single Layer Neural Network Model Specification (classification)
Computational engine: brulee
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "nnet"
.parsnip_fns = "mlp"
pf <- "mlp"
pe <- "nnet"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 nnet classification mlp <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Single Layer Neural Network Model Specification (classification)
Computational engine: nnet
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: mlp()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Single Layer Neural Network Model Specification (classification)
Computational engine: nnet
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: mlp()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
a 5-5-1 network with 36 weights
inputs: Class2nd Class3rd ClassCrew SexMale AgeChild
output(s): ..y
options were - entropy fitting
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class nnet.formula
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class nnet.formula
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.592 0.408
2 3rd Male Child No No 0.592 0.408
3 3rd Male Child No No 0.592 0.408
4 3rd Male Child No No 0.592 0.408
5 3rd Male Child No No 0.592 0.408
6 3rd Male Child No No 0.592 0.408
7 3rd Male Child No No 0.592 0.408
8 3rd Male Child No No 0.592 0.408
9 3rd Male Child No No 0.592 0.408
10 3rd Male Child No No 0.592 0.408
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 No
8 No
9 No
10 No
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "kernlab"
.parsnip_fns = "svm_linear"
pf <- "svm_linear"
pe <- "kernlab"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 kernlab classification svm_linear <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Linear Support Vector Machine Model Specification (classification)
Computational engine: kernlab
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_linear()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Support Vector Machine Model Specification (classification)
Computational engine: kernlab
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_linear()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Support Vector Machine object of class "ksvm"
SV type: C-svc (classification)
parameter : cost C = 1
Linear (vanilla) kernel function.
Number of Support Vectors : 770
Objective Function Value : -768
Training error : 0.232121
Probability model included.
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class ksvm
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class ksvm
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.776 0.224
2 3rd Male Child No No 0.776 0.224
3 3rd Male Child No No 0.776 0.224
4 3rd Male Child No No 0.776 0.224
5 3rd Male Child No No 0.776 0.224
6 3rd Male Child No No 0.776 0.224
7 3rd Male Child No No 0.776 0.224
8 3rd Male Child No No 0.776 0.224
9 3rd Male Child No No 0.776 0.224
10 3rd Male Child No No 0.776 0.224
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 No
8 No
9 No
10 No
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "LiblineaR"
.parsnip_fns = "svm_linear"
pf <- "svm_linear"
pe <- "LiblineaR"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
Error in `maybe_matrix()`:
! Some columns are non-numeric. The data cannot be converted to numeric matrix: 'Class', 'Sex', 'Age'.
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 LiblineaR classification svm_linear <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
Linear Support Vector Machine Model Specification (classification)
Computational engine: LiblineaR
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_linear()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Linear Support Vector Machine Model Specification (classification)
Computational engine: LiblineaR
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "kernlab"
.parsnip_fns = "svm_rbf"
pf <- "svm_rbf"
pe <- "kernlab"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 kernlab classification svm_rbf <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Radial Basis Function Support Vector Machine Model Specification (classification)
Computational engine: kernlab
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_rbf()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Radial Basis Function Support Vector Machine Model Specification (classification)
Computational engine: kernlab
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_rbf()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Support Vector Machine object of class "ksvm"
SV type: C-svc (classification)
parameter : cost C = 1
Gaussian Radial Basis kernel function.
Hyperparameter : sigma = 0.523809523809522
Number of Support Vectors : 758
Objective Function Value : -742.6213
Training error : 0.221818
Probability model included.
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class ksvm
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class ksvm
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.771 0.229
2 3rd Male Child No No 0.771 0.229
3 3rd Male Child No No 0.771 0.229
4 3rd Male Child No No 0.771 0.229
5 3rd Male Child No No 0.771 0.229
6 3rd Male Child No No 0.771 0.229
7 3rd Male Child No No 0.771 0.229
8 3rd Male Child No No 0.771 0.229
9 3rd Male Child No No 0.771 0.229
10 3rd Male Child No No 0.771 0.229
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 No
8 No
9 No
10 No
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "liquidSVM"
.parsnip_fns = "svm_rbf"
pf <- "svm_rbf"
pe <- "liquidSVM"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
.parsnip_eng = "earth"
.parsnip_fns = "bag_mars"
pf <- "bag_mars"
pe <- "earth"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 earth classification bag_mars <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Bagged MARS Model Specification (classification)
Computational engine: earth
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: bag_mars()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Bagged MARS Model Specification (classification)
Computational engine: earth
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: bag_mars()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Bagged MARS (classification with 11 members)
Variable importance scores include:
# A tibble: 5 × 4
term value std.error used
<chr> <dbl> <dbl> <int>
1 SexMale 100 0 11
2 Class3rd 40.1 1.67 11
3 AgeChild 23.3 2.22 11
4 ClassCrew 20.2 1.21 11
5 Class2nd 16.2 1.62 11
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class bagger
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class bagger
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.723 0.277
2 3rd Male Child No No 0.723 0.277
3 3rd Male Child No No 0.723 0.277
4 3rd Male Child No No 0.723 0.277
5 3rd Male Child No No 0.723 0.277
6 3rd Male Child No No 0.723 0.277
7 3rd Male Child No No 0.723 0.277
8 3rd Male Child No No 0.723 0.277
9 3rd Male Child No No 0.723 0.277
10 3rd Male Child No No 0.723 0.277
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 No
8 No
9 No
10 No
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "earth"
.parsnip_fns = "discrim_flexible"
pf <- "discrim_flexible"
pe <- "earth"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 earth classification discrim_flexible <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Flexible Discriminant Model Specification (classification)
Computational engine: earth
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: discrim_flexible()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Flexible Discriminant Model Specification (classification)
Computational engine: earth
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: discrim_flexible()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
mda::fda(formula = ..y ~ ., data = data, method = earth::earth)
Dimension: 1
Percent Between-Group Variance Explained:
v1
100
Training Misclassification Error: 0.22242 ( N = 1650 )
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class fda
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class fda
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.786 0.214
2 3rd Male Child No No 0.786 0.214
3 3rd Male Child No No 0.786 0.214
4 3rd Male Child No No 0.786 0.214
5 3rd Male Child No No 0.786 0.214
6 3rd Male Child No No 0.786 0.214
7 3rd Male Child No No 0.786 0.214
8 3rd Male Child No No 0.786 0.214
9 3rd Male Child No No 0.786 0.214
10 3rd Male Child No No 0.786 0.214
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 No
8 No
9 No
10 No
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "dbarts"
.parsnip_fns = "bart"
pf <- "bart"
pe <- "dbarts"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 dbarts classification bart <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Call:
NULL
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: bart()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
NULL
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: bart()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
`NULL`()
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class bart
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class bart
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.678 0.322
2 3rd Male Child No No 0.684 0.316
3 3rd Male Child No No 0.7 0.3
4 3rd Male Child No No 0.695 0.305
5 3rd Male Child No No 0.66 0.34
6 3rd Male Child No No 0.64 0.36
7 3rd Male Child No No 0.68 0.32
8 3rd Male Child No No 0.68 0.32
9 3rd Male Child No No 0.677 0.323
10 3rd Male Child No No 0.69 0.31
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 No
8 No
9 No
10 No
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "klaR"
.parsnip_fns = "discrim_regularized"
pf <- "discrim_regularized"
pe <- "klaR"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 klaR classification discrim_regular… <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Regularized Discriminant Model Specification (classification)
Computational engine: klaR
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: discrim_regularized()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Regularized Discriminant Model Specification (classification)
Computational engine: klaR
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: discrim_regularized()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
rda(formula = ..y ~ ., data = data)
Regularization parameters:
gamma lambda
0.3003124 0.2815572
Prior probabilities of groups:
No Yes
0.690303 0.309697
Misclassification rate:
apparent: 20.424 %
cross-validated: 20.424 %
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class rda
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class rda
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.599 0.401
2 3rd Male Child No No 0.599 0.401
3 3rd Male Child No No 0.599 0.401
4 3rd Male Child No No 0.599 0.401
5 3rd Male Child No No 0.599 0.401
6 3rd Male Child No No 0.599 0.401
7 3rd Male Child No No 0.599 0.401
8 3rd Male Child No No 0.599 0.401
9 3rd Male Child No No 0.599 0.401
10 3rd Male Child No No 0.599 0.401
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 No
8 Yes
9 Yes
10 Yes
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "mgcv"
.parsnip_fns = "gen_additive_mod"
pf <- "gen_additive_mod"
pe <- "mgcv"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
Error in `fit_xy()`:
! `fit()` must be used with GAM models (due to its use of formulas).
Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "NULL"
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 mgcv classification gen_additive_mod <spec[+]> <workflow> <NULL> <NULL>
> fr$model_spec[[1]]
GAM Model Specification (classification)
Computational engine: mgcv
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: gen_additive_mod()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
GAM Model Specification (classification)
Computational engine: mgcv
> fr$fitted_wflw[[1]]
NULL
> fr$fitted_wflw[[1]] |> broom::tidy()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::glance()
# A tibble: 0 × 0
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 0 × 0
> fr$pred_wflw[[1]]
NULL
.parsnip_eng = "earth"
.parsnip_fns = "mars"
pf <- "mars"
pe <- "earth"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 earth classification mars <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
MARS Model Specification (classification)
Computational engine: earth
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: mars()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
MARS Model Specification (classification)
Computational engine: earth
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: mars()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
GLM (family binomial, link logit):
nulldev df dev df devratio AIC iters converged
2090.66 1649 1668.12 1644 0.202 1680 4 1
Earth selected 6 of 6 terms, and 5 of 5 predictors
Termination condition: RSq changed by less than 0.001 at 6 terms
Importance: SexMale, Class3rd, ClassCrew, Class2nd, AgeChild
Number of terms at each degree of interaction: 1 5 (additive model)
Earth GCV 0.1667925 RSS 271.5504 GRSq 0.2454808 RSq 0.2546043
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class earth
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class earth
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.791 0.209
2 3rd Male Child No No 0.791 0.209
3 3rd Male Child No No 0.791 0.209
4 3rd Male Child No No 0.791 0.209
5 3rd Male Child No No 0.791 0.209
6 3rd Male Child No No 0.791 0.209
7 3rd Male Child No No 0.791 0.209
8 3rd Male Child No No 0.791 0.209
9 3rd Male Child No No 0.791 0.209
10 3rd Male Child No No 0.791 0.209
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 No
8 Yes
9 Yes
10 No
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "klaR"
.parsnip_fns = "naive_Bayes"
pf <- "naive_Bayes"
pe <- "klaR"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 klaR classification naive_Bayes <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Naive Bayes Model Specification (classification)
Computational engine: klaR
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: naive_Bayes()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Naive Bayes Model Specification (classification)
Computational engine: klaR
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: naive_Bayes()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
$apriori
grouping
No Yes
0.6860606 0.3139394
$tables
$tables$Class
var
grouping 1st 2nd 3rd Crew
No 0.08303887 0.11925795 0.34363958 0.45406360
Yes 0.27992278 0.16988417 0.26447876 0.28571429
$tables$Sex
var
grouping Female Male
No 0.08392226 0.91607774
Yes 0.48841699 0.51158301
$tables$Age
var
grouping Adult Child
No 0.96201413 0.03798587
Yes 0.90926641 0.09073359
$levels
[1] "No" "Yes"
$call
NaiveBayes.default(x = ~maybe_data_frame(x), grouping = ~y, usekernel = ~TRUE)
$x
Class Sex Age
1 Crew Male Adult
2 3rd Male Adult
3 2nd Female Adult
4 3rd Male Adult
5 1st Male Adult
6 3rd Male Adult
7 3rd Male Adult
8 Crew Male Adult
9 2nd Male Adult
10 Crew Male Adult
11 1st Male Adult
12 Crew Male Adult
13 Crew Male Adult
14 3rd Female Adult
15 1st Male Adult
16 Crew Male Adult
17 Crew Male Adult
...
and 326 more lines.
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class NaiveBayes
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class NaiveBayes
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.680 0.320
2 3rd Male Child No No 0.680 0.320
3 3rd Male Child No No 0.680 0.320
4 3rd Male Child No No 0.680 0.320
5 3rd Male Child No No 0.680 0.320
6 3rd Male Child No No 0.680 0.320
7 3rd Male Child No No 0.680 0.320
8 3rd Male Child No No 0.680 0.320
9 3rd Male Child No No 0.680 0.320
10 3rd Male Child No No 0.680 0.320
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 No
8 Yes
9 Yes
10 No
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "kknn"
.parsnip_fns = "nearest_neighbor"
pf <- "nearest_neighbor"
pe <- "kknn"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 kknn classification nearest_neighbor <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
K-Nearest Neighbor Model Specification (classification)
Computational engine: kknn
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: nearest_neighbor()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
K-Nearest Neighbor Model Specification (classification)
Computational engine: kknn
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: nearest_neighbor()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Call:
kknn::train.kknn(formula = ..y ~ ., data = data, ks = min_rows(5, data, 5))
Type of response variable: nominal
Minimal misclassification: 0.209697
Best kernel: optimal
Best k: 5
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class train.kknn
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class train.kknn
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.860 0.140
2 3rd Male Child No No 0.860 0.140
3 3rd Male Child No No 0.860 0.140
4 3rd Male Child No No 0.860 0.140
5 3rd Male Child No No 0.860 0.140
6 3rd Male Child No No 0.860 0.140
7 3rd Male Child No No 0.860 0.140
8 3rd Male Child No No 0.860 0.140
9 3rd Male Child No No 0.860 0.140
10 3rd Male Child No No 0.860 0.140
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 No
8 No
9 No
10 Yes
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "xrf"
.parsnip_fns = "rule_fit"
pf <- "rule_fit"
pe <- "xrf"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 xrf classification rule_fit <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
RuleFit Model Specification (classification)
Computational engine: xrf
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: rule_fit()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
RuleFit Model Specification (classification)
Computational engine: xrf
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: rule_fit()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
An eXtreme RuleFit model of 22 rules.
Original Formula:
..y ~ Class + Sex + Age
> fr$fitted_wflw[[1]] |> broom::tidy()
Error in `generics::tidy()`:
! Please choose a single numeric value of 'penalty'.
Run `rlang::last_trace()` to see where the error occurred.
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class xrf
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.731 0.269
2 3rd Male Child No No 0.731 0.269
3 3rd Male Child No No 0.731 0.269
4 3rd Male Child No No 0.731 0.269
5 3rd Male Child No No 0.731 0.269
6 3rd Male Child No No 0.731 0.269
7 3rd Male Child No No 0.731 0.269
8 3rd Male Child No No 0.731 0.269
9 3rd Male Child No No 0.731 0.269
10 3rd Male Child No No 0.731 0.269
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 No
6 No
7 No
8 No
9 No
10 No
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows
.parsnip_eng = "kernlab"
.parsnip_fns = "svm_poly"
pf <- "svm_poly"
pe <- "kernlab"
fr <- fast_classification(
.data = df_tbl,
.rec_obj = rec_obj,
.parsnip_fns = pf,
.parsnip_eng = pe
)
> fr
# A tibble: 1 × 8
.model_id .parsnip_engine .parsnip_mode .parsnip_fns model_spec wflw fitted_wflw pred_wflw
<int> <chr> <chr> <chr> <list> <list> <list> <list>
1 1 kernlab classification svm_poly <spec[+]> <workflow> <workflow> <tibble>
> fr$model_spec[[1]]
Polynomial Support Vector Machine Model Specification (classification)
Computational engine: kernlab
> fr$wflw[[1]]
══ Workflow ═══════════════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_poly()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Polynomial Support Vector Machine Model Specification (classification)
Computational engine: kernlab
> fr$fitted_wflw[[1]]
══ Workflow [trained] ═════════════════════════════════════════════════════════════════════════════════
Preprocessor: Recipe
Model: svm_poly()
── Preprocessor ───────────────────────────────────────────────────────────────────────────────────────
0 Recipe Steps
── Model ──────────────────────────────────────────────────────────────────────────────────────────────
Support Vector Machine object of class "ksvm"
SV type: C-svc (classification)
parameter : cost C = 1
Polynomial kernel function.
Hyperparameters : degree = 1 scale = 1 offset = 1
Number of Support Vectors : 755
Objective Function Value : -750
Training error : 0.226667
Probability model included.
> fr$fitted_wflw[[1]] |> broom::tidy()
Error: No tidy method for objects of class ksvm
> fr$fitted_wflw[[1]] |> broom::glance()
Error: No glance method for objects of class ksvm
> fr$fitted_wflw[[1]] |> broom::augment(new_data = df_tbl)
# A tibble: 2,201 × 7
Class Sex Age Survived .pred_class .pred_No .pred_Yes
<chr> <chr> <chr> <fct> <fct> <dbl> <dbl>
1 3rd Male Child No No 0.781 0.219
2 3rd Male Child No No 0.781 0.219
3 3rd Male Child No No 0.781 0.219
4 3rd Male Child No No 0.781 0.219
5 3rd Male Child No No 0.781 0.219
6 3rd Male Child No No 0.781 0.219
7 3rd Male Child No No 0.781 0.219
8 3rd Male Child No No 0.781 0.219
9 3rd Male Child No No 0.781 0.219
10 3rd Male Child No No 0.781 0.219
# ℹ 2,191 more rows
# ℹ Use `print(n = ...)` to see more rows
> fr$pred_wflw[[1]]
# A tibble: 551 × 1
.pred_class
<fct>
1 No
2 No
3 No
4 No
5 Yes
6 Yes
7 Yes
8 Yes
9 Yes
10 No
# ℹ 541 more rows
# ℹ Use `print(n = ...)` to see more rows