# tf.contrib.learn.NotFittedError

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/learn/python/learn/estimators/_sklearn.py#L133-L153) |

Exception class to raise if estimator is used before fitting.

    tf.contrib.learn.NotFittedError(
        *args, **kwargs
    )

USE OF THIS EXCEPTION IS DEPRECATED.

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 NotFittedError
> > > try:
> > > ... LinearSVC().predict(\[\[1, 2\], \[2, 3\], \[3, 4\]\])
> > > ... except NotFittedError as e:
> > > ... print(repr(e))
> > > ... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
> > > NotFittedError('This LinearSVC instance is not fitted yet',)

Copied from
<https://github.com/scikit-learn/scikit-learn/master/sklearn/exceptions.py>