diff --git a/GPy/util/classification.py b/GPy/util/classification.py index 07e725d1..41701949 100644 --- a/GPy/util/classification.py +++ b/GPy/util/classification.py @@ -2,29 +2,30 @@ import numpy as np def conf_matrix(p,labels,names=['1','0'],threshold=.5,show=True): """ - Returns true and false positives in a binary classification problem - - Column names: true class of the examples - - Row names: classification assigned by the model + Returns error rate and true/false positives in a binary classification problem + - Actual classes are displayed by column. + - Predicted classes are displayed by row. - p: probabilities estimated for observation of belonging to class '1' - labels: observations' class - names: classes' names - threshold: probability value at which the model allocate an element to each class - show: whether the matrix should be shown or not + :param p: array of class '1' probabilities. + :param labels: array of actual classes. + :param names: list of class names, defaults to ['1','0']. + :param threshold: probability value used to decide the class. + :param show: whether the matrix should be shown or not + :type show: False|True """ - p = p.flatten() - labels = labels.flatten() - N = p.size - C = np.ones(N) - C[p