Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sklearn: How to reset a Regressor or classifier object in sknn

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)

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?

like image 449
RawMean Avatar asked Oct 02 '15 21:10

RawMean


1 Answers

sklearn.base.clone should achieve what you're looking to achieve

like image 53
dan_g Avatar answered Oct 16 '22 20:10

dan_g