【发布时间】:2017-03-14 04:44:01
【问题描述】:
我在使用 Weka 对整个训练集进行超参数调整时使用 k 折交叉验证,它显示了交叉验证的平均精度、召回率和 f1。我想在 python 中使用 Sklearn 获得相同的结果。
cv = StratifiedShuffleSplit(n_splits=5, test_size=0.2, random_state=42)
grid = GridSearchCV(LinearSVC(), param_grid=param_grid, cv=cv)
grid.fit(X_train, y_train)
# print the best parameters
print("The best parameters are %s with a score of %0.5f"
% (grid.best_params_, grid.best_score_))
# print the average precision, recall, f1, accuracy of cross
# validation with the best parameters found
???
有人可以帮忙吗?
【问题讨论】:
标签: python scikit-learn cross-validation