NotFittedError#
- exceptionsklearn.exceptions.NotFittedError[source]#
Exception class to raise if estimator is used before fitting.
This class inherits from both ValueError and AttributeError to help withexception handling and backward compatibility.
Examples
>>>fromsklearn.svmimportLinearSVC>>>fromsklearn.exceptionsimportNotFittedError>>>try:...LinearSVC().predict([[1,2],[2,3],[3,4]])...exceptNotFittedErrorase:...print(repr(e))NotFittedError("This LinearSVC instance is not fitted yet. Call 'fit' withappropriate arguments before using this estimator."...)
Changed in version 0.18:Moved from sklearn.utils.validation.
On this page
