Skip to content

Test if class is fitted on another attribute in categorical_data_processor.py #49

@JanBenisek

Description

@JanBenisek

Currently, we test whether instance has been fitted based on two attributes:

if self.regroup and len(self._cleaned_categories_by_column) == 0:
msg = ("{} instance is not fitted yet. Call 'fit' with "
"appropriate arguments before using this method.")
raise NotFittedError(msg.format(self.__class__.__name__))

However, this will break if there is for example just one categorical variable and it has been skipped. The fit() will run but will not populate self._cleaned_categories_by_column and thus error will be raised.

Define fitted instance on another attribute (for example like in PreProcessor class where we have separate flag):

self._is_fitted = True # set fitted boolean to True

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions