class LastFillImpute(BaseImputation): """ LastFill imputation """ def __init__(self): self.imputer = LastFill() def impute(self, input_df): assert self.imputer is not None df = self.imputer.impute(input_df) return df def restore(self, **config): self.imputer = LastFill()
def test_lastfill(self): last_fill = LastFill() mse_missing = last_fill.evaluate(self.data, 0.1) imputed_data = last_fill.impute(self.data) assert imputed_data.isna().sum().sum() == 0 mse = last_fill.evaluate(imputed_data, 0.1)
def restore(self, **config): self.imputer = LastFill()
def __init__(self): self.imputer = LastFill()