iT邦幫忙

0

求大神幫忙解 陰性預測值 還有 特異性

  • 分享至 

  • xImage

給你 ACC還有PPV的值還有Sensitivity值
假設 99.26%為ACC 98.05%為PPV 98.04%為Sensitivity
只有這些%
要求出 他的 NPV 還有 Specificity

有好心可以給怎麼算寫出來
拜託拜託 緊急

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

1
I code so I am
iT邦高手 1 級 ‧ 2022-02-01 15:02:39

解法如下,公式參考https://en.wikipedia.org/wiki/Precision_and_recall:

Accuracy = T / (P+N)
# 因 (P+N) = 1 ==> T = 0.9926 ==> F = 1 - T = 0.0074

# Precision = tp / P = 0.9805 ==> tp = 0.9805 * P, fp = 0.0195 * P

# fn = F - fp = F - 0.0195 * P = 0.0074 - 0.0195 * P

# Recall = tp / (tp + fn) = 0.9804
==> (0.9805 * P) / (0.9805 * P + (0.0074 - 0.0195 * P)) = 0.9804 (利用程式1)
==> P = 0.1892, N = 1 - 0.1892 = 0.8108

# NPV = tn / (tn +fn) = (T - tp) / N = (0.9926 - 0.9805) / 0.8108 = 0.01492
# specificity = tn / (tn + fp) = (T - tp) / (T - tp + P - tp) = 0.9954495603486425 (利用程式2)

# Specificity = tn / (tn +fp) = (T - Recall) = 0.9926 - 0.9804 = 0.0122

程式1:

from sympy.solvers import solve
from sympy import Symbol
P = Symbol('P', real=True)
solve([(0.9805 * P) / (0.9805 * P + (0.0074 - 0.0195 * P)) - 0.9804])

程式2:

T = 0.9926
P = 0.1892
tp = 0.9805 * P
(T - tp) / (T - tp + P - tp)

我要發表回答

立即登入回答