INNER CODE UNIT · Python
_impute_with_predictions
AnotherSamWilson/miceforest · miceforest/imputation_kernel.py:725
def _impute_with_predictions(
self,
variable: str,
lgbmodel: Booster,
bachelor_features: DataFrame,
):
bachelor_preds = lgbmodel.predict(
bachelor_features,
pred_contrib=False,
raw_score=False,
)
assert isinstance(bachelor_preds, np.ndarray)
dtype = self.working_data[variable].dtype
if variable in self.modeled_numeric_columns:
if is_integer_dtype(dtype):
bachelor_preds = bachelor_preds.round(0)
return Series(bachelor_preds, dtype=dtype)
else: