我刚刚完成了一个基于树的建模的gridsearch CV,在查看结果之后,我设法从gridsearchCV中访问每个迭代的结果。在
我需要每个运行到一个单独的行和每个参数在一个单独的列。 我可以对每一行运行一个循环或列表理解,但无法将每个运行分隔成列
df = grid.grid_scores_
df[0]
mean: 0.57114, std: 0.00907, params: {'criterion': 'gini', 'max_depth': 10,
'max_features': 8, 'min_samples_leaf': 2, 'min_samples_split': 2, 'splitter': 'best'}`
我尝试使用tuple和dict附件,但最终出现了错误。基本上,我需要一个新列中的每个参数,如下所示。在
^{pr2}$
您可以使用预先生成的class to generate a DataFrame with a report of the parameters(请参阅stackoverflow post using this codehere)
导入和settings
生成一些数据
^{pr2}$定义模型和超参数网格
执行网格搜索(使用CV)并报告结果
这是输出
相关问题 更多 >
编程相关推荐