フィルターのクリア

Error during classification using SVM

1 回表示 (過去 30 日間)
Balaji M. Sontakke
Balaji M. Sontakke 2020 年 2 月 20 日
Error using svmtrain (line 234)
Y must be a vector or a character array.
Error in inv_Moment_maintotaldemo (line 86)
model=svmtrain(train_label,P_train);
clear all;
clc;
%% BUILD DORSAL HAND VEIN TEMPLATE DATABASE
tic; %% calculating elapsed time for execution
%% load mat files
load('db3.mat');
load('db4.mat');
%% reshape into row vector
reduced_testdata = reshape(reduced_testdata,1,4,10); % one row,four column and 15(60/4) group for 20 classes
reduced_traindata = reshape(reduced_traindata,1,4,20); % one row,four column and 45(180/4) group for 20 classes
%% adjust dimension
% Adjust matrix dimension
P_test = cell2mat(reduced_testdata); % Convert cell array to matrix
P_train = cell2mat(reduced_traindata);
%% rearranges the dimensions of P_test and P_train
C = permute(P_test,[1 3 2]);
P_test = reshape(C,[],size(P_test,2),1);
C = permute(P_train,[1 3 2]);
P_train = reshape(C,[],size(P_train,2),1);
%% labeling class
train_label=load('train_label.txt');
test_label=load('test_label.txt');
% %%% Normalisation
%
% P_train=P_train/256;
% P_test=P_test/256;
%% Normalisation by min max
P_train=mapminmax(P_train,0,1);
P_test=mapminmax(P_test,0,1);
%% Normalisation by Z - Scores
% P_train = zscore(P_train,0,2);
% P_test =zscore(P_test,0,2);
%% %%PCA low dimension reduction
P_train = P_train';
model = perform_pca(P_train,rank(P_train)-1);
test_features= linear_subspace_projection(P_test, model, 1);
P_train=model.train';
P_test=test_features';
%% SVM classifier
model=svmtrain(train_label,P_train);
[predicted_label, accuracy, decision_values]=predict(test_label,P_test,model);
[FPR, TPR,Thr, AUC, OPTROCPT] = perfcurve(predictlabel, test_label,3);
figure,
plot(TPR,FPR,'r-','LineWidth',1);
xlabel('False positive rate')
ylabel('True positive rate')
title('ROC Curve for Classification ')
Tbl = table(FPR, TPR,Thr)
fprintf('\n\n Overall accuracy:%f%%\n',cp.CorrectRate*100);
%% calculating elapsed time for execution
toc

回答 (0 件)

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by