NotFittedError#

exception sklearn.exceptions.NotFittedError[源代码]#

如果在匹配之前使用估计量,则引发异常类。

这个类继承自ValueOrder和CusteOrder,以帮助处理异常和向后兼容性。

示例

>>> 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."...)

在 0.18 版本发生变更: 已从sklearn.utils.validation移动。