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

What will GridsearchCV choose if there are multiple estimators having the same score?

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

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

GridSearchCV 不评估模型的复杂性(尽管那将是一个很好的功能)。它也不会随机选择最好的模型。

相反,GridSearchCV 只是对存储的错误执行 np.argmin()。请参阅 source code.

中的相应行

现在,根据 NumPy docs

In case of multiple occurrences of the minimum values, the indices corresponding to the first occurrence are returned.

也就是说,GridSearchCV总是select最好的模型中的第一个。