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

# S3 method for GaussianMixture
predict(model, data, key, features = NULL, ...)

Format

S3 methods

Arguments

model

R6Class object
A 'GaussianMixture' object for prediction.

data

DataFrame
DataFrame containting the data.

key

character
Name of the ID column.

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.

...

Reserved parameter.

Value

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

  • ID column, with same name and type as data 's ID column.

  • Cluster_ID, type INTEGER, the assigned cluster ID.

  • PROBABILITY, type DOUBLE, Probability that the instance belong to a particular cluster.

Examples

Perform the predict on DataFrame data2 using "GaussianMixture" objectc gmm:


> data2$Collect()
  ID    X1    X2  X3
1  0  0.10  0.10   1
2  1  0.11  0.10   1
3  2  0.10  0.11   1
4  3  0.11  0.11   1
5  4  0.12  0.11   1

> fitted <- predict(model = gmm, data = data2)

Output:


> fitted$Collect()
     ID  CLUSTER_ID  PROBABILITY
1     0           0            1
2     1           0            1
3     2           0            0
4     3           0            0
5     4           0            0
6     0           1            0
7     1           1            0
8     2           1            1
9     3           1            1
10    4           1            1