(self, data)
return labels, pred_results
extract labels and predict results from data in classification/regression type format
extract labels and predict results from data in classification/regression type format
extract labels and predict results from data in classification / regression type format
def _classification_and_regression_extract(self, data):

        """
        extract labels and predict results from data in classification/regression type format
        """

        labels = []
        pred_scores = []
        pred_labels = []
        for d in data:
            labels.append(d[1][0])
            pred_labels.append(d[1][1])
            pred_scores.append(d[1][2])
        if self.eval_type == consts.BINARY or self.eval_type == consts.REGRESSION:
            if self.pos_label and self.eval_type == consts.BINARY:
                labels_arr = np.array(labels)
                labels_arr[labels_arr == self.pos_label] = 1
                labels_arr[labels_arr != self.pos_label] = 0
                labels = list(labels_arr)
            pred_results = pred_scores
        else:
            pred_results = pred_labels

        return labels, pred_results
def _classification_and_regression_extract ( self , data ) : labels = [ ] pred_scores = [ ] pred_labels = [ ] for d in data : labels . append ( d [ 1 ] [ 0 ] ) pred_labels . append ( d [ 1 ] [ 1 ] ) pred_scores . append ( d [ 1 ] [ 2 ] ) if self . eval_type == consts . BINARY or self . eval_type == consts . REGRESSION : if self . pos_label and self . eval_type == consts . BINARY : labels_arr = np . array ( labels ) labels_arr [ labels_arr == self . pos_label ] = 1 labels_arr [ labels_arr != self . pos_label ] = 0 labels = list ( labels_arr ) pred_results = pred_scores else : pred_results = pred_labels return labels , pred_results