python第三方库——sklearn库
来源:互联网 发布:电脑数控编程 编辑:程序博客网 时间:2024/05/16 05:22
1、metrics
precision:
from sklearn.metrics import precision_scoreprecision_score(y_true, y_pre)#两个输入可以是shape = [n_samples],也可以是稀疏的矩阵one-hot表示
需要注意的点就是如果是多类别或者多标签问题,需要指定参数average的值:
precision_score
(y_true,y_pred,labels=None,pos_label=1, average='binary',sample_weight=None)
average : string, [None, ‘binary’ (default), ‘micro’, ‘macro’, ‘samples’, ‘weighted’],二分类问题默认取值binary,多分类问题默认取值weigthted,
None表示为每个类返回一个值;
binary:只返回pos_label声明的类别的结果,从0.18版本后,对于二分类问题只返回这个结果,即使指定其他取值,也是这样;
weighted:计算每个类别的结果后,根据类别出现的次数进行加权;
samples:只适用于多标签分类。
sample_weight : array-like of shape = [n_samples], optional
Sample weights.
recall:
from sklearn.metrics import recall_score
f1:
from sklearn.metrics import f1_score
accuracy:
from sklearn.metrics import accuracy_score
confusion_matrix:
from sklearn.metrics import confusion_matrixconfusion_matrix(gold_label, predictions) #gold_label:array, shape = [n_samples], predictions:array, shape = [n_samples] 返回的矩阵:array, shape = [n_classes, n_classes],第i,j个元素表示真实标记为i,但预测为j。
0 0
- python第三方库——sklearn库
- Python第三方库——Numpy
- Python第三方库——OpenCV
- Python第三方库——urlparser
- 定制带第三方库的python,解决spark/hadoop环境中sklearn的调用问题
- PyThon第三方库
- 第三方python库
- Python第三方库
- python第三方库
- Python第三方库——Matplotlib库
- Python第三方库使用——splinter
- Python第三方库使用 —— PIL
- Python网络爬虫——Requests第三方库
- Python爬虫—3第三方库_1_requests_入门
- Python爬虫—3第三方库_1_requests_进阶
- windows+python第三方库
- python第三方库介绍
- python 加载第三方库
- 工行融e联,绿色通道便捷办理
- Maven 入门
- 【DataGuard】Oracle 11g物理Active Data Guard实时查询(Real-time query)特性
- Leetcode 62 Unique Paths
- 不止三行
- python第三方库——sklearn库
- 全卷积网络(FCN)
- ARP协议解析
- 查找一个类在哪个jar下
- Charles使用详解
- iOS - 兼容iOS 10 资料整理笔记
- 线程--任务
- checkbox实现单选功能
- 人生第一篇博客