Reputation: 3
Does a Sklearn model's .fit () method reset the weights on each call? Does the pice of code below its all right? I saw it somewhere for cross validation and I dont know if it makes sense.
from sklearn.neural_network import MLPRegressor
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split
X, y = make_regression(n_samples=200)
regr = MLPRegressor(solver='sgd', max_iter=150)
for i in range(5):
X_train, X_test, y_train, y_test = train_test_split(X, y)
regr.fit(X_train, y_train)
Thank you.
Upvotes: 0
Views: 320
Reputation: 425
Yes, it resets the weights, as you can see here on the documentation
Calling fit() more than once will overwrite what was learned by any previous fit()
Upvotes: 1