A wrapper for randomForest::randomForest() for use in nadir::super_learner().
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 (a numeric vector of values, one for each row
of newdata).
Examples
lnr_rf(mtcars, mpg ~ hp + disp + am + wt, ntree = 20)(mtcars)
#> Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive
#> 21.92877 21.92877 23.88811 20.67539
#> Hornet Sportabout Valiant Duster 360 Merc 240D
#> 16.75199 19.28910 14.71507 23.17047
#> Merc 230 Merc 280 Merc 280C Merc 450SE
#> 22.68131 18.88660 18.88660 16.40324
#> Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental
#> 16.38635 16.24485 12.33698 12.33698
#> Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla
#> 13.39348 28.60408 29.95650 30.24775
#> Toyota Corona Dodge Challenger AMC Javelin Camaro Z28
#> 22.72747 16.35202 16.40327 14.29073
#> Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa
#> 16.64574 28.93692 25.14936 28.30558
#> Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E
#> 18.55486 22.00977 17.58777 22.56494
