
v1 Min-Max 은 min/max 기반 → 단 하나의 이상치가 전체 스케일을 망침. Robust scaler 는 분위수(percentile) 기반:
q_low = np.percentile(X[:, j], p_low) (예: 5-percentile)q_high = np.percentile(X[:, j], p_high) (예: 95-percentile)값 범위:
RobustScaler 의 변형.함수 robust_scale(X, p_low=5, p_high=95) 를 완성하세요.
X shape (N, D).q_high == q_low (모두 같은 값) 인 열 → 해당 열 0 반환 (nan 방지).np.percentile(X, p_low, axis=0) 등.| # | 이름 | 검증 |
|---|---|---|
| 1 | shape 유지 | |
| 2 | 이상치 없는 데이터 → 대부분 [0, 1] | |
| 3 | 이상치 추가해도 스케일 안정 | v1 vs v3 비교 |
| 4 | 상수 열 → 0 (NaN 없음) | |
| 5 | p_low=0, p_high=100 → v1 min-max 와 동일 | |
| 6 | q_low 위치 값 → 0, q_high 위치 값 → 1 |
코드를 작성하고 Run 을 눌러보세요.