On 23.02.2010 05:34, Nancy Adam wrote:
Hi Uwe,
Thank you for your email.
I need to compute one value indicating to the performance of knn but I don’t
know anything other than MSE. Can you please tell me how I do that?
Hi Nancy,
since knn is a classification method, I think MSE is a rather untypical
measure. It is more usual to use a misclassification rate based on cross
validation, bootstrap - or at least a test data set.
See packages "caret" and "ipred" for functions that make it easy to
calculate a cross validated misclassification error for knn on your
data, for example.
Best wishes,
Uwe
Many thanks,
Nancy
Date: Mon, 22 Feb 2010 17:19:48 +0100
From: lig...@statistik.tu-dortmund.de
To: nancyada...@hotmail.com
CC: r-help@r-project.org
Subject: Re: [R] Error with KNN
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@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.
_________________________________________________________________
Hotmail: Free, trusted and rich email service.
https://signup.live.com/signup.aspx?id=60969
______________________________________________
R-help@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.