Skip to main content
 首页 » 编程设计

python之Scikit 学习交叉验证拆分

2025年05月04日14dyllove98

我目前正在使用 cross_validation.cross_val_predict 来获取 LogisticRegression 分类器所做的预测。我的问题是:训练集的数据百分比是多少,测试集的数据百分比是多少?是 80%-20% 的拆分吗?

我检查了网站和 stackoverflow 上的其他问题,但没有找到我的问题的答案。

请您参考如下方法:

在documentation for this function ,它为 cv arg 声明:

cv : cross-validation generator or int, optional, default: None A cross-validation generator to use. If int, determines the number of folds in StratifiedKFold if y is binary or multiclass and estimator is a classifier, or the number of folds in KFold otherwise. If None, it is equivalent to cv=3. This generator must include all elements in the test set exactly once. Otherwise, a ValueError is raised.