Search code examples
pythonmachine-learningscikit-learnlogistic-regression

Python SK Learn: Is it posible to feed several sets of data to "SGDClassifier" from sk learn to update parameters


I'd like to split my data set in to a little chuck due to limitation of my software and feed to Stochastic Gradient Descent (SGD) Logistic-Regression. Is it possible to do this in "SGDClassifier" class from sk learn. I skimmed though docs but it looked like it didn't mention it and no example, either. So, I would like to know before having to implement it on my own. Any thought will be appreciated.

I'll be thankful once again if you can point me out to docs which mention this.


Solution

  • Yes, call the partial_fit function for every "batch" you read into memory, it will update the model with that "batch".

    There is a similar example using the partial_fit function of MiniBatchKMeans here.