(self, y_true, y_pred, performance_metric='accuracy_score', **kwargs)
Evaluate the model performance.

        Parameters
        ----------
        y_true : array, shape = [n_samples] or [n_samples, n_classes]
            The true labels correspond to the y_pred.

        y_pred : array, shape = [n_samples] or [n_samples, n_classes]
            The predict result of the model. Note that, different metrics
            need different types of predict.

        performance_metric: str, optional (default='accuracy_score')
            The name of the performance metric function.
            Should be one of ['accuracy_score', 'roc_auc_score', 'get_fps_tps_thresholds', 'hamming_loss', 'f1_score',
            'one_error', 'coverage_error', 'label_ranking_loss', 'label_ranking_average_precision_score'].
Evaluate the model performance.
Evaluate the model performance .
def calc_performance_metric(self, y_true, y_pred, performance_metric='accuracy_score', **kwargs):
        """Evaluate the model performance.

        Parameters
        ----------
        y_true : array, shape = [n_samples] or [n_samples, n_classes]
            The true labels correspond to the y_pred.

        y_pred : array, shape = [n_samples] or [n_samples, n_classes]
            The predict result of the model. Note that, different metrics
            need different types of predict.

        performance_metric: str, optional (default='accuracy_score')
            The name of the performance metric function.
            Should be one of ['accuracy_score', 'roc_auc_score', 'get_fps_tps_thresholds', 'hamming_loss', 'f1_score',
            'one_error', 'coverage_error', 'label_ranking_loss', 'label_ranking_average_precision_score'].

        """
        valid_metric = ['accuracy_score', 'roc_auc_score', 'get_fps_tps_thresholds', 'hamming_loss', 'one_error',
                        'coverage_error', 'f1_score', 'label_ranking_loss', 'label_ranking_average_precision_score']
        if performance_metric not in valid_metric:
            raise NotImplementedError('Performance {} is not implemented.'.format(str(performance_metric)))

        performance_metric = getattr(performance, performance_metric)
        metric_para = inspect.signature(performance_metric)
        if 'y_pred' in metric_para.parameters:
            return performance_metric(y_pred=y_pred, y_true=y_true, **kwargs)
        else:
            y_pred = y_pred[:, 0]
            return performance_metric(y_score=y_pred, y_true=y_true, **kwargs)
def calc_performance_metric ( self , y_true , y_pred , performance_metric = 'accuracy_score' , * * kwargs ) : valid_metric = [ 'accuracy_score' , 'roc_auc_score' , 'get_fps_tps_thresholds' , 'hamming_loss' , 'one_error' , 'coverage_error' , 'f1_score' , 'label_ranking_loss' , 'label_ranking_average_precision_score' ] if performance_metric not in valid_metric : raise NotImplementedError ( 'Performance {} is not implemented.' . format ( str ( performance_metric ) ) ) performance_metric = getattr ( performance , performance_metric ) metric_para = inspect . signature ( performance_metric ) if 'y_pred' in metric_para . parameters : return performance_metric ( y_pred = y_pred , y_true = y_true , * * kwargs ) else : y_pred = y_pred [ : , 0 ] return performance_metric ( y_score = y_pred , y_true = y_true , * * kwargs )