def evaluation_rocevaluation_modular(ground_truth, predicted):
	from shogun.Features import Labels
	from shogun.Evaluation import ROCEvaluation

	ground_truth_labels = Labels(ground_truth)
	predicted_labels = Labels(predicted)
	
	evaluator = ROCEvaluation()
	evaluator.evaluate(predicted_labels,ground_truth_labels)

	return evaluator.get_ROC(), evaluator.get_auROC()
def evaluation_rocevaluation_modular(ground_truth, predicted):
	from shogun.Features import Labels
	from shogun.Evaluation import ROCEvaluation

	ground_truth_labels = Labels(ground_truth)
	predicted_labels = Labels(predicted)
	
	evaluator = ROCEvaluation()
	evaluator.evaluate(predicted_labels,ground_truth_labels)

	return evaluator.get_ROC(), evaluator.get_auROC()
示例#3
0
plot(pos[0, :], pos[1, :], "r.")
plot(neg[0, :], neg[1, :], "b.")
grid(True)
title('Data', size=10)

# plot ROC for SVM
subplot(223)
ROC_evaluation = ROCEvaluation()
ROC_evaluation.evaluate(svm.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('LibSVM (Gaussian kernel, C=%.3f) ROC curve' % svm.get_C1(), size=10)

# plot ROC for LDA
subplot(224)
ROC_evaluation.evaluate(lda.apply(), labels)
roc = ROC_evaluation.get_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)
示例#4
0
文件: roc.py 项目: nickponline/mkl
## plot points
subplot(211)
plot(pos[0,:], pos[1,:], "r.")
plot(neg[0,:], neg[1,:], "b.")
grid(True)
title('Data',size=10)

# plot ROC for SVM
subplot(223)
ROC_evaluation=ROCEvaluation()
ROC_evaluation.evaluate(svm.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('LibSVM (Gaussian kernel, C=%.3f) ROC curve' % svm.get_C1(),size=10)

# plot ROC for LDA
subplot(224)
ROC_evaluation.evaluate(lda.apply(),labels)
roc = ROC_evaluation.get_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')
示例#5
0
B =  BinaryLabels(classifier.apply(feats_test).get_labels())

#print evaluation_contingencytableevaluation_modular((trainlab), (classifier.apply(feats_train).get_labels()))
#print evaluation_rocevaluation_modular((trainlab), (classifier.apply(feats_train).get_labels()))
# Run the SVM
subplot(111)
ROC_evaluation=ROCEvaluation()
ROC_evaluation.evaluate(A, B)
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('ROC (Width=%.3f, C1=%.3f, C2=%.3f) ROC curve = %.3f' % (kernel.get_width(), classifier.get_C1(), classifier.get_C2(), ROC_evaluation.get_auROC()),size=10)
savefig("unamed.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' % (kernel.get_width(), classifier.get_C1(), classifier.get_C2(), ROC_evaluation.get_auROC()),size=10)


subplot(223)
示例#6
0
文件: roc.py 项目: frx/shogun
## plot points
subplot(211)
plot(pos[0,:], pos[1,:], "r.")
plot(neg[0,:], neg[1,:], "b.")
grid(True)
title('Data',size=10)

# plot ROC for SVM
subplot(223)
ROC_evaluation=ROCEvaluation()
ROC_evaluation.evaluate(svm.classify(),labels)
roc = ROC_evaluation.get_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('LibSVM (Gaussian kernel, C=%.3f) ROC curve' % svm.get_C1(),size=10)

# plot ROC for LDA
subplot(224)
ROC_evaluation.evaluate(lda.classify(),labels)
roc = ROC_evaluation.get_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')