How can I get iteration in sklearn MLPClassifier while using partial_fit()
?
I tried using partial_fit
again and again on same batch of data, but Every time sklearn counts it as a new thing. Here is the part of my code:
for batch_start in range(0, X.shape[0], batch_size):
iterationss=iterationss+1
batch_end = min(batch_start + batch_size, X.shape[0])
batch_X = X[batch_start:batch_end]
batch_y = responses[batch_start:batch_end]
for iii in range(max_iter):
clf.partial_fit(batch_X, batch_y,classes=np.unique(responses))
joblib.dump(clf,"clf_chatbot.pkl")
print("Fitted till %d and saved."%(iterations*batch_size))
But output was like: (on windows 10 64 bit, python 3.10 amd 64)
Iteration 1, loss = 11.39555463
Iteration 1, loss = 11.35046939
Iteration 1, loss = 11.28887876
Iteration 1, loss = 11.18390311
Iteration 1, loss = 10.98991956
Iteration 1, loss = 10.64000362
Iteration 1, loss = 10.04894330
Iteration 1, loss = 9.14103649
Iteration 1, loss = 8.02487529
Iteration 1, loss = 7.25677016
Iteration 1, loss = 7.02518236
Iteration 1, loss = 6.98103370
Iteration 1, loss = 6.98184770
Iteration 1, loss = 7.00211247
Iteration 1, loss = 7.03137822
Iteration 1, loss = 7.05796926
Iteration 1, loss = 7.07287387
Iteration 1, loss = 7.07502399
Iteration 1, loss = 7.06933910
Iteration 1, loss = 7.06131838
Iteration 1, loss = 7.05424598
Iteration 1, loss = 7.04926004
Iteration 1, loss = 7.04628450
Training loss did not improve more than tol=0.000100 for 10 consecutive epochs. Stopping.
Iteration 1, loss = 7.04474045
Training loss did not improve more than tol=0.000100 for 10 consecutive epochs. Stopping.
Iteration 1, loss = 7.04394393
Training loss did not improve more than tol=0.000100 for 10 consecutive epochs. Stopping.
Iteration 1, loss = 7.04331604
Training loss did not improve more than tol=0.000100 for 10 consecutive epochs. Stopping.
Iteration 1, loss = 7.04245835
Training loss did not improve more than tol=0.000100 for 10 consecutive epochs. Stopping.
Iteration 1, loss = 7.04114971
Training loss did not improve more than tol=0.000100 for 10 consecutive epochs. Stopping.
Iteration 1, loss = 7.03933200
Expected Output: (Which i am getting, but only on my android run using "pydroid3" app. exact files and code and all)
Iteration 1,..
Iteration 2,..
...
Why is my iteration always counting as first iteration on windows? How can I fix it?
Please notice that this question is not a duplicate of How to increase the number of iterations to optimize my cost function at each step using partial_fit at Scikit SGDClassifier? . My problem is not solved with the solution proposed there.