java - K Nearest Neighbor Cross Validation Output -



java - K Nearest Neighbor Cross Validation Output -

my goal create graph (histogram) of chosen k-nearest neighbour (classification technique) ks chosen through leave 1 out cross validation (i have 46 rows of info there should 46 different k's chosen, many of same, may different.)

i see 2 possibilities. first, rweka's (package lets interface java-based weka info mining tool) ibk. questions (read more info): 1) think it's possible "black box" of r-java interface pull out info want using rweka's ibk function? 2) r's knn function output mean? 3) place sink function in leave 1 out approximation script capture results of each run through?

here's i've been trying:

t1 <- ibk(class~., data=mydata, control=weka_control(k=10, x=true)) t1

the x=true has algorithm run using leave 1 out cross validation , output best classifier (k):

ib1 instance-based classifier using 5 nearest neighbour(s) classification

according documentation far can tell, x = true way algorithm run cross validation. however, results in sort of black box , i'm unable see intermediate values i'm after. however, if could, having difficulty getting out meaningful info in non-copy , paste fashion output java object converting above output string (tostring) , pulling number out doesn't work. without more java knowledge (or @ all) sense loosing battle unless 1 of familiar java , have idea.

my next selection knn (in class library), trying manually utilize leave 1 out cross validation using following:

x=1 y=2 while (y<11) { while (x<47) { train <- mydata[1:46 !=x,] test <- mydata[x,] t1 <- knn(train, test, train$class, k=y, use.all=true) x=x+1 } y=y+1}

i sink each readout single file later (not sure place sink, suggestions on appreciated). however, i'm not sure create of out of knn function (factor classifications of test set). 3 classes, readout of 0, 1, , 2s. how turn info graph i'm imagining?

thank in advance!

java r weka knn

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -