로그 정규화

Python으로 배우는 Machine Learning 전처리

James Chapman

Curriculum Manager, DataCamp

로그 정규화란?

 

  • 분산이 높은 특성에 유용
  • 로그 변환 적용
  • 상수 $e$ ($\approx2.718$)를 이용한 자연로그
Python으로 배우는 Machine Learning 전처리

로그 정규화란?

 

  • 분산이 높은 특성에 유용
  • 로그 변환 적용
  • 상수 $e$ ($\approx2.718$)를 이용한 자연로그
  • $e^{3.4} = 30$

 

  • 상대적 변화와 변화의 크기를 포착하며, 값을 양수로 유지

 

로그
30 3.4
300 5.7
3000 8
Python으로 배우는 Machine Learning 전처리

Python에서의 로그 정규화

print(df)
   col1   col2
0  1.00    3.0
1  1.20   45.5
2  0.75   28.0
3  1.60  100.0
print(df.var())
col1       0.128958
col2    1691.729167
dtype: float64
import numpy as np
df["log_2"] = np.log(df["col2"])
print(df)
   col1   col2     log_2
0  1.00    3.0  1.098612
1  1.20   45.5  3.817712
2  0.75   28.0  3.332205
3  1.60  100.0  4.605170
print(df[["col1", "log_2"]].var())
col1     0.128958
log_2    2.262886
dtype: float64
Python으로 배우는 Machine Learning 전처리

연습해 봅시다!

Python으로 배우는 Machine Learning 전처리

Preparing Video For Download...