NotFittedError#

class pybear.base.NotFittedError#

Bases: ValueError, AttributeError

Exception class to raise if estimator is used before fitting.

This class inherits from both ValueError and AttributeError to help with exception handling.

Attributes:
args
name

attribute name

obj

object

Methods

add_note

Exception.add_note(note) -- add a note to the exception

with_traceback

Exception.with_traceback(tb) -- set self.__traceback__ to tb and return self.

Examples

>>> from pybear.preprocessing import ColumnDeduplicator as CDT
>>> from pybear.base.exceptions import NotFittedError
>>> import numpy as np
>>> X = np.random.randint(0, 10, (5,3))
>>> try:
...     CDT().transform(X)
... except NotFittedError as e:
...     print(e)
This ColumnDeduplicator instance is not fitted yet.
Call 'fit' with appropriate arguments before using this estimator.
add_note()#

Exception.add_note(note) – add a note to the exception

args#
name#

attribute name

obj#

object

with_traceback()#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.