Python sklearn.metrics.base._average_binary_score() Examples
The following are 8
code examples of sklearn.metrics.base._average_binary_score().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sklearn.metrics.base
, or try the search function
.
Example #1
Source File: test_common.py From twitter-stock-recommendation with MIT License | 6 votes |
def test_averaging_multilabel_all_zeroes(): y_true = np.zeros((20, 3)) y_pred = np.zeros((20, 3)) y_score = np.zeros((20, 3)) y_true_binarize = y_true y_pred_binarize = y_pred for name in METRICS_WITH_AVERAGING: yield (_named_check(check_averaging, name), name, y_true, y_true_binarize, y_pred, y_pred_binarize, y_score) # Test _average_binary_score for weight.sum() == 0 binary_metric = (lambda y_true, y_score, average="macro": _average_binary_score( precision_score, y_true, y_score, average)) _check_averaging(binary_metric, y_true, y_pred, y_true_binarize, y_pred_binarize, is_multilabel=True)
Example #2
Source File: ranking.py From Dispersion-based-Clustering with MIT License | 5 votes |
def average_precision_score(y_true, y_score, average="macro", sample_weight=None): def _binary_average_precision(y_true, y_score, sample_weight=None): precision, recall, thresholds = precision_recall_curve( y_true, y_score, sample_weight=sample_weight) return auc(recall, precision) return _average_binary_score(_binary_average_precision, y_true, y_score, average, sample_weight=sample_weight)
Example #3
Source File: test_common.py From Mastering-Elasticsearch-7.0 with MIT License | 5 votes |
def test_averaging_binary_multilabel_all_zeroes(): y_true = np.zeros((20, 3)) y_pred = np.zeros((20, 3)) y_true_binarize = y_true y_pred_binarize = y_pred # Test _average_binary_score for weight.sum() == 0 binary_metric = (lambda y_true, y_score, average="macro": _average_binary_score( precision_score, y_true, y_score, average)) _check_averaging(binary_metric, y_true, y_pred, y_true_binarize, y_pred_binarize, is_multilabel=True)
Example #4
Source File: ranking.py From One-Example-Person-ReID with MIT License | 5 votes |
def average_precision_score(y_true, y_score, average="macro", sample_weight=None): def _binary_average_precision(y_true, y_score, sample_weight=None): precision, recall, thresholds = precision_recall_curve( y_true, y_score, sample_weight=sample_weight) return auc(recall, precision) return _average_binary_score(_binary_average_precision, y_true, y_score, average, sample_weight=sample_weight)
Example #5
Source File: ranking.py From ECN with Apache License 2.0 | 5 votes |
def average_precision_score(y_true, y_score, average="macro", sample_weight=None): def _binary_average_precision(y_true, y_score, sample_weight=None): precision, recall, thresholds = precision_recall_curve( y_true, y_score, sample_weight=sample_weight) return auc(recall, precision) return _average_binary_score(_binary_average_precision, y_true, y_score, average, sample_weight=sample_weight)
Example #6
Source File: ranking.py From Celeb-reID with MIT License | 5 votes |
def average_precision_score(y_true, y_score, average="macro", sample_weight=None): def _binary_average_precision(y_true, y_score, sample_weight=None): precision, recall, thresholds = precision_recall_curve( y_true, y_score, sample_weight=sample_weight) return auc(recall, precision) return _average_binary_score(_binary_average_precision, y_true, y_score, average, sample_weight=sample_weight)
Example #7
Source File: ranking.py From Exploit-Unknown-Gradually with MIT License | 5 votes |
def average_precision_score(y_true, y_score, average="macro", sample_weight=None): def _binary_average_precision(y_true, y_score, sample_weight=None): precision, recall, thresholds = precision_recall_curve( y_true, y_score, sample_weight=sample_weight) return auc(recall, precision) return _average_binary_score(_binary_average_precision, y_true, y_score, average, sample_weight=sample_weight)
Example #8
Source File: ranking.py From Bottom-up-Clustering-Person-Re-identification with MIT License | 5 votes |
def average_precision_score(y_true, y_score, average="macro", sample_weight=None): def _binary_average_precision(y_true, y_score, sample_weight=None): precision, recall, thresholds = precision_recall_curve( y_true, y_score, sample_weight=sample_weight) return auc(recall, precision) return _average_binary_score(_binary_average_precision, y_true, y_score, average, sample_weight=sample_weight)