0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[WIP] GridSearchを使えるようになる

Posted at

機械学習のハイパーパラメータを最適化するために、最適な値を総当たりする手法です。

インタフェース

class sklearn.model_selection.GridSearchCV(
estimator, 
param_grid, 
scoring=None, 
fit_params=None, 
n_jobs=1, 
iid=True, 
refit=True, 
cv=None, 
verbose=0, 
pre_dispatch=‘2*n_jobs’, 
error_score=’raise’, return_train_score=’warn’)

パラメータ

  • estimator
    • ここに、学習に用いる予測器を渡します
  • param_grid
    • 組み合わせ最適化に渡す値を入力します
  • n_jobs
    • 並行実行が可能
  • cv
    • クロスバリデーションの値
    • 指定した値で k-fold が実行される

結果を見るには

  • best_estimator_
    • GridSearchで選ばれた予測器を返します
  • best_score_
    • 最も良い予測器のスコアの中央値を返します
  • best_params_
    • 最も良いパラメータセットを辞書形式で返します

最適化を実行

GridSearchCV

なにがアウトプットされるのか?

clf.grid_scores_

clf.best_params_
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?