How to use "for loop" to compute the accuracy and plot graph
5 ビュー (過去 30 日間)
古いコメントを表示
Hello.
I want to calculate the accuracy of each dimension' X(:,n), n = 1 ~ 1150
The shape of the data is 90x1150. I want to get the accuracy of each dimension
(etc. (90X2), (90x3), (90x10) (90x100),,,,,,,,,,,,,,,,,,,,,,,,,,(90x1150))
and plot the graph of accuracy.
How can I fix this code?
% the shape of data is 90x1150
data = cell2mat(c')';
lable = [1:10 1:10 1:10 1:10 1:10 1:10 1:10 1:10 1:10]';
% I want to compute the accuracy of each X(:,N) using for loop.
% n = size(data,2)
% i = 1:n
% How to fix this code?
CMdl = fitcknn(data,lable,'NSMethod','exhaustive','Distance','cosine');
CMdl.NumNeighbors = 1;
rng(1); % For reproducibility
CVMdl = crossval(CMdl,'KFold',5);
accuracy = 100 - kfoldLoss(CVMdl)*100
% I want to plot the accuracy.
% x-axis: dimension, y-axis : accuracy.
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!