C.W.K.
Stream
Lesson 02 of 08 · published

Tabular Data 직관

~26 min · tabular, eda, pandas

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

모델링 전에 봐

training 전에 pandas에서 보낸 1분이 10배로 갚아. tabular EDA 목표는 예쁜 노트북이 아냐 — 모델 안에 숨어버릴 surprise를 미리 발견하는 거야: 비대칭 분포, sentinel 값, 잘못 라벨된 카테고리, time gap, 중복 key, signal 대부분을 담은 소수 row.

가장 먼저 체크할 10가지

  1. row 수와 unique-key 수.
  2. column별 null 비율.
  3. 모든 categorical의 cardinality.
  4. 모든 numeric의 요약 (min, p25, median, p75, max).
  5. 숫자인 척하는 sentinel 값 (-1, 999, 9999).
  6. target의 class balance.
  7. timestamp가 있다면 time range와 gap.
  8. 중복 row.
  9. target의 outlier.
  10. target과의 상위 상관관계 (linear and rank).

의심의 법칙

한 feature 혼자 너무 predictive 해 보이면, leakage일 가능성 커. target이 너무 깨끗하면, downstream 시스템이 이미 curate 한 거. 축하 전에 의심부터 해.

Code

한 화면 안의 first-ten EDA·python
import pandas as pd

df = pd.read_parquet("data/processed/train.parquet")
print(df.shape, df.duplicated().sum(), "duplicates")
print(df.isna().mean().sort_values(ascending=False).head(10))
print(df.select_dtypes("object").nunique().sort_values(ascending=False).head(10))
print(df["target"].value_counts(normalize=True))
숫자인 척하는 sentinel 값 잡기·python
for col in df.select_dtypes("number").columns:
    counts = df[col].value_counts().head(3)
    if counts.iloc[0] > 0.05 * len(df) and counts.index[0] in {-1, 0, 999, 9999}:
        print(f"⚠️  {col}: {counts.index[0]} appears in {counts.iloc[0]} rows")

External links

Exercise

first-ten EDA 리스트를 dataset에 돌려. surprise 3개 적어. 각각이 feature 정의, target 정의, labeling guide 중 무엇을 바꾸는지 결정. notebook을 notebooks/01_eda.ipynb에 저장.

Progress

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

댓글 0

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

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