필터 지우기
필터 지우기

How to use "for loop" to compute the accuracy and plot graph

조회 수: 1 (최근 30일)
Kong
Kong 2020년 4월 5일
편집: Kong 2020년 4월 6일
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개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by