当前位置:网站首页>Evaluation index of anomaly detection: rocauc et al. [tips]
Evaluation index of anomaly detection: rocauc et al. [tips]
2022-07-28 22:43:00 【It's too simple】
Preface
Divided into picture level ( Label the whole picture ) And pixel level ( Label each pixel ) Of .
ROCAUC
roc
from sklearn.metrics import roc_curve
fpr, tpr, thresholds = roc_curve(gt_list, img_scores)Parameters : label , Evaluation score ( That is, the probability that each sample is predicted to be positive ), Positive sample label ( The default is 0). Return results :fpr,tpr,thresholds.
fpr: Negative positive rate , The negative category is predicted to be the proportion of the positive category in all negative categories .
tpr: Real class rate , The positive category predicts that the positive category accounts for the proportion of all positive categories .
threshold: threshold
auc
from sklearn.metrics import roc_auc_score
img_roc_auc = roc_auc_score(gt_list, img_scores)How did it come about
threshold Is the evaluation score of each sample , That is, the probability that each sample is predicted to be positive , There is a probability value , Is this sample a positive sample or a negative sample . So the rules are , When threshold When taking the probability value of one sample , Greater than this threshold The probability value of is defined as positive class , Less than, it is defined as negative class , thus A little reasoning once ,threshold The smaller it is ,fpr,tpr The greater the ,threshold The bigger it is ,fpr,tpr The smaller it is . such , Do the threshold value for the probability values of all samples , With fpr The horizontal axis ,tpr The curve of the vertical axis can be drawn , namely roc curve .
auc Namely roc The area under the curve , From the above ,auc Of course, the closer 1 Better .
Reference resources
ROC Curve and AUC Calculation summary _ Taotie competitive blog -CSDN Blog _roc Curve and aucsklearn Draw in ROC A function of a curve roc_curve() explain _Stephen__W The blog of -CSDN Blog _roc_curveROC Curves and AUC Area understanding _Microstrong0305 The blog of -CSDN Blog _auc curve AUC Detailed explanation _ac7 The blog of -CSDN Blog _auc Detailed explanation
Other evaluation indicators
precision,recall
from sklearn.metrics import precision_recall_curve
precision, recall, thresholds = precision_recall_curve(gt_mask.flatten(), scores.flatten())Setting of function parameters , The return of results , The principle of calculation is the same as the above auc be similar , Analogy .
There is such a confusion matrix :
| actual | forecast | |
| just | negative | |
| just | TP( The real class ) | FN( False negative class ) |
| negative | FP( Pseudopositive class ) | TN( True negative class ) |
precision=tp / (tp + fp): Accuracy rate , Positive category prediction is the proportion of positive category in all predicted positive categories .
recall=tp / (tp + fn): Recall rate , That is to say tpr.
The two indicators are often inversely proportional , That is, the greater the accuracy , The smaller the recall rate . It can be understood a little from the definition , High accuracy , Then the probability that the negative category is predicted to be the positive category is low , High recall rate , Then the probability that the positive category is predicted to be the negative category is low , This equates them to the class prediction problem , Further understanding , You know the inverse relationship between the two .
So both cannot be high , Need to find a balance , Finding the balance point needs to be done PRC curve , The horizontal axis recall, The vertical axis precision.F1 This is the common balance point indicator .
F1
2*precision*recall/(precision+recall)
Reference resources
precision,recall and precision-recall curve_tangzy_ The blog of -CSDN Blog
边栏推荐
猜你喜欢

STM32 - systick timer (cubemx configures systick)

Install PCL and VTK under the background of ROS installation, and solve VTK and PCL_ ROS conflict problem
![MKD [anomaly detection: knowledge disruption]](/img/15/10f5c8d6851e94dac764517c488dbc.png)
MKD [anomaly detection: knowledge disruption]

6K6w5LiA5qyh5pS75Ye75YiG5p6Q

STM32 - interrupt overview (interrupt priority)

STM32 - external interrupt application (exti) (use cubemx to configure interrupts)

Stm32+ four pin OLED screen + Chinese character mold taking

STM32 - reset and clock control (cubemx for clock configuration)

imx6q gpio复用

Paddlenlp text classification based on ernir3.0: take wos dataset as an example (hierarchical classification)
随机推荐
20-09-27项目迁移到阿里折腾记录(网卡顺序导致服务无法通过haproxy连接到db)
Paddlenlp text classification based on ernir3.0: take wos dataset as an example (hierarchical classification)
Leetcode question brushing series - sum of majority type
XXX port is already in use
Detection and tracking evaluation index
使用PCL批量显示PCD点云数据流
PaddleNLP基于ERNIR3.0文本分类:WOS数据集为例(层次分类)
Image is referred in multiple repositories
Summary of common error types in JS
Using PCL to batch display PCD point cloud data flow
STM32 - DMA direct memory access controller (cubemx configures DMA)
JS array merging, de duplication, dimensionality reduction (es6: extended operator, set)
winServer运维技术栈
Kali source solution software cannot be installed correctly
LeetCode刷题系列之-多数之和类型
The function of wechat applet to cut pictures
微信小程序剪切图片的功能
Sword finger offer II 065. The shortest word code (medium dictionary tree string array)
GD32F303固件库开发(10)----双ADC轮询模式扫描多个通道
What are the main functions and uses of LCR tester