Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Feature Engineering

Scaling

Compare the effect of different scalers on data with outliers — scikit-learn documentation

Min-Max scaling

  • [0,1][0, 1]の範囲に変換する。

  • 線形変換のためデータの分布・相対的な位置関係は変化しない。

Standardization

  • 平均0、分散1に変換する。

  • 線形変換のためデータの分布・相対的な位置関係は変化しない。

Power Transformation

  • 対数変換の一般化

  • Box-Cox Transformは正の値しか受け付けないが、Yeo-Johnson transformは負の値も扱える

  • 非線形変換のためデータの分布は変化する

Encoding Categorical Features

カテゴリカル変数を数値に変換する方法について。

One-Hot Encoding

  • カテゴリカル変数の値の水準の数KKだけ列を作り、二値で表現するx{0,1}Kx \in \{0,1\}^K。1レコード(xi1,xi2,,xiK)(x_{i1}, x_{i2}, \dots, x_{iK})につき1つのみ1をとり、ほかは0をとる

  • 回帰分析におけるダミー変数はK1K-1個の列を作るので少し異なる

Label Encoding

  • カテゴリを対応する整数に置き換える。class A = 1, class B = 2, ... という感じ

Target Encoding

  • カテゴリごとに条件づけたもとでの目的変数の集計値(例えば平均値)を使う

Domain-Specific Feature Engineering

返済比率などドメイン固有の特徴量

(※データサイエンティスト協会スキルチェックシートの項目の一つが「ドメイン固有の特徴量を生成できる」)

参考