Skip to contents

Use Random Forest for Binary Classification

Usage

lnr_rf_binary(data, formula, ...)

Arguments

data

A dataframe to train a learner / learners on.

formula

A regression formula to use inside this learner.

...

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.358               0.434 
#>   Hornet Sportabout             Valiant          Duster 360           Merc 240D 
#>               0.002               0.000               0.088               0.124 
#>            Merc 230            Merc 280           Merc 280C          Merc 450SE 
#>               0.358               0.026               0.000               0.208 
#>          Merc 450SL         Merc 450SLC  Cadillac Fleetwood Lincoln Continental 
#>               0.006               0.070               0.002               0.002 
#>   Chrysler Imperial            Fiat 128         Honda Civic      Toyota Corolla 
#>               0.238               0.994               0.994               0.994 
#>       Toyota Corona    Dodge Challenger         AMC Javelin          Camaro Z28 
#>               0.182               0.042               0.070               0.028 
#>    Pontiac Firebird           Fiat X1-9       Porsche 914-2        Lotus Europa 
#>               0.026               0.890               0.870               0.994 
#>      Ford Pantera L        Ferrari Dino       Maserati Bora          Volvo 142E 
#>               0.616               0.630               0.644               0.434