diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c55079d6..4c5cca274 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - - - Add in_column to plot_anomalies, plot_anomalies_interactive ([#618](https://github.com/tinkoff-ai/etna/pull/618)) -- +- Add logging to TSDataset.inverse_transform ([#642](https://github.com/tinkoff-ai/etna/pull/642)) ### Fixed - Passing non default params for default models STLTransform ([#641](https://github.com/tinkoff-ai/etna/pull/641)) diff --git a/etna/datasets/tsdataset.py b/etna/datasets/tsdataset.py index 19a7652ab..206ef430e 100644 --- a/etna/datasets/tsdataset.py +++ b/etna/datasets/tsdataset.py @@ -396,6 +396,7 @@ def inverse_transform(self): """ if self.transforms is not None: for transform in reversed(self.transforms): + tslogger.log(f"Inverse transform {repr(transform)} is applied to dataset") self.df = transform.inverse_transform(self.df) @property diff --git a/tests/test_loggers/test_console_logger.py b/tests/test_loggers/test_console_logger.py index cd739b69e..c1e19ad08 100644 --- a/tests/test_loggers/test_console_logger.py +++ b/tests/test_loggers/test_console_logger.py @@ -64,6 +64,18 @@ def test_tsdataset_make_future_logging(example_tsds: TSDataset): tslogger.remove(idx) +def test_tsdataset_inverse_transform_logging(example_tsds: TSDataset): + """Check working of logging inside `TSDataset.inverse_transform`.""" + transforms = [LagTransform(lags=5, in_column="target"), AddConstTransform(value=5, in_column="target")] + file = NamedTemporaryFile() + _logger.add(file.name) + example_tsds.fit_transform(transforms=transforms) + idx = tslogger.add(ConsoleLogger()) + example_tsds.inverse_transform() + check_logged_transforms(log_file=file.name, transforms=transforms[::-1]) + tslogger.remove(idx) + + def test_backtest_logging(example_tsds: TSDataset): """Check working of logging inside backtest.""" file = NamedTemporaryFile()