predict.LinearRegression.RdSimilar to other predict methods, this function predicts fitted values from a fitted "LinearRegression" object.
# S3 method for LinearRegression predict(model, data, key, features = NULL, model.format = NULL, ...)
| model |
|
|---|---|
| data |
|
| key |
|
| features |
|
| model.format |
|
| ... | Reserved parameter. |
S3 methods
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.
Perform the predict on DataFrame data2 using "LinearRegression" object lr:
>data2$Collect() ID X1 X2 X3 1 0 1.690 B 1 2 1 0.054 B 2 3 2 0.123 A 2 4 3 1.980 A 1 5 4 0.563 A 1
Call the function and obtain the result:
>fitted <- predict(model = lr, data = data2, key = "ID")$Collect() ID VALUE 1 0 10.314760 2 1 1.685926 3 2 -7.409561 4 3 2.021592 5 4 -3.122685