回归与分类的评价指标

cross_validatecross_val_score中,参数scoring,与分类、聚类和回归算法的评价指标有关。

3.4.3. The scoring parameter: defining model evaluation rules

For the most common use cases, you can designate a scorer object with the scoring parameter via a string name; the table below shows all possible values. All scorer objects follow the convention that higher return values are better than lower return values. Thus metrics which measure the distance between the model and the data, like metrics.mean_squared_error, are available as 'neg_mean_squared_error' which return the negated value of the metric

对于最常见的用例,您可以通过字符串名称使用 scoring 参数指定一个评分对象;下表显示了所有可能的值。所有评分对象都遵循这样的约定:返回值越高越好。因此,像 metrics.mean_squared_error 这样衡量模型与数据之间距离的指标,会以 'neg_mean_squared_error' 的形式提供,返回该指标的负值。

1、分类

字符串 函数 公式
accuracy metrics.accuracy_score a c c u r a c y ( y , y ^ ) = 1 n ∑ i = 0 n − 1 1 ( y ^ i = y i ) accuracy(y,\hat{y}) = \frac{1}{n}\sum_{i=0}^{n-1}1(\hat{y}_i=y_i) accuracy(y,y^)=n1∑i=0n−11(y^i=yi)
balanced_accuracy metrics.balanced_accuracy_score b a l a n c e d − a c c u r a c y = 1 2 ( T P T P + F N + T N T N + F P ) balanced-accuracy=\frac{1}{2}(\frac{TP}{TP+FN}+\frac{TN}{TN+FP}) balanced−accuracy=21(TP+FNTP+TN+FPTN)
top_k_accuracy metrics.top_k_accuracy_score t o p − k a c c u r a c y ( y , y ^ ) = 1 n ∑ i = 0 n − 1 ∑ j = 1 k 1 ( f ^ i , j = y i ) top-k\ \ accuracy(y,\hat{y}) = \frac{1}{n}\sum_{i=0}^{n-1}\sum_{j=1}^{k}1(\hat{f}_{i,j}=y_i) top−k accuracy(y,y^)=n1∑i=0n−1∑j=1k1(f^i,j=yi)
average_precision metrics.average_precision_score A P = ∑ n ( R n − R n − 1 ) P n AP = \sum_{n}(R_n-R_{n-1})P_n AP=∑n(Rn−Rn−1)Pn
neg_brier_score metrics.brier_score_loss B S = 1 n ∑ i = 0 n − 1 ( y i − p i ) 2 = 1 n ∑ i = 0 n − 1 ( y i − p r e d i c t _ p r o b a ( y = 1 ) ) 2 BS= \frac{1}{n}\sum_{i=0}^{n-1}(y_i-p_i)^2=\frac{1}{n}\sum_{i=0}^{n-1}(y_i-predict\_{proba}(y=1))^2 BS=n1∑i=0n−1(yi−pi)2=n1∑i=0n−1(yi−predict_proba(y=1))2
f1 metrics.f1_score F 1 = 2 ∗ T P 2 ∗ T P + F P + F N F1=\frac{2*TP}{2*TP+FP+FN} F1=2∗TP+FP+FN2∗TP (average parameter)
neg_log_loss metrics.log_loss L l o g ( y , p ) = − l o g P r ( y ∣ p ) = − ( y l o g ( p ) + ( 1 − y ) l o g ( 1 − p ) ) L_{log}(y,p)=-logPr(y|p)=-(ylog(p)+(1-y)log(1-p)) Llog(y,p)=−logPr(y∣p)=−(ylog(p)+(1−y)log(1−p)) L l o g ( Y , P ) = − l o g P r ( Y ∣ P ) = − 1 N ∑ i = 0 N − 1 ∑ k = 0 K − 1 y i , k l o g p i , k L_{log}(Y,P)=-logPr(Y|P)=-\frac{1}{N}\sum_{i=0}^{N-1}\sum_{k=0}^{K-1}y_{i,k}logp_{i,k} Llog(Y,P)=−logPr(Y∣P)=−N1∑i=0N−1∑k=0K−1yi,klogpi,k
precision metrics.precision_score P = T P T P + F P P=\frac{TP}{TP+FP} P=TP+FPTP
recall metrics.recall_score R = T P T P + F N R=\frac{TP}{TP+FN} R=TP+FNTP
jaccard metrics.jaccard_score J ( y , y ^ ) = y ⋂ y ^ y ⋃ y ^ J(y,\hat{y})=\frac{y\bigcap\hat{y}}{y\bigcup\hat{y}} J(y,y^)=y⋃y^y⋂y^
roc_auc metrics.roc_auc_score Compute Area Under the Receiver Operating Characteristic Curve (ROC AUC) from prediction scores
相关推荐
Clocky722 分钟前
opencv-python基础
开发语言·python
满怀10151 小时前
【Python Requests 库详解】
开发语言·python
小白教程1 小时前
Python爬取视频的架构方案,Python视频爬取入门教程
python·架构·音视频·python爬虫·python视频爬虫·python爬取视频教程
仰望星空的小随2 小时前
django相关面试题
python·django·sqlite
2401_890665863 小时前
免费送源码:Java+SpringBoot+MySQL SpringBoot网上宠物领养管理系统 计算机毕业设计原创定制
java·vue.js·spring boot·python·mysql·pycharm·html5
黑不拉几的小白兔3 小时前
第十五届蓝桥杯大赛软件赛省赛Python 大学 B 组试做(下)【本期题单: 缴纳过路费, 纯职业小组】
数据库·python·蓝桥杯
仙人掌_lz3 小时前
使用Python从零实现一个端到端多模态 Transformer大模型
开发语言·人工智能·python·ai·transformer·多模态
一个专注api接口开发的小白3 小时前
从零搭建淘宝数据采集系统:商品 API 接口调用与 OAuth2.0 认证实践
前端·数据挖掘·api
赤鸢QAQ3 小时前
ffpyplayer+Qt,制作一个视频播放器
python·qt·音视频
隔壁小查3 小时前
【后端开发】Spring MVC阶段总结
python·spring·mvc