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(mtcars, am ~ hp)(mtcars)
#> Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive
#> 0.704 0.704 0.884 0.704
#> Hornet Sportabout Valiant Duster 360 Merc 240D
#> 0.232 0.346 0.024 0.342
#> Merc 230 Merc 280 Merc 280C Merc 450SE
#> 0.262 0.122 0.122 0.010
#> Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental
#> 0.010 0.010 0.000 0.000
#> Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla
#> 0.002 0.968 0.750 0.968
#> Toyota Corona Dodge Challenger AMC Javelin Camaro Z28
#> 0.102 0.026 0.026 0.024
#> Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa
#> 0.232 0.968 0.884 0.910
#> Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E
#> 0.632 0.232 0.874 0.900
