问题标签 [gridsearchcv]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
175 浏览

python - GridSearchCV 信号量或锁释放次数过多

我最初在 Windows PC 上开发了我的代码,一切运行良好。然而,我们已经开始减载,所以我需要一个可移植的 python 开发环境,所以我设置了一个带有 VSCode 的 SLAX 9.8 usb,以便在电源故障时继续我的开发。

但是现在,在 USB 上运行工作代码时,它会失败并出现以下错误: 在此处输入图像描述

任何帮助,将不胜感激。

快速谷歌搜索说这是一个joblib错误并设置prefer="threads"。如果这能解决它,我会在哪里做呢?

谢谢你们

0 投票
1 回答
1616 浏览

machine-learning - GridSearchCV 及其特征重要性

在 gridsearchCV 中,当我适合如下内容时:

之后,当我执行此操作时,

它给出了一个值数组,所以我的问题是GridSearch.best_estimator_.feature_importances_这条线返回什么值?

0 投票
1 回答
35 浏览

python - 为什么 GridSearchCv 在相同的代码中表现不同

我正在尝试调用 GridSearchCV 以获得最佳估计器,如果我调用这样的参数

结果将是

对于相同的数据,结果会有所不同我只将 [2,3,4,5,6,7,8,9,10] 更改为 [2,4,6,8,10]

结果

对 GridsearchCV 的工作原理感到困惑

0 投票
1 回答
55 浏览

scikit-learn - 如果有多个具有相同分数的估计器,GridsearchCV 会选择什么?

我在 sklearn 中使用 RandomForestClassifier,并使用 GridsearchCV 来获得最佳估计器。

我想知道当 GridsearchCV 中有许多具有相同分数的估计器(从简单到复杂的)时,GridsearchCV 的结果估计器是什么?最简单的?还是随机的?

0 投票
1 回答
831 浏览

python - 参数不会用于 scikit-learn GridSearchCV 中的自定义估计器

我正在尝试将参数传递给 scikit learn 中的自定义估计器,但未能成功。我希望lr在网格搜索期间更改参数。问题是lr参数没有改变......

代码示例从此处复制和更新

(原始代码对我不起作用)

任何带有自定义估计器的完整工作示例GridSearchCV,以及更改参数将不胜感激。

我在ubuntu18.10 使用scikit-learn0.20.2

Terveisin,马库斯

0 投票
1 回答
1784 浏览

python - 如何使用 LightGBM 在 GridSearchCV 的每次迭代中保存每个预测结果

我正在尝试使用 GridSearchCV 来调整 LightGBM 模型中的参数,但我对如何在 GridSearchCV 的每次迭代中保存每个预测结果还不够熟悉。
但可悲的是,我只知道如何将结果保存在特定参数中。
这是代码:

这是数据:

我想保存predictionsGridSearchCV 的每次迭代,我已经搜索了几个类似的问题以及在 LightGBM 中使用 GridSearchCV 的一些其他相关信息。
但我仍然无法正确编码。
所以,如果不介意,有人可以帮助我并提供一些关于它的教程吗?
衷心感谢。

0 投票
2 回答
576 浏览

scikit-learn - 使用 Gridsearch 降低回归得分

我是 scikit learn 的新手,所以请原谅我的无知。使用 GridsearchCV 我正在尝试优化 DecisionTreeRegressor。我使参数空间越宽,得分就越差。

将 min_samples_split 设置为 range(2,10) 会给我一个 -0.04 的 neg_mean_squared_error。将其设置为 range(2,5) 时,得分为 -0.004。

与不太广泛的网格搜索相比,我希望更广泛的网格搜索获得相等或更高的正分数。

0 投票
0 回答
956 浏览

python - 尝试使用 GridSearchCV sklearn 拟合 X、y 时出现网格搜索交叉验证错误

Python sci-kit学习KNN Grid Search Cross Validation错误

我正在尝试重新创建 KNN 模型来预测汽车目的地。 https://github.com/carlosbkm/car-destination-prediction 代码在此处的网格搜索交叉验证中不起作用: https ://github.com/carlosbkm/car-destination-prediction/blob/master/k-nearest -model.ipynb 起初 geodash 不工作,所以我将其切换到 geodash2 并且没有问题。当我尝试拟合我得到的模型时。TypeError:不支持的操作数类型/:'str'和'int'

当我尝试为网格搜索交叉验证拟合 X 和 y 时,出现错误。问题来自

我无法将模型拟合到 X 和 y:gs.fit(X, y)

我试图将 X 和 y 变成浮点数,但没有任何改变

当我执行这个:

我得到:

0 投票
1 回答
768 浏览

python - AUC score of gridsearch cv of best_score_ is different from auc_roc_score from best model of gridsearch cv

I did a grid search on a logistic regression and set scoring to 'roc_auc'. The grid_clf1.best_score_ gave me an auc of 0.7557. After that I wanted to plot the ROC curve of the best model. The ROC curve I saw had an AUC of 0.50 I do not understand this at all.

I looked into the predicted probabilites and I saw that they were all 0.0 or 1.0. Hence, I think something went wrong here but I cannot find what it is.

My code is as follows for the grid search cv:

So this gave an AUC of 0.7557 for the best model. Then if I calculate the AUC for the model myself:

This gave me an AUC of 0.50.

0 投票
1 回答
12187 浏览

python - GridSearchCV 没有属性 grid.grid_scores_

试过 grid.cv_results_ 没有纠正问题

尝试替换grid.grid_scores_grid.cv_results_ 目标是打印不同的超参数值组合和通过 10 倍交叉验证计算的平均 ROC AUC 分数