def apply_inverse_transform(scaler: TransformerMixin, x: ArrayLike) -> ArrayLike: if isinstance(x, ndarray): return scaler.inverse_transform(x) elif isinstance(x, Series): return Series( apply_inverse_transform(scaler, x.to_numpy()), x.index, name=x.name, ) elif isinstance(x, DataFrame): return DataFrame( apply_inverse_transform(scaler, x.to_numpy()), x.index, x.columns, ) else: raise TypeError(f"Invalid type: {type(x).__name__}")
def inverse_transform(self, transformer: TransformerMixin) -> None: """ Inverse transform this dataset. """ self.XY[:] = transformer.inverse_transform(self.XY)