KNN for regression and use cross-validation for calculating the error
Mostra commenti meno recenti
I want to learn KNN model for regression problem, and then use k-fold cross-validation dataset to calculate the error of my model. Then repeat this procedure with different number for neighbor(numberofneighbor=1,numberofneighbor=2,..) to have error of my model with considering diffrent neighbor. Then calculate error of my test data set with the best number for number of neighbours that is calculated from previous step.
At first I divide my Data set into test and train via this line:
cv = cvpartition(size(Dataset,2),'HoldOut',0.3);
1. Now I want to learn KNN model and then use k-fold cross validation to calculate the error of the model. how should I do that?
2. After the model learnt, how should I find the error of my test dataset?
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Statistics and Machine Learning Toolbox in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!