๋ฐ˜์‘ํ˜•

๐ŸŒŒ Deep Learning/ํ‰๊ฐ€ 3

T test ์™€ P value

T test๋ž€? T test๋Š” ๋‘ group๊ฐ„์˜ ์ฐจ์ด๊ฐ€ ์–ผ๋งˆ๋‚˜ "significant"ํ•œ์ง€๋ฅผ ์˜๋ฏธํ•œ๋‹ค. ์ฆ‰, ๋‘ group๊ฐ„์˜ ์ฐจ์ด๊ฐ€ "์šฐ์—ฐํžˆ" ์ผ์–ด๋‚œ ์ผ์ผ ํ™•๋ฅ ์„ ์ธก์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋ณดํ†ต ๋ฐ์ดํ„ฐ ์ˆ˜๊ฐ€ ์ ์€ ๊ฒฝ์šฐ์— ์‚ฌ์šฉํ•œ๋‹ค. ํ•˜๋‚˜์˜ ์˜ˆ์‹œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค. ์ œ์•ฝํšŒ์‚ฌ์—์„œ ์ƒˆ๋กœ์šด ํ•ญ์•”์ œ๋ฅผ ๊ฐœ๋ฐœํ•ด ์ด๊ฒƒ์ด ๊ธฐ๋Œ€์ˆ˜๋ช…์— ๋ฏธ์น˜๋Š” ์˜ํ–ฅ์„ ์กฐ์‚ฌํ•˜๊ณ  ์‹ถ๋‹ค๊ณ  ํ•˜์ž. ์ด๋Ÿฌํ•œ ์‹คํ—˜์„ ์ง„ํ–‰ํ•  ๋•Œ์—๋Š”, ํ•ญ์ƒ ๋Œ€์กฐ๊ตฐ(placebo ๋ณต์šฉ)์ด ์กด์žฌํ•œ๋‹ค. ์‹คํ—˜ ๊ฒฐ๊ณผ ๋Œ€์กฐ๊ตฐ์˜ ๊ธฐ๋Œ€์ˆ˜๋ช…์ด ํ‰๊ท ์ ์œผ๋กœ 5๋…„ ์ฆ๊ฐ€ํ–ˆ๊ณ , ์‹คํ—˜๊ตฐ(์‹ค์ œ ํ•ญ์•”์ œ ๋ณต์šฉ)์˜ ๊ธฐ๋Œ€์ˆ˜๋ช…์ด ํ‰๊ท ์ ์œผ๋กœ 6๋…„ ์ฆ๊ฐ€ํ–ˆ๋‹ค๊ณ  ํ•œ๋‹ค๋ฉด, ์–ธ๋œป ๋ณด๊ธฐ์—๋Š” ํ•ญ์•”์ œ๊ฐ€ ์‹ค์ œ๋กœ ๊ธฐ๋Œ€์ˆ˜๋ช…์„ ๋Š˜๋ ค์ฃผ๋Š” ํšจ๊ณผ๊ฐ€ ์žˆ์–ด ๋ณด์ธ๋‹ค. ์‹ค์ œ๋กœ ์ด๊ฒƒ์ด ์šฐ์—ฐ์— ์˜ํ•ด ๋ฐœ์ƒํ•œ ์ผ์ธ์ง€, ์•„๋‹Œ์ง€๋ฅผ T test๋Š” ํ™•๋ฅ ์„ ํ†ตํ•ด ์•Œ๋ ค์ค„ ์ˆ˜..

Python์œผ๋กœ Multiclass sensitivity, specificity ๊ณ„์‚ฐํ•˜๊ธฐ

Multiclass ๋ฌธ์ œ์˜ ๊ฒฝ์šฐ sensitivity(๋ฏผ๊ฐ๋„)์™€ specificity(ํŠน์ด๋„)๋ฅผ ๊ฐ class๋งˆ๋‹ค ๊ณ„์‚ฐํ•ด์•ผ ํ•œ๋‹ค. sklearn.metrics.confusion_matrix๋ฅผ ์ด์šฉํ•ด ๊ฐ class์˜ sensitivity์™€ specificity๋ฅผ ๊ณ„์‚ฐํ•  ์ˆ˜ ์žˆ๋‹ค. from sklearn.metrics import confusion_matrix y = y.argmax(axis=-1) y_pred = y_pred.argmax(axis=-1) y_i = np.where(y==y_class, 1, 0) y_pred_i = np.where(y_pred==y_class, 1, 0) cfx = confusion_matrix(y_i, y_pred_i) y_i์™€ y_pred_i๋Š” y_class์— ์†ํ•˜๋Š” s..

Nested cross validation

ํ”ํžˆ Cross validation์€ Train data์™€ Validation data๋ฅผ, ํ˜น์€ Train data์™€ Test data๋ฅผ kํšŒ ๊ฐ๊ฐ ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์œผ๋กœ ๋ถ„ํ• ํ•˜์—ฌ ๋ชจ๋ธ ์„ฑ๋Šฅ์„ ๊ฒ€์ฆํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค. ์•„๋ž˜ ๊ทธ๋ฆผ์€ 5-fold Train-Test cross validation์„ ์„ค๋ช…ํ•˜๊ณ  ์žˆ๋‹ค. Train data์™€ Validation data์˜ ๋ถ„ํ• ์— cross validation์„ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด, ๋‹ค์–‘ํ•œ validation data๋ฅผ ์ด์šฉํ•ด ์ตœ์ ์˜ model parameter์„ ํƒ์ƒ‰ํ•˜๊ธฐ ์œ„ํ•จ์ด๊ณ , Train data์™€ Test data์˜ ๋ถ„ํ• ์— cross validation์„ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด, ๋‹ค์–‘ํ•œ test data์— ๋Œ€ํ•ด model์˜ ์„ฑ๋Šฅ์„ ํ‰๊ฐ€ํ•˜๊ธฐ ์œ„ํ•จ์ด๋‹ค. Nested Cross validation์€ ..

๋ฐ˜์‘ํ˜•