classifier.train() w=kernel.get_subkernel_weights() kernel.set_subkernel_weights(w) # Plot ROC curve subplot(111) ROC_evaluation=ROCEvaluation() ROC_evaluation.evaluate(classifier.apply(feats_train),Labels(trainlab)) roc = ROC_evaluation.get_ROC() plot(roc[0], roc[1]) fill_between(roc[0],roc[1],0,alpha=0.1) grid(True) xlabel('FPR') ylabel('TPR') title('Train ROC (Width=%.3f, C1=%.3f, C2=%.3f) ROC curve = %.3f' % (10, classifier.get_C1(), classifier.get_C2(), ROC_evaluation.get_auROC()),size=10) savefig("data/iri/mkl.png") """ subplot(222) ROC_evaluation=ROCEvaluation() ROC_evaluation.evaluate(classifier.apply(feats_test),Labels(testlab)) roc = ROC_evaluation.get_ROC() plot(roc[0], roc[1]) fill_between(roc[0],roc[1],0,alpha=0.1) grid(True) xlabel('FPR') ylabel('TPR') title('Test ROC (Width=%.3f, C1=%.3f, C2=%.3f) ROC curve = %.3f' % (0, classifier.get_C1(), classifier.get_C2(), ROC_evaluation.get_auROC()),size=10)
print sign(out) print testlab # Plot ROC curve figure() ROC_evaluation=ROCEvaluation() ROC_evaluation.evaluate(mkl.apply(),labels) roc = ROC_evaluation.get_ROC() print roc plot(roc[0], roc[1]) fill_between(roc[0],roc[1],0,alpha=0.1) text(mean(roc[0])/2,mean(roc[1])/2,'auROC = %.5f' % ROC_evaluation.get_auROC()) grid(True) xlabel('FPR') ylabel('TPR') title('MKL PolyNomial Kernel (C=%.3f) ROC curve' % mkl.get_C1(),size=10) figure() plot(pos[0, :], pos[1, :], "g.") plot(neg[0, :], neg[1, :], "r.") grid(True) title('Data',size=10) x, y, z = compute_output_plot_isolines(mkl, kernel, feats_train) pcolor(x, y, z, shading='interp') contour(x, y, z, linewidths=1, colors='black', hold=True) axis('tight') show() show()