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

Make Predictions from a "Knn" Object

Description

Make Predictions from a "Knn" Object

Usage

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

Arguments

model

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

Value

Predicted values are returned as a DataFrame, structured as follows. result.df : DataFrame Predicted result, structured as follows:

nearest.neighbors.df : DataFrame 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.Knn

Examples

## Not run: 
Predict:
> res <- predict(knn, pred.df, "ID")
> res$Collect()
   ID  TYPE
0   0     3
1   1     3
2   2     3
3   3     1
4   4     1
5   5     1
6   6     1
7   7     1

## End(Not run)

[Package hana.ml.r version 1.0.8 Index]