本文介绍了sklearn:如何在sknn中重置Regressor或分类器对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经定义了一个回归器,如下所示:
I have defined a regressor as follows:
nn1 = Regressor(
layers=[
Layer("Rectifier", units=150),
Layer("Rectifier", units=100),
Layer("Linear")],
regularize="L2",
# dropout_rate=0.25,
learning_rate=0.01,
valid_size=0.1,
learning_rule="adagrad",
verbose=False,
weight_decay=0.00030,
n_stable=10,
f_stable=0.00010,
n_iter=200)
我正在k折交叉验证中使用此回归器.为了使交叉验证正常工作并且不从先前的折叠中学习,必须在每次折叠后重置回归器.
如何重置回归对象?
I am using this regressor in a k-fold cross-validation. In order for cross-validation to work properly and not learn from the previous folds, it's necessary that the regressor to be reset after each fold.
How can I reset the regressor object?
推荐答案
sklearn.base.clone 应该可以实现您想要的目标
sklearn.base.clone should achieve what you're looking to achieve
这篇关于sklearn:如何在sknn中重置Regressor或分类器对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!