Skip to contents

A wrapper provided for convenience around lnr_glm that sets family = binomial(link = 'logit').

Usage

lnr_logistic(data, formula, weights = NULL, ...)

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_logistic(mtcars, am ~ hp)(mtcars)
#>           Mazda RX4       Mazda RX4 Wag          Datsun 710      Hornet 4 Drive 
#>           0.4709653           0.4709653           0.5054301           0.4709653 
#>   Hornet Sportabout             Valiant          Duster 360           Merc 240D 
#>           0.3443694           0.4810880           0.2293330           0.5679156 
#>            Merc 230            Merc 280           Merc 280C          Merc 450SE 
#>           0.5013718           0.4447781           0.4447781           0.3352648 
#>          Merc 450SL         Merc 450SLC  Cadillac Fleetwood Lincoln Continental 
#>           0.3352648           0.3352648           0.2916474           0.2751661 
#>   Chrysler Imperial            Fiat 128         Honda Civic      Toyota Corolla 
#>           0.2515572           0.5599314           0.5877140           0.5619305 
#>       Toyota Corona    Dodge Challenger         AMC Javelin          Camaro Z28 
#>           0.4973132           0.3915135           0.3915135           0.2293330 
#>    Pontiac Firebird           Fiat X1-9       Porsche 914-2        Lotus Europa 
#>           0.3443694           0.5599314           0.5094877           0.4649025 
#>      Ford Pantera L        Ferrari Dino       Maserati Bora          Volvo 142E 
#>           0.2032172           0.3443694           0.1253601           0.4729882