当前位置:网站首页>R language - some metrics for unbalanced data sets
R language - some metrics for unbalanced data sets
2022-07-28 11:32:00 【abolbee】
R Language - Some metrics for unbalanced data sets
In view of the fact that many posts have introduced various indicators to measure the performance of classifiers in detail , Here I want to share with you the functions written by the author , Function will return F_score(F Measure , Default β take 1),BACC(balanced accuracy),recall Recall rate , precision Accuracy ,specifity What a negative rate
The code is as follows :
# Calculate some indicators of unbalanced data sets , The main output F-score and BACC
# here positiveclass and negativeclass Value is the value of the target attribute , Such as yes and no
UBMetrics<-function(preds, test.lable, positiveclass, negativeclass, bta=1){
recall<-length(which(preds==test.label&preds==positiveclass))/length(which(test.label==positiveclass))
precision<-length(which(preds==test.label&preds==positiveclass))/length(which(preds==positiveclass))
specifity<-length(which(preds==test.label&preds==positiveclass))/length(which(test.label==positiveclass))
F_score<-(1+bta^2)*precision*recall/(recall+precision)
BACC<-(recall+specifity)/2
return(c(F_score=F_score,BACC=BACC,recall=recall,precision=precision,specifity=specifity))
}
The above code generation script can be named arbitrarily , It's called UBMetrics, Reference when calling :source("D:\\workspace\\UBMetrics.R")
边栏推荐
- Detailed explanations of%*d,%.*s, etc. of [C language]: "recommended collection"
- LiteSpeed Web服务器中安装SSL证书
- Server online speed measurement system source code
- Technology sharing | quick intercom integrated dispatching system
- 大三下学期总结
- 1331. Array sequence number conversion
- STM32驱动ST7701S芯片(vⅰV0手机换屏价)
- 什么是WordPress
- Ripro9.0 revised and upgraded version +wp two beautification packages + rare plug-ins
- mysql的左连接和右连接(内连接和自然连接的区别)
猜你喜欢

leetcode:981. 基于时间的键值存储【迭代for的陷阱:on】

What kind of knowledge payment system functions are more conducive to the development of the platform and lecturers?

Learn to use MySQL explain to execute the plan, and SQL performance tuning is no longer difficult

Outlook suddenly becomes very slow and too laggy. How to solve it

【MySQL从入门到精通】【高级篇】(九)InnoDB的B+树索引的注意事项
![完整版H5社交聊天平台源码[完整数据库+完整文档教程]](/img/3f/03239c1b4d6906766348d545a4f234.png)
完整版H5社交聊天平台源码[完整数据库+完整文档教程]

Bc35 NB module at instruction development summary

Open source huizhichuang future | 2022 open atom global open source summit openatom openeuler sub forum was successfully held

接口测试的作用
![[MySQL from introduction to proficiency] [advanced chapter] (x) MyISAM's indexing scheme & advantages and disadvantages of indexing](/img/f4/e04bf0f8f0866ea9db0615f0e5e1c4.png)
[MySQL from introduction to proficiency] [advanced chapter] (x) MyISAM's indexing scheme & advantages and disadvantages of indexing
随机推荐
数字孪生轨道交通:“智慧化”监控疏通城市运行痛点
WPF依赖属性(wpf 依赖属性)
C language uses double pointer to realize simple factory mode (polymorphism)
[half understood] zero value copy
Use the common union and pointer to test the size end
mysql(8.0.16版)命令及说明
万字详解 Google Play 上架应用标准包格式 AAB
Outlook suddenly becomes very slow and too laggy. How to solve it
「Node学习笔记」Koa框架学习
GIS数据漫谈(五)— 地理坐标系统
Introduction to web security RADIUS protocol application
Learn to use MySQL explain to execute the plan, and SQL performance tuning is no longer difficult
Two point, three point, 01 point plan [bullet III]
What kind of knowledge payment system functions are more conducive to the development of the platform and lecturers?
字节一面:如何用 UDP 实现可靠传输?
18 diagrams, intuitive understanding of neural networks, manifolds and topologies
PHP检测url网址链接是否正常可访问
擦黑板特效表白H5源码+非常浪漫/附BGM
精品方案|海泰方圆全栈式数据安全治理方案 为数据设一把“安全锁”
Top ten application development trends from 2022 to 2023