Skip to contents

Predict from a trained model

Usage

# S3 method for class 'morie_ml_fit'
predict(object, newdata, type = c("response", "class"), ...)

Arguments

object

A morie_ml_fit.

newdata

Predictor matrix/data.frame with the training columns.

type

"response" (probabilities / fitted values) or "class" (0/1, logistic only).

...

Unused.

Value

Numeric vector of predictions.

Examples

m <- morie_ml_train(morie_ml_model("linear", "gd"),
                    mtcars[c("hp", "wt")], mtcars$mpg)
predict(m, mtcars[c("hp", "wt")])[1:3]
#> [1] 23.57231 22.58354 25.27578