def conf_matrix(p,labels,names=['<STR_LIT:1>','<STR_LIT:0>'],threshold=<NUM_LIT>,show=True):
assert p.size == labels.size, "<STR_LIT>"<EOL>decision = np.ones((labels.size,<NUM_LIT:1>))<EOL>decision[p<threshold] = <NUM_LIT:0><EOL>diff = decision - labels<EOL>false_0 = diff[diff == -<NUM_LIT:1>].size<EOL>false_1 = diff[diff == <NUM_LIT:1>].size<EOL>true_1 = np.sum(decision[diff ==<NUM_LIT:0>])<EOL>true_0 = labels.size - true_1 - false_0 - false_1<EOL>error = (false_1 + false_0)/np.float(labels.size)<EOL>if show:<EOL><INDENT>print(<NUM_LIT> - error * <NUM_LIT:100>,'<STR_LIT>')<EOL>print('<STR_LIT>' % ('<STR_LIT>',names[<NUM_LIT:0>],names[<NUM_LIT:1>]))<EOL>print('<STR_LIT>')<EOL>print('<STR_LIT>' % (names[<NUM_LIT:0>],true_1,false_0))<EOL>print('<STR_LIT>' % (names[<NUM_LIT:1>],false_1,true_0))<EOL><DEDENT>return error,true_1, false_1, true_0, false_0<EOL>
Returns error rate and true/false positives in a binary classification problem
- Actual classes are displayed by column.
- Predicted classes are displayed by row.

: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