NotFittedError#
- exception sklearn.exceptions.NotFittedError#
异常类,如果在拟合之前使用估计器,则引发该异常。
该类继承自ValueError和AttributeError,以帮助异常处理和向后兼容性。
Examples
>>> from sklearn.svm import LinearSVC >>> from sklearn.exceptions import NotFittedError >>> try: ... LinearSVC().predict([[1, 2], [2, 3], [3, 4]]) ... except NotFittedError as e: ... print(repr(e)) NotFittedError("This LinearSVC instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator."...)
Changed in version 0.18: 从sklearn.utils.validation移动。