predict.GaussianMixture.Rd
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, ...)
S3
methods
R6Class object
A 'GaussianMixture' object for prediction.
DataFrame
DataFrame containting the data.
character
Name of the ID column.
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.
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.
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