def show_results(self,gold,test):
     from nltk import ConfusionMatrix
     correct = 0
     for index,result in enumerate(gold):
         if result == test[index]:
             correct +=1
     print 'Accuracy: {:.2%}'.format(float(correct) / float(len(gold)))
     cm = ConfusionMatrix(gold, test)
     print cm.pp()
def confusion_matrix(gold,guess):
	correct = 0
	total = len(gold)
	for i in range(len(gold)):
		if guess[i] == gold[i]:
			correct += 1
	accuracy = float(correct) / float(total)
	print('Accuracy: {:.2%}'.format(accuracy))

	# Confusion Matrix
	cm = ConfusionMatrix(gold, guess)
	print (cm.pp())
Beispiel #3
0
def confusion_matrix(gold, guess):
    correct = 0
    total = len(gold)
    for i in range(len(gold)):
        if guess[i] == gold[i]:
            correct += 1
    accuracy = float(correct) / float(total)
    print('Accuracy: {:.2%}'.format(accuracy))

    # Confusion Matrix
    cm = ConfusionMatrix(gold, guess)
    print(cm.pp())