load dsSmall.mat [cPrm, logLike1, rr1]=nbcTrain(ds); [computedClass, logLike2, rr2, hitIndex]=nbcEval(dsTest, cPrm); logLike=diff(logLike2); id01=find(dsTest.output==1); id02=find(dsTest.output==2); data01=logLike(id01); data02=logLike(id02); opt=detPlot('defaultOpt'); opt.scaleMode='linear'; detPlot(data01, data02, opt); opt=detGet('defaultOpt'); figure; [th, fp, fn]=detGet(data01, data02, opt, 1); %plot(dsTest.output, logLike, 'o'); %% figure; costPair=[1 1]; fnCosts=1:6; for i=1:length(fnCosts) costPair(2)=fnCosts(i); [costMin(i), thBest(i), costVec, thVec, misclassifiedCount{i}]=cost4binClass(dsTest.output, logLike, costPair, 1); hold on end hold off %% figure; plot(fnCosts, thBest, 'o-'); for i=1:length(fnCosts) h=text(fnCosts(i), thBest(i), sprintf(' %s', mat2str(misclassifiedCount{i}))); set(h, 'rotation', 30); end xlabel('FN costs'); ylabel('Thresholds'); title('Best thresholds vs. FN costs'); %% Lift chart figure; gt=dsTest.output; binCount=10; showPlot=1; [binPercent, binSize]=liftChart(logLike, gt, binCount, showPlot);