precision-recall

Good ROC curve but poor precision-recall curve

痞子三分冷 提交于 2019-12-30 00:40:13
问题 I have some machine learning results that I don't quite understand. I am using python sciki-learn, with 2+ million data of about 14 features. The classification of 'ab' looks pretty bad on the precision-recall curve, but the ROC for Ab looks just as good as most other groups' classification. What can explain that? 回答1: Class imbalance. Unlike the ROC curve, PR curves are very sensitive to imbalance. If you optimize your classifier for good AUC on an unbalanced data you are likely to obtain

How to plot precision and recall of multiclass classifier?

六月ゝ 毕业季﹏ 提交于 2019-12-24 01:11:04
问题 I'm using scikit learn, and I want to plot the precision and recall curves. the classifier I'm using is RandomForestClassifier . All the resources in the documentations of scikit learn uses binary classification. Also, can I plot a ROC curve for multiclass? Also, I only found for SVM for multilabel and it has a decision_function which RandomForest doesn't have 回答1: From scikit-learn documentation: Precision-Recall: Precision-recall curves are typically used in binary classification to study

Computing F-measure for clustering

99封情书 提交于 2019-12-21 05:41:15
问题 Can anyone help me to calculate F-measure collectively ? I know how to calculate recall and precision, but don't know for a given algorithm how to calculate one F-measure value. As an exemple, suppose my algorithm creates m clusters, but I know there are n clusters for the same data (as created by another benchmark algorithm). I found one pdf but it is not useful since the collective value I got is greater than 1. Reference of pdf is F Measure explained. Specifically I have read some research

Precision/recall for multiclass-multilabel classification

社会主义新天地 提交于 2019-12-18 10:41:19
问题 I'm wondering how to calculate precision and recall measures for multiclass multilabel classification, i.e. classification where there are more than two labels, and where each instance can have multiple labels? 回答1: For multi-label classification you have two ways to go First consider the following. is the number of examples. is the ground truth label assignment of the example.. is the example. is the predicted labels for the example. Example based The metrics are computed in a per datapoint

How to interpret almost perfect accuracy and AUC-ROC but zero f1-score, precision and recall

雨燕双飞 提交于 2019-12-18 10:12:06
问题 I am training ML logistic classifier to classify two classes using python scikit-learn. They are in an extremely imbalanced data (about 14300:1). I'm getting almost 100% accuracy and ROC-AUC, but 0% in precision, recall, and f1 score. I understand that accuracy is usually not useful in very imbalanced data, but why is the ROC-AUC measure is close to perfect as well? from sklearn.metrics import roc_curve, auc # Get ROC y_score = classifierUsed2.decision_function(X_test) false_positive_rate,

Confusion about precision-recall curve and average precision

放肆的年华 提交于 2019-12-13 07:27:14
问题 I'm reading a lot about Precision-Recall curves in order to evaluate my image retrieval system. In particular I'm reading this article about feature extractors in VLFeat and the wikipedia page about precision-recall. I understand that this curve is useful to evaluate our system performance w.r.t. the number of elements retrieved. So we repeatedly compute precision-recall retrieving the top element, then top 2, top 3 and so on...but my question is: when do we stop ? My intuition is: we stop

Calculating precision, recall and F1 in Keras v2, am I doing it right?

。_饼干妹妹 提交于 2019-12-11 18:30:56
问题 There is already a question on how to obtain precision, recall and F1 scores in Keras v2, here is the method I'm using but the question is: am I doing it right? First of all, F. Chollet says he removed these three metrics from version 2 of Keras because they were batch-based and hence not reliable. I'm following an idea by basque21 using a Callback with method on_epoch_end, isn't this normally batch-independent since calculated at epoch end (= after all batches have finished)? Here is the

scikit weighted f1 score calculation and usage

余生长醉 提交于 2019-12-10 22:56:35
问题 I have a question regarding weighted average in sklearn.metrics.f1_score sklearn.metrics.f1_score(y_true, y_pred, labels=None, pos_label=1, average='weighted', sample_weight=None) Calculate metrics for each label, and find their average, weighted by support (the number of true instances for each label). This alters ‘macro’ to account for label imbalance; it can result in an F-score that is not between precision and recall. First, if there is any reference that justifies the usage of weighted

What is the correct version of Average precision?

▼魔方 西西 提交于 2019-12-06 05:44:39
问题 I'm trying to compute the Average Precision (and Mean Average Precision) on the Oxford Building image dataset. Below there is the code that they provide for computing Average Precision. Notice that pos_set is the union of the "optimal" and "good" images from the ground trouth set, while junk_set is a set of not-relevant images. void OxfordTest::computeAp(std::vector<std::string> &ranked_list){ float old_recall = 0.0; float old_precision = 1.0; float ap = 0.0; size_t intersect_size = 0; size_t

Keras custom recall metric based on predicted values

女生的网名这么多〃 提交于 2019-12-06 04:16:22
问题 I would like to implement a custom metric in keras that calculates the recall assuming that the top k% most probable y_pred_probs 's are true. In numpy I would do it as follows. Sort the y_preds_probs. Then take the value at the k th index. Note k=0.5 would give the median value. kth_pos = int(k * len(y_pred_probs)) threshold = np.sort(y_pred_probs)[::-1][kth_pos] y_pred = np.asarray([1 if i >= threshold else 0 for i in y_pred_probs]) The answer from: Keras custom decision threshold for