# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # [Preprocessing data](https://scikit-learn.org/stable/modules/preprocessing.html)

# ## Scale
# * 각 컬럼의 평균이 0이 되고, 표준편차가 1이 되게 함

from sklearn import preprocessing
import numpy as np
X_train = np.array([[ 1., -1.,  2.],
                     [ 2.,  0.,  0.],
                     [ 0.,  1., -1.]])
X_train

# +
X_scaled = preprocessing.scale(X_train,axis=0)

X_scaled
# -

X_scaled.mean(axis=0)

X_scaled.std(axis=0)

# # Normalization
# * 값을 고르게 분포 시킴
# * Concept 
#   - http://hleecaster.com/ml-normalization-concept/
#   - https://developers.google.com/machine-learning/crash-course/regularization-for-simplicity/l2-regularization?hl=ko
#
#

X = [[ 1., -1.,  2.],
     [ 2.,  0.,  0.],
     [ 0.,  1., -1.]]
X_normalized = preprocessing.normalize(X, norm='l2')
X_normalized


# +

X_normalized.sum(axis=0)

# -

X_normalized.std(axis=0)

StarcoderdataJupyterScriptsDedupFiltered