【发布时间】:2018-02-24 08:45:18
【问题描述】:
我正在阅读有关使用 GridSearchCV 微调模型的信息,我遇到了如下所示的参数网格:
param_grid = [
{'n_estimators': [3, 10, 30], 'max_features': [2, 4, 6, 8]},
{'bootstrap': [False], 'n_estimators': [3, 10], 'max_features': [2, 3, 4]},
]
forest_reg = RandomForestRegressor(random_state=42)
# train across 5 folds, that's a total of (12+6)*5=90 rounds of training
grid_search = GridSearchCV(forest_reg, param_grid, cv=5,
scoring='neg_mean_squared_error')
grid_search.fit(housing_prepared, housing_labels)
这里我没有得到 n_estimator 和 max_feature 的概念。是否像 n_estimator 表示数据中的记录数而 max_features 表示要从数据中选择的属性数?
在走得更远之后,我得到了这个结果:
>> grid_search.best_params_
{'max_feature':8, 'n_estimator':30}
所以问题是我没有得到这个结果实际上想说的......
【问题讨论】:
-
请阅读文档:RandomForestRegressor 和 user guide
标签: scikit-learn