Hi, I am trying to use mclust to cluster some data (train_pca_10), I get the clusters, but when I try to use the model to predict new data (test1) I get this error mClust2 <- Mclust(train_pca_10,G=2) pred<-predict.Mclust(mClust2,test1) Error in if (warn) warning(WARNING) : argument is of length zero Can anyone see the problem here? Thanks, Pereira. [[alternative HTML version deleted]]
Hi, It's unlikely that anyone will be able to see your problem without a reproducible example. http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example Are you using the mclust package? That would be the first thing we need to know. Then, have you worked through the examples in ?predict.Mclust, and do you understand them? Then, what do your data look like? str() and such are useful, but the best option is to use dput() to create a reproducible subset, or to reproduce your problem using one of the built-in datasets in R, as is done in the above documentation examples. Sarah On Tue, Dec 10, 2013 at 6:41 AM, Welma Pereira <welma.pereira at gmail.com> wrote:> Hi, > > I am trying to use mclust to cluster some data (train_pca_10), I get the > clusters, but when I try to use the model to predict new data (test1) I get > this error > > > > mClust2 <- Mclust(train_pca_10,G=2) > pred<-predict.Mclust(mClust2,test1) > > Error in if (warn) warning(WARNING) : argument is of length zero > > Can anyone see the problem here? > > Thanks, > Pereira. >-- Sarah Goslee http://www.functionaldiversity.org
Btw I am using mclust, and basically wanted to reproduce the mstep and estep of the Mclust algorithm for new data. Any help is appreaciated! On 10 December 2013 21:23, Welma Pereira <welma.pereira@gmail.com> wrote:> Hi, > > Thanks for the hint Sarah. So here is my problem again: (files train_pca > is in train_pca and test is in test_pca attached) > > mclust2_pca <- Mclust(train_pca,G=2, modelNames= c("EII", "VII", "EEI", > "EVI", "VEI", "VVI")) > pred<-predict.Mclust(mclust2_pca,test) > Warning message: > In cdensVVI(data = c(2.80217508052409, 2.75071740560707, 2.6175058179515, > : > cannot compute E-step > > Thanks! > > > On 10 December 2013 16:30, Sarah Goslee <sarah.goslee@gmail.com> wrote: > >> Hi, >> >> It's unlikely that anyone will be able to see your problem without a >> reproducible example. >> >> >> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example >> >> Are you using the mclust package? That would be the first thing we need >> to know. >> >> Then, have you worked through the examples in ?predict.Mclust, and do >> you understand them? >> >> Then, what do your data look like? str() and such are useful, but the >> best option is to use dput() to create a reproducible subset, or to >> reproduce your problem using one of the built-in datasets in R, as is >> done in the above documentation examples. >> >> Sarah >> >> On Tue, Dec 10, 2013 at 6:41 AM, Welma Pereira <welma.pereira@gmail.com> >> wrote: >> > Hi, >> > >> > I am trying to use mclust to cluster some data (train_pca_10), I get the >> > clusters, but when I try to use the model to predict new data (test1) I >> get >> > this error >> > >> > >> > >> > mClust2 <- Mclust(train_pca_10,G=2) >> > pred<-predict.Mclust(mClust2,test1) >> > >> > Error in if (warn) warning(WARNING) : argument is of length zero >> > >> > Can anyone see the problem here? >> > >> > Thanks, >> > Pereira. >> > >> -- >> Sarah Goslee >> http://www.functionaldiversity.org >> > >[[alternative HTML version deleted]]
Many people do not want to download and open random attachments. That's why I suggested dput() with part of your data. dput(head(yourdata, 20)) is enough for many problems, though it's good to try it out. Or use one of the datasets built into R. Sarah On Tue, Dec 10, 2013 at 3:23 PM, Welma Pereira <welma.pereira at gmail.com> wrote:> Hi, > > Thanks for the hint Sarah. So here is my problem again: (files train_pca is > in train_pca and test is in test_pca attached) > > mclust2_pca <- Mclust(train_pca,G=2, modelNames= c("EII", "VII", "EEI", > "EVI", "VEI", "VVI")) > pred<-predict.Mclust(mclust2_pca,test) > Warning message: > In cdensVVI(data = c(2.80217508052409, 2.75071740560707, 2.6175058179515, : > cannot compute E-step > > Thanks! > > > On 10 December 2013 16:30, Sarah Goslee <sarah.goslee at gmail.com> wrote: >> >> Hi, >> >> It's unlikely that anyone will be able to see your problem without a >> reproducible example. >> >> >> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example >> >> Are you using the mclust package? That would be the first thing we need to >> know. >> >> Then, have you worked through the examples in ?predict.Mclust, and do >> you understand them? >> >> Then, what do your data look like? str() and such are useful, but the >> best option is to use dput() to create a reproducible subset, or to >> reproduce your problem using one of the built-in datasets in R, as is >> done in the above documentation examples. >> >> Sarah >> >> On Tue, Dec 10, 2013 at 6:41 AM, Welma Pereira <welma.pereira at gmail.com> >> wrote: >> > Hi, >> > >> > I am trying to use mclust to cluster some data (train_pca_10), I get the >> > clusters, but when I try to use the model to predict new data (test1) I >> > get >> > this error >> > >> > >> > >> > mClust2 <- Mclust(train_pca_10,G=2) >> > pred<-predict.Mclust(mClust2,test1) >> > >> > Error in if (warn) warning(WARNING) : argument is of length zero >> > >> > Can anyone see the problem here? >> > >> > Thanks, >> > Pereira. >> >