mardi 6 juin 2017

test and training classification rates ( CRs)

to the best of my knowledge Test CR: the classification rate achieved on the test data.once we have trained our data with an algorithm ( svm, decision tree…) we could test it and get the test CR. so what is a so called training CR?

here is my code ( am using an lssvm):

clear all
clc;

%read file   
 Xtrain = xlsread('data_90_10\diab_train.xlsx','A:H');   % Training dataset 
 (692 samples)
  Xtest = xlsread('data_90_10\test_diab_set.xlsx','A:H');  % TESTing dataset 
  (76 samples)
 h = xlsread('data_90_10\train_diab_set_vraiclass.xlsx','A1:A692');  % les 
 classes FOR TRAINING DATA
 Yt = xlsread('data_90_10\test_diab_set_vraiclass.xlsx','A1:A76');  % les 
 vraies classes FOR Test DATA

 %param
 type = 'classification';
 %gam = 10;
 %sig2 = 0.4;
  %k = 10;

[gam,sig2] = tunelssvm({Xtrain,h,type,[],[],'RBF_kernel'}, 'gridsearch',...
'crossvalidatelssvm',{10,'misclass'});
%[cost, costs] = crossvalidate({Xtrain,h,type,gam,sig2,'lin_kernel'}, k, 
'misclass', 'mean');

%model
[alpha,b] = trainlssvm({Xtrain,h,type,gam,sig2,'RBF_kernel'});
Ytest = simlssvm({Xtrain,h,type,gam,sig2,'RBF_kernel'},{alpha,b},Xtest); % 
predict test data
figure; plotlssvm({Xtrain,h,type,gam,sig2,'RBF_kernel'},{alpha,b});

%CountingMatrix
 cp = classperf(Ytest, Yt);
 cp.CorrectRate
 cp.CountingMatrix

once I type cp.CorrectRate I get the test classification rate how to get the training classification rate and what does it mean?

Aucun commentaire:

Enregistrer un commentaire