スケーリングと変換

Python で学ぶ Machine Learning のための特徴量エンジニアリング

Robert O'Callaghan

Data Scientist

データのスケーリング

Python で学ぶ Machine Learning のための特徴量エンジニアリング

Min-Maxスケーリング

Min-Max 縮小

Python で学ぶ Machine Learning のための特徴量エンジニアリング

Min-Maxスケーリング

Python で学ぶ Machine Learning のための特徴量エンジニアリング

PythonでのMin-Maxスケーリング

from sklearn.preprocessing import MinMaxScaler

scaler = MinMaxScaler()

scaler.fit(df[['Age']])

df['normalized_age'] = scaler.transform(df[['Age']])
Python で学ぶ Machine Learning のための特徴量エンジニアリング

標準化

Python で学ぶ Machine Learning のための特徴量エンジニアリング

Pythonでの標準化

from sklearn.preprocessing import StandardScaler

scaler = StandardScaler()

scaler.fit(df[['Age']])

df['standardized_col'] = scaler\
                        .transform(df[['Age']])
Python で学ぶ Machine Learning のための特徴量エンジニアリング

対数変換

対数の図

Python で学ぶ Machine Learning のための特徴量エンジニアリング

Pythonでの対数変換

from sklearn.preprocessing import PowerTransformer

log = PowerTransformer()

log.fit(df[['ConvertedSalary']])

df['log_ConvertedSalary'] = 
     log.transform(df[['ConvertedSalary']])
Python で学ぶ Machine Learning のための特徴量エンジニアリング

最終スライド

Python で学ぶ Machine Learning のための特徴量エンジニアリング

Preparing Video For Download...