View source: R/MIXTCOMP_mixtCompLearn.R
predict.MixtComp | R Documentation |
Predict the cluster of new samples.
## S3 method for class 'MixtComp'
predict(
object,
newdata = NULL,
type = c("partition", "probabilities"),
nClass = NULL,
...
)
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. |
This function is based on the generic method "predict". For a more complete output, use mixtCompPredict function.
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.
Quentin Grimonprez
mixtCompPredict
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.