def test_accuracy_from_confusion_matrix():
    ' test accuracy computations from confusion matrix '
    y_truth = [0, 1, 2, 0, 1, 2]
    y_score = [[0.7, 0.2, 0.1], [0.1, 0.7, 0.2], [0.2, 0.1, 0.7], [0.1, 0.8, 0.1], [0.1, 0.8, 0.1], [0.8, 0.1, 0.1]]
    y_pred = [0, 1, 2, 1, 1, 0]
    computed_confusion_matrix = confusion_matrix(y_truth, y_pred)
    accuracy = accuracy_from_confusion_matrix(y_truth, y_score, computed_confusion_matrix)
    nose.tools.assert_almost_equal(0.6666667, accuracy, delta=1e-06)
test accuracy computations from confusion matrix
def test_accuracy_from_confusion_matrix():
    '  '
    y_truth = [0, 1, 2, 0, 1, 2]
    y_score = [[0.7, 0.2, 0.1], [0.1, 0.7, 0.2], [0.2, 0.1, 0.7], [0.1, 0.8, 0.1], [0.1, 0.8, 0.1], [0.8, 0.1, 0.1]]
    y_pred = [0, 1, 2, 1, 1, 0]
    computed_confusion_matrix = confusion_matrix(y_truth, y_pred)
    accuracy = accuracy_from_confusion_matrix(y_truth, y_score, computed_confusion_matrix)
    nose.tools.assert_almost_equal(0.6666667, accuracy, delta=1e-06)