predict.MixtComp {RMixtComp} | R Documentation |
Predict using RMixtComp
Description
Predict the cluster of new samples.
Usage
## S3 method for class 'MixtComp'
predict(
object,
newdata = NULL,
type = c("partition", "probabilities"),
nClass = NULL,
...
)
Arguments
object |
output of mixtCompLearn function. |
newdata |
a data.frame, a matrix or a named list containing the data (see Details and Data format
sections in mixtCompLearn documentation). If |
type |
if "partition", returns the estimated partition. If "probabilities", returns the probabilities to belong to each class (tik). |
nClass |
the number of classes of the mixture model to use from |
... |
other parameters of mixtCompPredict function. |
Details
This function is based on the generic method "predict". For a more complete output, use mixtCompPredict function.
Value
if type = "partition"
, it returns the estimated partition as a vector. If type = "probabilities"
,
it returns the probabilities to belong to each class (tik) as a matrix.
Author(s)
Quentin Grimonprez
See Also
Examples
data(iris)
model <- list(
Sepal.Length = "Gaussian", Sepal.Width = "Gaussian",
Petal.Length = "Gaussian", Petal.Width = "Gaussian"
)
resLearn <- mixtCompLearn(iris[-c(1, 51, 101), ], model = model, nClass = 1:3, nRun = 1)
# return the partition
predict(resLearn)
# return the tik for the 3 new irises for 2 and 3 classes
predict(resLearn, newdata = iris[c(1, 51, 101), ], type = "probabilities", nClass = 2)
predict(resLearn, newdata = iris[c(1, 51, 101), ], type = "probabilities", nClass = 3)