AnotherSamWilson / miceforest

Multiple Imputation with LightGBM in Python
MIT License
353 stars 31 forks source link

Trigger an error when no missing data #62

Closed getchepare2 closed 2 years ago

getchepare2 commented 2 years ago

Hello,

We included the miceforest imputation as the first step of our prediction pipeline. Sometimes we do not have any missing values in the input data and we would like miceforest step to act like a passthrough step for that case. However, the step fails :

163     if len(vars_with_any_missing) == 0:
164         raise ValueError("No missing values to impute.")
166 elif isinstance(self.working_data, np.ndarray):
168     if len(self.working_data.shape) != 2 or self.working_data.shape[0] < 1:

ValueError: No missing values to impute.

It would be great if we do not raise an error for that case and return the input data frame as is.

Happy to talk more about that case if needed :)

AnotherSamWilson commented 2 years ago

This is a good suggestion.

AnotherSamWilson commented 2 years ago

This has been completed as a part of 5.6.3, but it won't be on PyPi for a few days. You can install from this git repo if you want to see if the changes worked. I plan on fixing a few other issues as well for 5.6.3.