perfByField
Performance of classification based on values in an input field
Contents
Syntax
- rr=perfByField(dsTrain, dsTest, opt, showPlot)
Description
rr=perfByField(dsTrain, dsTest, opt) returns the performance of a given pair of training and test sets based on uniques values in a give field. Note that the values of the given field must be a categorical variable.
Example
ds=prData('iris'); separateFieldName='sepal width'; id=find(strcmp(ds.inputName, separateFieldName)); m=median(ds.input(id,:)); % Make the first input categorial index=find(ds.input(id,:)>m); ds.input(id,:)=0; ds.input(id,index)=1; cvOpt=cvDataGen('defaultOpt'); % Create training & test sets cvOpt.foldNum=2; cvOpt.cvDataType='full'; cvData=cvDataGen(ds, cvOpt); dsTrain=cvData.TS; dsTest=cvData.VS; opt=perfByField('defaultOpt'); opt.fieldName=separateFieldName; rr=perfByField(dsTrain, dsTest, opt, 1);
1/2: sepal width=0, training rr=93.0233%, test rr=97.5% 2/2: sepal width=1, training rr=100%, test rr=85.7143%