我目前正在研究随机森林分类器,使用 gridsearch 来获得最佳参数
所以当我得到我的参数时,它们在我的 var 中:
params = {'bootstrap': 'True',
'criterion': 'entropy',
'max_depth': 'None',
'max_features': '3',
'min_samples_leaf': '4',
'min_samples_split': '3'}
Run Code Online (Sandbox Code Playgroud)
我想做这样的事情:
clf = RandomForestClassifier(params)
但是这里params代替了n_estimators所以我有一些错误,例如:
ValueError: n_estimators must be an integer, got <class 'dict'>.
Run Code Online (Sandbox Code Playgroud)