はじめに
sklearnのdatasets.make_classification
でクラスタリング用のデータを作成することができる。データポイントは基本的にガウス分布に従い生成する。ここでは各種パラメータが生成データに及ぼす影響について説明する。
解説
モジュールのインポートなど
バージョン
n_samples
n_samplesを変化させることでサンプル数を変えることができる。

n_features
n_featuresを変えることデータセットの列数を変えることができる。
n_informative & n_redundant
n_informativeは相関が強い特徴量の数で、n_redundantはn_informativeのものと線形結合になるものの数となる。

n_clusters_per_class
n_clusters_per_classは1クラスあたりのクラスターの数となる。

n_classes
n_clustersはクラス数となる。

random_state
random_stateを変えることで再現可能な乱数を生成することができる。

weights
weightsをリスト形式で設定することでデータポイント数の比率を変えることができる。

flip_y
flip_yをエラー生成のためにデータポイントのラベルを入れ替える機能で、0.1とすれば10%のデータのラベルが入れ替わる。デフォルト値は0.01。

class_sep
値を大きくすると、クラス間がより分離するようになる。

shift
shiftの値を全てのデータに加えることになる。

scale
scaleの値を全てのデータに乗ずることになる。

shuffle
shuffleをFalseとすることでラベルがソートされたデータを得ることができる。デフォルトはTrue.
コードをダウンロード(.pyファイル) コードをダウンロード(.ipynbファイル)参考

make_classification
Gallery examples: Release Highlights for scikit-learn 1.6 Release Highlights for scikit-learn 1.5 Release Highlights for...
コメント