Create prediction model
create_model_prediction.Rd
Create prediction model
Arguments
- target_test_df
A dataframe with columns relevant to the regression model, i.e., target variable and predictors
- model_fit
A "workflow" class object generated by the
create_fit
function
Examples
train_df <- target_df(mtcars[1:16, ], 'gear', c("am", "vs"))
test_df <- target_df(mtcars[17:32, ], 'gear', c("am", "vs"))
x_recipe <- create_recipe(train_df, target_variable="gear")
x_spec_list <- create_spec_kmin(train_df, model_recipe=x_recipe, method="lm", target_variable="gear")
x_spec <- get_list_item(x_spec_list, n=1)
x_fit <- create_fit(x_recipe, x_spec, train_df)
create_model_prediction(test_df, x_fit )
#> gear am vs .pred
#> Chrysler Imperial 3 0 0 3.052632
#> Fiat 128 4 1 1 4.368421
#> Honda Civic 4 1 1 4.368421
#> Toyota Corolla 4 1 1 4.368421
#> Toyota Corona 3 0 1 3.605263
#> Dodge Challenger 3 0 0 3.052632
#> AMC Javelin 3 0 0 3.052632
#> Camaro Z28 3 0 0 3.052632
#> Pontiac Firebird 3 0 0 3.052632
#> Fiat X1-9 4 1 1 4.368421
#> Porsche 914-2 5 1 0 3.815789
#> Lotus Europa 5 1 1 4.368421
#> Ford Pantera L 5 1 0 3.815789
#> Ferrari Dino 5 1 0 3.815789
#> Maserati Bora 5 1 0 3.815789
#> Volvo 142E 4 1 1 4.368421