how to solve this error "Undefined function 'crossvalind' for input arguments of type 'char'" while running below code in matlab 2019a
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
%% Evaluate Accuracy
load('Accuracy_Data.mat')
Accuracy_Percent= zeros(200,1);
for i = 1:500
data = Train_Feat;
%groups = ismember(Train_Label,1);
groups = ismember(Train_Label,0);
[train,test] = crossvalind('HoldOut',groups);
cp = classperf(groups);
%svmStruct =svmtrain(data(train,:),groups(train),'showplot',false,'kernel_function','linear');
svmStruct = fitcsvm(data(train,:),groups(train),'showplot',false,'kernel_function','linear');
%classes = svmclassify(svmStruct,data(test,:),'showplot',false);
classes = predict(svmStruct,data(test,:),'showplot',false);
classperf(cp,classes,test);
Accuracy = cp.CorrectRate;
Accuracy_Percent(i) = Accuracy.*100;
end
Max_Accuracy = max(Accuracy_Percent);
sprintf('Accuracy of Linear Kernel with 500 iterations is: %g%%',Max_Accuracy)
1 Kommentar
Walter Roberson
am 17 Sep. 2021
crossvalind() requires the Bioinformatics Toolbox. Do you have that installed and licensed?
Antworten (1)
Gagan Baishya
am 17 Sep. 2021
Hello,
cvIndices = crossvalind(cvMethod,N,M)
returns the indices cvIndices after applying cvMethod on N observations using M as the selection parameter.
In your code, the third parameter is missing which is probably causing the issue. Try specifying the selection parameter (M) to avoid the error.
For better understanding, please go through the documentation link below: https://in.mathworks.com/help/bioinfo/ref/crossvalind.html#:~:text=evaluation%20each%20time.-,%27HoldOut%27,-M%20is%20the
0 Kommentare
Siehe auch
Kategorien
Mehr zu Genomics and Next Generation Sequencing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!