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 |
Currently, we test whether instance has been fitted based on two attributes:
cobra/cobra/preprocessing/categorical_data_processor.py
Lines 248 to 252 in 474650f
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 populateself._cleaned_categories_by_columnand thus error will be raised.Define fitted instance on another attribute (for example like in PreProcessor class where we have separate flag):
cobra/cobra/preprocessing/preprocessor.py
Line 255 in 474650f