Calculates number of TP, FP, TN, FN

def calc_confusion_matrix(self, printout = False):
        """
        Calculates number of TP, FP, TN, FN
        """
        if self.labels is None:
            raise DataError("Cannot calculate confusion matrix before data "
                            "has been read.")

        if self.preds is None:
            raise DataError("Predictions not available. Please run "
                            "`scores_to_preds` before calculating confusion "
                            "matrix")

        self.TP = np.sum(np.logical_and(self.preds == 1, self.labels == 1))
        self.TN = np.sum(np.logical_and(self.preds == 0, self.labels == 0))
        self.FP = np.sum(np.logical_and(self.preds == 1, self.labels == 0))
        self.FN = np.sum(np.logical_and(self.preds == 0, self.labels == 1))

        if printout:
            print("Contingency matrix is:")
            print("----------------------")
            print("TP: {} \t FN: {}".format(self.TP,self.FN))
            print("FP: {} \t TN: {}".format(self.FP,self.TN))
            print("\n")