我正在尝试为一个定制的无监督模型的sklearn管道寻找最佳的超参数配置,它将我的数据转换成向量表示,然后在随机森林分类器中用来预测标签。然而,当我使用Sklearn的随机搜索时,我经常得到不同的结果,因为所有分割的训练/测试分数完全相同,即使HP组合不同。在
令人困惑的是,当我在参数网格中只给出很少的值时(例如,对于n_估计值,只给出[1,10]而不是list(range(1,10)),这种情况就不会发生。在
我的网格如下所示:
param_grid = dict(n2vec__dim=list(range(16,266)),
n2vec__p=[0.5,1,1.5,2],
n2vec__path_length=list(range(1,26)),
n2vec__num_paths=list(range(1,20)),
n2vec__q=[0.5,1,1.5,2],
randomforestclassifier__n_estimators=[5,10,20],
randomforestclassifier__criterion=['gini','entropy'],
randomforestclassifier__max_features=['auto',None,'log2'],
randomforestclassifier__min_samples_split =[2,2,3,5,6,7,8,9],
randomforestclassifier__min_samples_leaf =[1,5],
randomforestclassifier__min_impurity_decrease =[0,1,20])
grid_search = RandomizedSearchCV(pipe, param_distributions=param_grid, n_iter=5,
scoring='f1_micro',return_train_score=True, n_jobs=4)
有人知道这是什么原因吗?在
任何帮助都将不胜感激。在
目前没有回答
相关问题 更多 >
编程相关推荐