1
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

機械学習モデルの自動構築・比較ができるPythonライブラリまとめ

Posted at

機械学習モデルの自動構築・比較ができるPythonライブラリまとめ

機械学習のプロジェクト(kaggle)で「複数のモデルを一括で構築・比較したい」と思ったことはありませんか?初心者の方にも分かりやすく,主要なAutoML(自動機械学習)ライブラリを紹介します。どれも数行のコードでモデルの学習・評価・比較ができ,作業効率を大幅にアップできます.


1. PyCaret

概要: 機械学習作業を簡単にするオープンソースライブラリ.分類・回帰・クラスタリング・異常検知など幅広く対応.

PyCaretの主な特徴

  • 迅速なプロトタイピング
  • モデル選定やハイパーパラメータの自動チューニング
  • シンプルなAPI

PyCaretのサンプルコード

from pycaret.classification import *
clf = setup(data=df, target='target')
best_model = compare_models()

公式サイト


2. MLJAR AutoML (mljar-supervised)

概要: 最小限のコードで複数モデルを自動比較.訓練・評価・特徴量重要度の解析も可能.

MLJAR AutoMLの主な特徴

  • モデル比較と分かりやすい出力
  • 高度な自動ハイパーパラメータチューニング
  • 回帰・分類に対応

MLJAR AutoMLのサンプルコード

from supervised.automl import AutoML
automl = AutoML(results_path="AutoML_results")
automl.fit(X_train, y_train)

公式サイト


3. H2O AutoML

概要: 大規模分散処理にも対応した機械学習プラットフォーム.Python APIから簡単に利用可能.

H2O AutoMLの主な特徴

  • クラスタリング・回帰・分類に対応
  • 分散計算に最適化
  • 集成モデルの自動生成

H2O AutoMLのサンプルコード

import h2o
from h2o.automl import H2OAutoML
h2o.init()
aml = H2OAutoML(max_models=10, seed=1)
aml.train(x=train.columns[:-1], y='target', training_frame=train)

公式サイト


4. auto-sklearn

概要: Scikit-learnベースのAutoML.多くのモデルとハイパーパラメータを自動探索.

auto-sklearnの主な特徴

  • Scikit-learnとの統合が容易
  • 特徴量の前処理も自動

auto-sklearnのサンプルコード

import autosklearn.classification
automl = autosklearn.classification.AutoSklearnClassifier()
automl.fit(X_train, y_train)
print(automl.show_models())

公式サイト


5. EvalML

概要: モデルと特徴量エンジニアリングの比較・最適化ができるAutoML.

EvalMLの主な特徴

  • 機械学習タスクと時系列データのサポート
  • モデルのパイプライン化が可能

EvalMLのサンプルコード

from evalml import AutoMLSearch
automl = AutoMLSearch(X_train=X_train, y_train=y_train, problem_type='binary')
automl.search()
best_pipeline = automl.best_pipeline

公式サイト


6. TPOT (Tree-based Pipeline Optimization Tool)

概要: 遺伝的アルゴリズムでモデル探索・最適化を行うAutoML.

TPOTの主な特徴

  • MLパイプラインの自動生成と最適化
  • Scikit-learnとの統合

TPOTのサンプルコード

from tpot import TPOTClassifier
tpot = TPOTClassifier(generations=5, population_size=50, verbosity=2)
tpot.fit(X_train, y_train)
tpot.export('tpot_pipeline.py')

公式サイト


まとめ・選び方のコツ

どのライブラリも,短いコードで効率的に多くのモデルを比較できます.プロジェクトの目的やデータの特徴に合わせて最適なものを選びましょう!

1
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?