当前位置:网站首页>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")
边栏推荐
- Sirius network verification source code / official genuine / included building tutorial
- Good use explosion! The idea version of postman has been released, and its functions are really powerful
- 2021-03-24
- B2 sub theme / blog b2child sub theme / open source code
- 【Gradle】This version of the JMH Gradle plugin requires Gradle 6+, you are using 6.6.
- Thinkphp5行为钩子Hook返回结果(数据)示例
- Two dimensional prefix and
- STM32驱动ST7701S芯片(vⅰV0手机换屏价)
- Tiktok programmer confession special code tutorial (how to play Tiktok)
- Full version of H5 social chat platform source code [complete database + complete document tutorial]
猜你喜欢

Localization, low latency, green and low carbon: Alibaba cloud officially launched Fuzhou data center

Technology sharing | quick intercom integrated dispatching system

Encryption defect of icloud Keychain in Apple mobile phone

Quickly deploy mqtt clusters on AWS using terraform

What is WordPress

字节一面:如何用 UDP 实现可靠传输?

Ripro9.0 revised and upgraded version +wp two beautification packages + rare plug-ins

服务器在线测速系统源码

【一知半解】零值拷贝

天狼星网络验证源码/官方正版/内附搭建教程
随机推荐
Three ways for Cortex-M kernel to manage global interrupts
1天涨粉81W,打造爆款短视频的秘诀是什么?
Game theory 1. Introduction (basic concepts of combination games, confrontation search, bash games, Nim games)
Bc35 NB module at instruction development summary
[half understood] zero value copy
web安全入门-Radius协议应用
R语言-用于非平衡数据集的一些度量指标
Two point, three point, 01 point plan [bullet I]
What functions does MySQL have? Don't look everywhere. Just look at this.
Encryption defect of icloud Keychain in Apple mobile phone
Install SSL Certificate in Litespeed web server
Sirius network verification source code / official genuine / included building tutorial
[MySQL] MySQL error "error 2006 (HY000): MySQL server has gone away"
Summary of common RSA related problems in CTF: basic RSA encryption and decryption
B2 sub theme / blog b2child sub theme / open source code
用c语言编写学生成绩管理系统(c语言学生成绩管理系统删除)
Use the common union and pointer to test the size end
Analysis of boot process of cortex-m4 and cortex-a7 kernel
What is WordPress
一种比读写锁更快的锁,还不赶紧认识一下