Use Random Forest for Binary Classification
Arguments
- data
A dataframe to train a learner / learners on.
- formula
A regression formula to use inside this learner.
- weights
Observation weights; see
?lm- ...
Any extra arguments that should be passed to the internal model for model fitting purposes.
Value
A prediction function that accepts newdata, which returns
predictions for the probability of the outcome being 1/TRUE (a numeric
vector of values, one for each row of newdata).
Examples
lnr_rf_binary(data = mtcars, am ~ mpg)(mtcars)
#> Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive
#> 0.916 0.916 0.398 0.432
#> Hornet Sportabout Valiant Duster 360 Merc 240D
#> 0.002 0.000 0.100 0.134
#> Merc 230 Merc 280 Merc 280C Merc 450SE
#> 0.398 0.024 0.000 0.214
#> Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental
#> 0.002 0.092 0.008 0.008
#> Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla
#> 0.254 0.996 0.996 0.996
#> Toyota Corona Dodge Challenger AMC Javelin Camaro Z28
#> 0.174 0.054 0.092 0.040
#> Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa
#> 0.024 0.910 0.878 0.996
#> Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E
#> 0.644 0.660 0.642 0.432
