Exception class to raise if estimator is used before fitting. This class inherits from both ValueError and AttributeError to help with exception handling and backward compatibility. Examples -------- >>> from sklearn.svm import LinearSVC >>> from sklearn.exceptions import N
| 44 | |
| 45 | |
| 46 | class NotFittedError(ValueError, AttributeError): |
| 47 | """Exception class to raise if estimator is used before fitting. |
| 48 | |
| 49 | This class inherits from both ValueError and AttributeError to help with |
| 50 | exception handling and backward compatibility. |
| 51 | |
| 52 | Examples |
| 53 | -------- |
| 54 | >>> from sklearn.svm import LinearSVC |
| 55 | >>> from sklearn.exceptions import NotFittedError |
| 56 | >>> try: |
| 57 | ... LinearSVC().predict([[1, 2], [2, 3], [3, 4]]) |
| 58 | ... except NotFittedError as e: |
| 59 | ... print(repr(e)) |
| 60 | NotFittedError("This LinearSVC instance is not fitted yet. Call 'fit' with |
| 61 | appropriate arguments before using this estimator."...) |
| 62 | |
| 63 | .. versionchanged:: 0.18 |
| 64 | Moved from sklearn.utils.validation. |
| 65 | """ |
| 66 | |
| 67 | |
| 68 | class ConvergenceWarning(UserWarning): |
no outgoing calls
no test coverage detected
searching dependent graphs…