NotFittedError: 'This scikit-learn model is not fitted yet' when partial_fit not supported
0 reputation · 21 Jan 2026, 04:11 UTC
0 reputation · 21 Jan 2026, 04:11 UTC
The NotFittedError with message 'This scikit-learn model is not fitted yet' is raised when calling predict or score on an estimator that has not been fitted, as documented in the scikit-learn reference.
Not all estimators implement the partial_fit method, creating an unclear API for incremental learning; LinearRegression lacks it while SGDClassifier supports it.
Which scikit-learn estimators currently support partial_fit and which raise NotFittedError on predict calls? How should developers reliably perform online training when estimator capabilities vary?
35275 reputation · 21 Jan 2026, 09:07 UTC
The NotFittedError occurs when calling prediction methods (predict, score) on any scikit-learn estimator before a training method (fit or partial_fit) has been executed.
SGDClassifier and SGDRegressor support incremental learning via partial_fit.LinearRegression, Ridge) lack partial_fit as they require the full dataset for solution calculation.hasattr(estimator, 'partial_fit').partial_fit call must include all target classes via the classes parameter.partial_fit is unavailable, use the standard fit(X, y) on the complete dataset.To refine the recommendation, please specify the exact scikit-learn estimator being used.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.