Machine Learning/Statistics

표준화(standardization)과 정규화(normalization)

고슴군 2019. 8. 19. 16:22

표준화 (Standardization)

  • 수식 : (요소값-평균) / 표준편차
  • 평균을 기준으로 얼마나 떨어져 있는지 나타내는 값으로, 이 방법에 적용하려는 때는 2개 이상의 대상이 단위가 다를 때 대상 데이터를 같은 기준으로 볼 수 있게 합니다.
  • 예를 들어, 삼성전자와 현대차의 주식시세에 대해 동일 기간에 대해 표준화를 수행하면 두 종목이 어떤 특징을 가지고 움직이는지 관찰하는데 도움이 됩니다.
  • 또 다른 예시로, 몸무게와 키에 대해 표준화를 수행한 후 데이터를 보았을 때 몸무게는 음수, 키는 양수 값이 나온다면 그 사람은 평균보다 키가 크고 몸이 마른 편이라 볼 수 있습니다.
  • 이 방법은 데이터를 다소 평평하게 하는(로그보다는 덜하지만 데이터의 진폭을 줄이는) 특성을 가집니다. 이 방법을 적용하면 간극이 줄어드는 효과가 발생하여 고객별 매출금액과 같이 간극이 큰 데이터의 간극을 줄이는 결과를 얻게 됩니다. 그 결과 분석 대상 고객군을 정하는 데 (약간의) 편의성을 제공하게 됩니다. 

 

 

정규화 (Normalization)

  • 수식 : (요소값-최소값) / (최대값-최소값)
  • 정규화는 전체 구간을 0~100으로 설정하여 데이터를 관찰하는 방법입니다.
  • 이 방법은 데이터 군 내에서 특정 데이터가 가지는 위치를 볼 때 사용합니다. 
  • 시세와 같이 주기를 띄는 데이터의 경우 과거 대비 현재 데이터의 위치를 파악하기에 용이합니다. 

 

Conclusions

  • Experiment with multiple scaling methods can dramatically increase your score on classification tasks, even when you hyperparameters are tuned. So, you should consider the scaling method as an important hyperparameter of your model.
  • Scaling methods affect differently on different classifiers. Distance-based classifiers like SVM, KNN, and MLP(neural network) dramatically benefit from scaling. But even trees (CART, RF), that are agnostic to some of the scaling methods, can benefit from other methods.
  • Knowing the underlying math behind models\preprocessing methods is the best way to understand the results. (For example, how trees work and why some of the scaling methods didn’t affect them). It can also save you a lot of time if you know no to apply StandardScaler when your model is Random Forest.
  • Preprocessing methods like PCA that known to be benefited from scaling, do benefit from scaling. When it doesn’t, it might be due to a bad setup of the number of components parameter of PCA, outliers in the data or a bad choice of a scaling method.

 

S.NO Normalization Standardization
1. Minimum and maximum value of features are used for scaling Mean and standard deviation is used for scaling.
2. It is used when features are of different scales. It is used when we want to ensure zero mean and unit standard deviation.
3. Scales values between [0, 1] or [-1, 1]. It is not bounded to a certain range.
4. It is really affected by outliers. It is much less affected by outliers.
5. Scikit-Learn provides a transformer called MinMaxScaler for Normalization. Scikit-Learn provides a transformer called StandardScaler for standardization.
6. This transformation squishes the n-dimensional data into an n-dimensional unit hypercube. It translates the data to the mean vector of original data to the origin and squishes or expands.
7. It is useful when we don’t know about the distribution It is useful when the feature distribution is Normal or Gaussian.
8. It is a often called as Scaling Normalization It is a often called as Z-Score Normalization.

 

 

 

 

[참조] 초보자를 위한 통계 기초 https://brunch.co.kr/@rapaellee/4] 를 가져온 것 입니다.

https://towardsdatascience.com/normalization-vs-standardization-quantitative-analysis-a91e8a79cebf

 

Normalization vs Standardization — Quantitative analysis

Stop using StandardScaler from Sklearn as a default feature scaling method can get you a boost of 7% in accuracy!

towardsdatascience.com

https://www.geeksforgeeks.org/normalization-vs-standardization/

 

Normalization vs Standardization - GeeksforGeeks

A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

www.geeksforgeeks.org

https://heeya-stupidbutstudying.tistory.com/entry/%ED%86%B5%EA%B3%84-%EC%A0%95%EA%B7%9C%ED%99%94%EC%99%80-%ED%91%9C%EC%A4%80%ED%99%94

 

[통계] 정규화(Normalization) vs 표준화(Standardization)

ML을 공부하는 사람이라면 feature scaling이 얼마나 중요한 지 알것이다. scikit-learn에는 많은 스케일링 메서드들이 모듈화 되어있는데, 기본적으로 정규화와 표준화가 무엇인지 이해해야 과제를 수

heeya-stupidbutstudying.tistory.com

 

반응형