未拟合错误#
- exception sklearn.exceptions.NotFittedError[source]#
- 如果在拟合之前使用估计器,则引发此异常类。 - 此类继承自 ValueError 和 AttributeError,以帮助进行异常处理和向后兼容。 - 示例 - >>> 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 移动。 
