2
$\begingroup$

I am currently developing a classifier with online/incremental learning. I am using scikit to create the model and run partial_fit after an initial training of the model. If their is a new class, or there is no model already, I run:

clf = SGDClassifier(loss="log", penalty="l1", average=True)
clf.fit(X, Y)

and if there is only new data on classes that have already been initially trained, I run:

clf = joblib.load(output_file)  # load already trained model
clf.partial_fit(X, Y)

For both of these methods of training I then run:

joblib.dump(clf, output_file) # save model

I currently am receiving manual feedback on a classification when predicting:

clf = joblib.load(output_file) # load model
clf.predict(X1)

I want the model to learn from its mistakes by retraining the model with the X1 data when it got the prediction wrong. Is it sufficient to just rerun clf.partial_fit(X1, Y) with the manual classification or would it be better to perhaps give it a heavier sample weight so it really makes sure it doesn't make that mistake again? Although all X training data in the first place will be manually classified and 100% accurate.


Edit

Moderators please may you at least explain what you do not understand?

$\endgroup$

closed as unclear what you're asking by Michael Chernick, Peter Flom Mar 30 '18 at 13:21

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ What is unclear? do I give a higher sample weight to data that was previously misclassified when retraining a model? Simples :) $\endgroup$ – maxisme Mar 30 '18 at 13:46
  • $\begingroup$ I didn't vote on this, but it appears to be only about code, which is generally off topic here. This may be an on topic machine learning question, but it is asked only in Scikit-learn code, that I don't read. Perhaps you could rewrite your question in a software-neutral way that makes the question easier to understand by people who don't use Python, & make clear that you aren't asking for code help. $\endgroup$ – gung Apr 2 '18 at 13:17