当前位置:网站首页>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")
边栏推荐
- Stacks and queues
- Why does MySQL sometimes choose the wrong index?
- ZBrush 2022 software installation package download and installation tutorial
- Cvpr2021 pedestrian re identification /person re identification paper + summary of open source code
- 接口测试的作用
- Installing sqlmap on win10 (Windows 7)
- 什么是WordPress
- What is WordPress
- Introduction to web security RADIUS protocol application
- Postgres overview
猜你喜欢

目标检测领域必看的6篇论文

不用Swagger,那我用啥?

小水滴2.0网站导航网模板
![[half understood] zero value copy](/img/4b/c8140bf7ee4baa094ca3011108d686.gif)
[half understood] zero value copy

Bc35 NB module at instruction development summary

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

Random talk on GIS data (V) - geographic coordinate system

Summary of the second semester of junior year

万字详解 Google Play 上架应用标准包格式 AAB

LiteSpeed Web服务器中安装SSL证书
随机推荐
什么是WordPress
Top ten application development trends from 2022 to 2023
No swagger, what do I use?
Byte side: how to realize reliable transmission with UDP?
Left connection and right connection of MySQL (the difference between inner connection and natural connection)
Ripro9.0 revised and upgraded version +wp two beautification packages + rare plug-ins
Introduction to web security RADIUS protocol application
CVPR2020 best paper:对称可变形三维物体的无监督学习
postgres概述
Good use explosion! The idea version of postman has been released, and its functions are really powerful
Remote shutdown of computer with mobile phone
18张图,直观理解神经网络、流形和拓扑
Generation and use of Lib library files in keil and IAR
精品方案|海泰方圆全栈式数据安全治理方案 为数据设一把“安全锁”
Analysis of boot process of cortex-m4 and cortex-a7 kernel
Localization, low latency, green and low carbon: Alibaba cloud officially launched Fuzhou data center
Two point, three point, 01 point plan [bullet I]
Related concepts of several databases
Open source huizhichuang future | 2022 open atom global open source summit openatom openeuler sub forum was successfully held
Blackboard cleaning effect shows H5 source code + very romantic / BGM attached