predict.NaiveBayes {hana.ml.r} | R Documentation |
Similar to other predict methods, this function predicts fitted values from a fitted "NaiveBayes" object.
## S3 method for class 'NaiveBayes' predict(model, data, key, features = NULL, alpha = NULL, verbose = NULL, thread.ratio = NULL)
model |
|
data |
|
key |
|
features |
|
alpha |
|
verbose |
|
thread.ratio |
|
Predicted values are returned as a DataFrame, structured as follows.
ID
- with the same name and type as
data's ID column.
CLASS
- predicted class name
CONFIDENCE
- confidence for
the prediction of the sample, which is a
logarithmic value of the posterior probabilities.
A non-zero Laplace value (alpha) is required if there exist discrete category values that only occur in the test set. It can be read from JSON models or from the parameter alpha in predict(). The Laplace value you set here takes precedence over the values read from JSON models.
## Not run: Input DataFrame df2 for prediction: > df2$collect() ID HOMEOWNER MARITALSTATUS ANNUALINCOME 0 0 NO Married 120.0 1 1 YES Married 180.0 2 2 NO Single 90.0 Output: > predict(model, df2, "ID", alpha=1.0, verbose=True) ID CLASS CONFIDENCE 0 0 NO -6.572353 1 0 YES -23.747252 2 1 NO -7.602221 3 1 YES -169.133547 4 2 NO -7.133599 5 2 YES -4.648640 ## End(Not run)