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

Make Predictions from a "KNNRegressor" Object

Description

Make Predictions from a "KNNRegressor" Object

Usage

## S3 method for class 'KNNRegressor'
predict(model, data, key, features = NULL,
  stat.info = NULL, thread.ratio = NULL)

Arguments

model

R6Class object
KNNRegressor 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.

stat.info

logical, optional
Controls whether to return a statistic information table containing the distance between each point in the prediction set and its k nearest neighbors in the training set.

If TRUE, the statistics table will be returned non-empty.

Defaults to TRUE.

thread.ratio

double, optional
Controls the proportion of available threads to use. The value range is from 0 to 1, where 0 indicates a single thread, and 1 indicates up to all available threads. Values between 0 and 1 will use up to that percentage of available threads. Values outside this range tell PAL to heuristically determine the number of threads to use.

Defaults to 0.

Value

DataFrame: Prediction results, structured as follows.

DataFrame: Statistics of the prediction results.
The distance between each point in 'data' and its k nearest neighbors in the training set. Only returned if stat.info is TRUE.

See Also

hanaml.KNNClassifier

Examples

## Not run: 
> df.pred
  ID X1    X2 X3
1  0  2     1  A
2  1  1    10  C
3  2  1    11  B
4  3  3 15000  C
5  4  2  1000  C
6  5  1  1001  A
7  6  1   999  A
8  7  3   999  B

Predict:
> res <- predict(model = knr, data = df.pred, key = "ID",
                features = c("X1", "X2", "X3"),
                stat.info = FALSE)
> res$Collect()
  ID   TARGET
0   0  7.00000
1   1  7.00000
2   2  7.00000
3   3 36.66667
4   4 36.66667
5   5 36.66667
6   6 39.66667
7   7 69.33333

## End(Not run)


[Package hana.ml.r version 1.0.8 Index]