LoginSignup
1

More than 3 years have passed since last update.

Borutaが使うCPUスレッド数を指定する(Python版)

Last updated at Posted at 2019-10-06

はじめに

前回、R版の「Borutaが使うCPUスレッド数を指定する」を書いたが、Python版で同じことをしたいときの話

環境

  • Python 3.X
  • Boruta 0.3

やり方

Borutaのクラスにそのような引数はなかったため、Borutaに与える予測器側のスレッド数をn_jobsで指定する。

以下はコード断片である。Borutaに与えるRandomForestRegressorのn_jobsを指定している。
これをうまく調整することによって、Borutaで特徴選択中に他の作業が何もできないという事態は防ぐことができる。

rf = RandomForestRegressor(n_jobs=10, max_depth=5)
feat_selector = BorutaPy(rf, n_estimators='auto', verbose=3, random_state=100, max_iter=30)
feat_selector.fit(x, y)

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