Similar to other predict methods, this function predicts fitted values from a fitted "OnlineLinearRegression" object.

# S3 method for OnlineLinearRegression
predict(model, data, key, features = NULL)

Format

S3 methods

Arguments

model

R6Class object
An "OnlineLinearRegression" object for prediction.

data

DataFrame
DataFrame containting the data.

key

character
Name of the ID column.

features

character of list of characters, optional
Name of feature columns for prediction.
If not provided, it defaults to all non-key columns of data.

Value

Predicted values are returned as a DataFrame, structured as follows.

  • ID column, with same name and type as data's ID column.

  • VALUE, type DOUBLE, representing predicted values.

Examples

Call predict() with df.predict:


> df.predict$Collect()
    ID    X1    X2
 0  14     2    67
 1  15     3    51

Invoke predict():


> fitted <- predict(olr, df.predict, key="ID", features=list("X1", "X2"))
> fitted$Collect()
    ID       VALUE
 0  14  279.020611
 1  15  218.024511