Description Usage Arguments Details Value See Also Examples
performance_bin()은 이항 분류 모델에 대한 비닝된 변수의 성능을 평가하기 위해 메트릭을 계산합니다.
1 | performance_bin(y, x, na.rm = FALSE)
|
y |
문자 또는 숫자, 정수, 인수. 이진 응답 변수(0, 1) 변수는 0과 1의 요소만을 포함해야 합니다. 단, 2개의 수준을 가진 요소의 경우, 계산 과정에서 타입 변환이 수행됩니다. |
x |
정수 또는 인수, 문자. 최소 2개의 다른 값이어야 하며, Inf는 허용되지 않습니다. |
na.rm |
logical. 결측값을 제거해야 하는지 여부를 나타내는 논리값 |
이 함수는 dplyr 패키지의 mutate, 혹은 transmute 함수와 사용하면 효율적으로 데이터를 비닝할 수 있습니다.
"performance_bin" 클래스 객체. data.frame의 값은 다음과 같습니다.
Bin : character. bins.
CntRec : integer. 빈(bins)별 빈도
CntPos : integer. 빈(bins)별 양(positive)의 빈도
CntNeg : integer. 빈(bins)별 음(negative)의 빈도
CntCumPos : integer. 빈별 양의 누적 빈도
CntCumNeg : integer. 빈별 음의 누적 빈도
RatePos : integer. 빈별 양의 상대 빈도
RateNeg : integer. 빈별 음의 상대 빈도
RateCumPos : numeric. 빈별 양의 누적 상대 빈도
RateCumNeg : numeric. 빈별 음의 누적 상대 빈도
Odds : numeric. 오즈비(Odds Ratio)
LnOdds : numeric. 로그화된 오즈비
WoE : numeric. WoE(Weight of Evidence)
IV : numeric. 제프리(Jeffrey)의 정보 가치
JSD : numeric. 젠슨-샤논(Jensen-Shannon) 발산
AUC : numeric. AUC(Area Under Curve;곡선 아래 면적)
"performance_bin" 클래스의 속성은 다음과 같습니다.
names : character. "Binning Table"이 있는 data.frame의 변수 이름
class : character. 클래스 이름("performance_bin", "data.frame")
row.names : character. "Binning Table"이 있는 data.frame의 행 이름
IV : numeric. 제프리(Jeffrey)의 정보 가치
JSD : numeric. 젠슨-샤논(Jensen-Shannon) 발산
KS : numeric. 콜모고로프-스미르노프(Kolmogorov-Smirnov) 통계량
gini : numeric. 지니 계수
HHI : numeric. 허핀달-허쉬만(Herfindahl-Hirschman) 지수
HHI_norm : numeric.정규화된 허핀달-허쉬만(Herfindahl-Hirschman) 지수
Cramer_V : numeric. 크래머(Cramer)의 V 통계량
chisq_test : data.frame. 유의성 검정 표. 이름은 다음과 같습니다.
Bin A : character. 첫 번째 빈(bins)
Bin B : character. 두 번째 빈(bins)
statistics : numeric. 카이제곱 검정의 통계
p_value : numeric. 카이제곱 검정의 유의 확률(p-value)
summary.performance_bin
, plot.performance_bin
, binning_by
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # 예제를 위한 데이터 생성
heartfailure2 <- heartfailure
set.seed(123)
heartfailure2[sample(seq(NROW(heartfailure2)), 5), "creatinine"] <- NA
# 타깃 변수를 0(음)과 1(양)로 변경
heartfailure2$death_event_2 <- ifelse(heartfailure2$death_event %in% "Yes", 1, 0)
# creatinine에서 platelets_bin으로 비닝
breaks <- c(0, 1, 2, 10)
heartfailure2$creatinine_bin <- cut(heartfailure2$creatinine, breaks)
# 비닝된 변수의 성능 진단
perf <- performance_bin(heartfailure2$death_event_2, heartfailure2$creatinine_bin)
perf
summary(perf)
# plot(perf)
# 비닝된 변수의 성능 진단 (NA 제외)
perf <- performance_bin(heartfailure2$death_event_2, heartfailure2$creatinine_bin, na.rm = TRUE)
perf
summary(perf)
# plot(perf)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.