Sklearn model keeps increasing in size

Viewed 62

I'm using a simple neural network to predict three outputs. My model is MultiOutputRegressor(MLPRegressor())

I'm training the model with one example at a time with partial_fit method.

However, when using pickle.dump to save the model, the size of the model keeps increasing over time. The more examples I train with, the larger the model size.

Neural network with adam optimizer should remain constant size. So why does it keep increasing?

Here's a reproducible example:

import os
import pickle
from os.path import dirname, join

from sklearn.multioutput import MultiOutputRegressor
from sklearn.neural_network import MLPRegressor

path = join(dirname(__file__), "test.p")

m = MultiOutputRegressor(MLPRegressor())
for _ in range(10):
    for _ in range(1000):
        m.partial_fit([[0,0,0,0,0,0]],[[0,0,0]])
    with open(path, "wb") as f:
        pickle.dump(m, f)
    print(os.stat(path).st_size)

output

157501
250507
343513
436519
529525
622531
715537
808543
901549
994555
0 Answers
Related