[R] Error with KNN
Uwe Ligges
ligges at statistik.tu-dortmund.de
Mon Feb 22 17:19:48 CET 2010
On 20.02.2010 19:10, Nancy Adam wrote:
>
>
>
> Hi all
>
> I receive this error message: “Error in mymodel$MSE : $ operator is invalid for atomic vectors”
> When I use KNN.
> This is the code:
>
> library(e1071)
> train<- rbind(iris3[,,1], iris3[,,2], iris3[,,3])
> cl<- factor(c(rep("s",50), rep("c",50), rep("v",50)))
> knn.cv(train, cl, k = 3, prob = TRUE)
> sqrt(mymodel$MSE)
> #error message : “Error in mymodel$MSE : $ operator is invalid for atomic vectors”
>
There is no component MSE in mymodel. Hence you cannot extract it.
Uwe Ligges
> thanks,
> Nancy
>
> _________________________________________________________________
> Hotmail: Trusted email with powerful SPAM protection.
>
> [[alternative HTML version deleted]]
>
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list