predict.LinearRegression {hana.ml.r}R Documentation

Make Predictions from a "LinearRegression" Object

Description

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

Usage

## S3 method for class 'LinearRegression'
predict(model, data, key, features = NULL,
  model.format = NULL, ...)

Arguments

model

R6Class object
LinearRegression object for prediction.

data

DataFrame
data for prediction.

key

character
Name of the ID column.

features

list of character, optional
Names of the feature columns. If features is not provided, it defaults to all non-ID columns.

model.format

character, optional
Choose the format of mdoel. 'coefficients' or 'pmml'.
Defaults to 'coefficients'.

Value

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

See Also

hanaml.LinearRegression

Examples

## Not run: 
#'Perform the predict on DataFrame df2 using "LinearRegression" object lr:

>df2$Collect()
  ID     X1 X2  X3
0   0  1.690  B   1
1   1  0.054  B   2
2   2  0.123  A   2
3   3  1.980  A   1
4   4  0.563  A   1

>fitted <- predict(model = lr, data = df2, key = "ID")$Collect()
  ID      VALUE
0   0  10.314760
1   1   1.685926
2   2  -7.409561
3   3   2.021592
4   4  -3.122685

> fitted
 ID     VALUE
1  0  8.889325
2  1  1.140495
3  2 -8.013622
4  3  0.418650
5  4 -3.963423

## End(Not run)

[Package hana.ml.r version 1.0.8 Index]