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

# S3 method for AutomaticRegression
predict(
  model,
  data,
  key,
  features = NULL,
  show.explainer = FALSE,
  top.k.attributions = NULL
)

Format

S3 methods

Arguments

model

R6Class
An "hanaml.AutomaticRegression" object for prediction.

data

DataFrame
DataFrame containting the data.

key

character, optional
Name of the ID column. If not provided, the data is assumed to have no ID column.
No default value.

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.

show.explainer

logical, optional
If True, the reason code will be returned. Only valid when background.size is provided during the fit process.

top.k.attributions

int, optional
Display the top k attributions in reason code.

Value

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

  • 1st column: Data type and name same as the 1st column of data.

  • 2nd column: SCORE, predicted values.

Examples

Assume we have df.fit for training, df.predict for prediction.


> auto.reg <- hanaml.AutomaticRegression(data = df.fit,
                                         pipeline = NULL,
                                         categorical.variable =
                                           list("OUTLOOK", "WINDY"),
                                         scorings = NULL,
                                         generations = 2,
                                         population.size = 5,
                                         offspring.size =10,
                                         elite.number = 3,
                                         min.layer = 2,
                                         max.layer = 5,
                                         mutation.rate = 0.1,
                                         crossover.rate = 0.9,
                                         random.seed = 1,
                                         config.dict = NULL,
                                         progress.indicator.id = "AUTOML_REG_TEST",
                                         fold.num = 5,
                                         resampling.method = "cv",
                                         max.eval.time.mins = NULL,
                                         early.stop = 3)

If we want to predict:


> pre.res <- predict(model = auto.reg,
                     data = df.predict,
                     key = "ID")

The output could be achieved by the following lines:


> print(pre.res$Collect())