我已经使用R中的Mclust执行了潜在的类聚类分析。现在,我想使用结果来预测不在我过去训练的数据集中的人的聚类成员。我知道预测函数,但这不是我要找的。每天都会有新的人需要我预测,所以为了做到这一点,我需要有参数来预测集群成员。
有没有人知道如何获得正确的参数,以便我可以在方程中使用这些参数来预测集群成员资格?
data(faithful)
library(mclust)
faithfulMclust <- Mclust(faithful)
clust <- predict.Mclust(faithfulMclust,faithful) Mclust在预测函数中使用了一个公式,我想要获得这个公式,以便预测数据集中不存在的案例(我每天都会收到新的案例,所以不能使用预测函数)。
发布于 2014-07-02 04:17:08
我不明白你为什么说预测在这里行不通。假设您按照上述方式拟合模型并获得faithfulMclust对象。让我们用以下命令打印结果:
plot(faithfulMclust, what="classification")
clustmeans<-faithfulMclust$parameters$mean
text(clustmeans[1,], clustmeans[2,], seq.int(ncol(clustmeans)), cex=4)

如果第二天你经历了两次等待50的爆发,以及如何使用现有模型对该值进行分类,你可以使用
pp <- predict(faithfulMclust, newdata=data.frame(eruptions=2, waiting=50))
pp$classification
# [1] 2或者可能有4个错误,等待70
pp <- predict(faithfulMclust, newdata=data.frame(eruptions=4, waiting=70))
pp$classification
# [1] 3考虑到我们的输入数据和模型,这些分配似乎是合理的。
https://stackoverflow.com/questions/24407587
复制相似问题