[R] outputs of KNN prediction

Qin Liu q.liu at unn.ac.uk
Mon Feb 23 13:49:19 CET 2004

Hello there:

I got 13 variables in my training/target set, the first 12 variables are
mixture of numerical and categorical variables. The last one is the one I
to predict, and it is a numerical variable.

>pred<-knn(train, test, clk=3, prob=TRUE)
I got output on the screen as following

 8.10832229  8.831127635 7.592870288 8.521782644 6.376726948 6.914730893
 9.71534911  8.658171785 6.104793232 7.247080585 6.298949247 5.105945474
 7.508238775 7.65396918  8.831127635 7.912056888 6.381816017 7.211556733

 276 levels ............

Then I tried to calculate a formula:(actual-pred)/actual, which includes
values. However, I cannot do this even I convert the factors in pred to
vectors. Can anybody help??

Thank you very much indeed,


More information about the R-help mailing list