max_depth
の最適なパラメータを見つけようとしているとしましょうRandomForestClassifier
。使用していRandomizedSearchCV
ます:
from scipy.stats import randint as sp_randint
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import RandomizedSearchCV
rf_params = { # Is this somehow possible?
'max_depth': [sp_randint(1, 100), None],
}
n_iter = 10
random_search = RandomizedSearchCV(RandomForestClassifier(),
verbose=50,
param_distributions=rf_params,
n_iter=n_iter,
n_jobs=-1,
scoring='f1_micro')
random_search.fit(X_train, y_train)
RandomizedSearchCV
指定された分布から選択するか、(ドキュメントのように)sp_randint(1, 100)
パラメータを設定するように指示することは可能ですか?None
今このコードを実行すると、次のエラーが発生します。