C.W.K.
Stream
Lesson 01 of 10 · published

머신러닝이라는 게 진짜로 뭐야

~32 min · foundation, machine-learning, framing

Level 0Scout
0 XP0/48 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

네 조각짜리 계약

머신러닝은 데이터를 답으로 바꿔주는 마법 상자가 아니야. 예측할 target, 예측 시점에 쓸 수 있는 feature, 둘을 짝지어 주는 학습 데이터, 그리고 도움이 됐는지 판정해주는 metric — 이 네 조각이 만드는 계약이야. 어느 한 조각만 깨져도 노트북 화면에서만 똑똑해 보이는 모델이 나와.

학습이 코드에선 어떻게 보이나

학습 알고리즘은 train 예제 위에서 loss가 줄도록 parameter를 바꿔. 바람은 이 parameter가 한 번도 본 적 없는 예제에서도 좋은 prediction을 내는 거고. 근데 그 바람은 자동이 아니야. 예제가 대표성이 있어야 하고, target이 명확해야 하고, feature가 prediction 시점에 합법이어야 해.

production에선 어떻게 보이나

실제 배포에선 모델은 큰 파이프라인 속의 한 박스일 뿐이야. feature 추출, scoring, threshold, decision, logging, monitoring, feedback — 다 합쳐야 ML 시스템이지. 모델 카드와 deploy 스크립트가 같은 repo 안에 없으면, 그 프로젝트는 아직 진짜 ML이 아니야.

흔한 실수

validation score가 똑똑함의 증거라고 믿는 거. notebook split에서 ROC-AUC 0.97 나왔다고 의기양양한데, feature가 사후 정보였거나 production 데이터가 train 분포에서 멀어졌으면 그 점수는 거짓말이야.

Code

sklearn import 하기 전에 학습 계약부터 적기·python
contract = {
    "target": "will_churn_within_30_days",
    "prediction_time": "end of each calendar day",
    "legal_features": [
        "plan_tier",
        "tenure_days",
        "tickets_last_30d",
        "logins_last_7d",
    ],
    "metric": "PR-AUC, with recall >= 0.70 on high-risk users",
    "baseline": "current rules-based churn flag",
    "action_if_positive": "send retention offer next morning",
}
assert contract["baseline"], "every ML project needs a baseline to beat"
계약을 지키는 가장 작은 모델·python
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.metrics import average_precision_score

X = customers[contract["legal_features"]]
y = customers[contract["target"]]

X_tr, X_te, y_tr, y_te = train_test_split(
    X, y, test_size=0.2, stratify=y, random_state=7
)
model = LogisticRegression(max_iter=200).fit(X_tr, y_tr)
pr_auc = average_precision_score(y_te, model.predict_proba(X_te)[:, 1])
print(f"baseline beat? PR-AUC={pr_auc:.3f}")

External links

Exercise

지금 회사나 사이드 프로젝트에서 한 가지 prediction 문제를 골라봐. 네 조각짜리 계약(target / prediction-time feature / dataset / metric) 과 이겨야 할 baseline을 적어. baseline을 못 적겠으면, 지금 ML은 잘못된 도구야.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.