Question: I am wanting to set up a data set to use cross validation and want to understand train.kknn better. Does train.kknn produce all of the
I am wanting to set up a data set to use cross validation and want to understand train.kknn better. Does train.kknn produce all of the results for you such that the results of train.kknn do not then need to be plugged back into a test set with kknn? For instance:
model
data = crdf,
kmax = 100,
kcv = 10,
distance = 2,
kernel = "optimal",
scale = TRUE)
print(model)
This code produced results that say:
Type of response variable: continuous
minimal mean absolute error: 0.1850153
Minimal mean squared error: 0.1073792
Best kernel: optimal
Best k: 58
Since kcv was set to 10, my understanding is that automatically creates a cross validation with 10 separate folds. Is that correct? And since kmax is set to 100, it is telling it to cycle through k from one to 100. Is that correct?
After completing this, can the accuracy be tested with the following code?
k = 58
k_result
pred 0.5, 1, 0))
compare
accuracy
accuracy
From this I get .8394 which I interpret to mean that k = 58 is 83.94% accurate. When I change k to 1 or to 100, it does vary the result sufficiently to lead me to this conclusion, but I want to see if that is correct.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
