准确率与召回率 参考链接: http://scikit-learn.org/stable/modules/generated/sklearn.metrics.precision_recall_curve.html#sklearn.metrics.precision_recall_curve
(x, y, clf, y_train, y_pre)
| 53 | |
| 54 | |
| 55 | def show_precision_recall(x, y, clf, y_train, y_pre): |
| 56 | ''' |
| 57 | 准确率与召回率 |
| 58 | 参考链接: http://scikit-learn.org/stable/modules/generated/sklearn.metrics.precision_recall_curve.html#sklearn.metrics.precision_recall_curve |
| 59 | ''' |
| 60 | precision, recall, thresholds = precision_recall_curve(y_train, y_pre) |
| 61 | # 计算全量的预估结果 |
| 62 | answer = clf.predict_proba(x)[:, 1] |
| 63 | |
| 64 | ''' |
| 65 | 展现 准确率与召回率 |
| 66 | precision 准确率 |
| 67 | recall 召回率 |
| 68 | f1-score 准确率和召回率的一个综合得分 |
| 69 | support 参与比较的数量 |
| 70 | 参考链接:http://scikit-learn.org/stable/modules/generated/sklearn.metrics.classification_report.html#sklearn.metrics.classification_report |
| 71 | ''' |
| 72 | # target_names 以 y的label分类为准 |
| 73 | target_names = ['thin', 'fat'] |
| 74 | print(classification_report(y, answer, target_names=target_names)) |
| 75 | print(answer) |
| 76 | print(y) |
| 77 | |
| 78 | |
| 79 | def show_pdf(clf): |