Skip to content

Commit

Permalink
add progress bar to regression models for hist fc (#2320)
Browse files Browse the repository at this point in the history
* add progress bar to regression models for hist fc

* update changelog

* remove line
  • Loading branch information
dennisbader authored Apr 12, 2024
1 parent 261307c commit c3a6112
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ but cannot always guarantee backwards compatibility. Changes that may **break co
- Moved functions `retain_period_common_to_all()`, `series2seq()`, `seq2series()`, `get_single_series()` from `darts.utils.utils` to `darts.utils.ts_utils`.
- Improvements to `ForecastingModel`: [#2269](https://github.com/unit8co/darts/pull/2269) by [Felix Divo](https://github.com/felixdivo).
- Renamed the private `_is_probabilistic` property to a public `supports_probabilistic_prediction`.
- Improvements to `RegressionModel`: [#2320](https://github.com/unit8co/darts/pull/2320) by [Felix Divo](https://github.com/felixdivo).
- Added a progress bar when performing optimized historical forecasts (`retrain=False` and no autoregression) to display the series-level progress.
- Improvements to `DataTransformer`: [#2267](https://github.com/unit8co/darts/pull/2267) by [Alicja Krzeminska-Sciga](https://github.com/alicjakrzeminska).
- `InvertibleDataTransformer` now supports parallelized inverse transformation for `series` being a list of lists of `TimeSeries` (`Sequence[Sequence[TimeSeries]]`). This `series` type represents for example the output from `historical_forecasts()` when using multiple series.

Expand Down
2 changes: 2 additions & 0 deletions darts/models/forecasting/regression_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,7 @@ def _optimized_historical_forecasts(
stride=stride,
overlap_end=overlap_end,
show_warnings=show_warnings,
verbose=verbose,
predict_likelihood_parameters=predict_likelihood_parameters,
**kwargs,
)
Expand All @@ -1215,6 +1216,7 @@ def _optimized_historical_forecasts(
stride=stride,
overlap_end=overlap_end,
show_warnings=show_warnings,
verbose=verbose,
predict_likelihood_parameters=predict_likelihood_parameters,
**kwargs,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from darts.logging import get_logger
from darts.timeseries import TimeSeries
from darts.utils import _build_tqdm_iterator
from darts.utils.data.tabularization import create_lagged_prediction_data
from darts.utils.historical_forecasts.utils import _get_historical_forecast_boundaries
from darts.utils.utils import generate_index
Expand All @@ -30,6 +31,7 @@ def _optimized_historical_forecasts_last_points_only(
stride: int = 1,
overlap_end: bool = False,
show_warnings: bool = True,
verbose: bool = False,
predict_likelihood_parameters: bool = False,
**kwargs,
) -> Union[TimeSeries, Sequence[TimeSeries], Sequence[Sequence[TimeSeries]]]:
Expand All @@ -39,7 +41,8 @@ def _optimized_historical_forecasts_last_points_only(
Rely on _check_optimizable_historical_forecasts() to check that the assumptions are verified.
"""
forecasts_list = []
for idx, series_ in enumerate(series):
iterator = _build_tqdm_iterator(series, verbose)
for idx, series_ in enumerate(iterator):
past_covariates_ = past_covariates[idx] if past_covariates is not None else None
future_covariates_ = (
future_covariates[idx] if future_covariates is not None else None
Expand Down Expand Up @@ -185,6 +188,7 @@ def _optimized_historical_forecasts_all_points(
stride: int = 1,
overlap_end: bool = False,
show_warnings: bool = True,
verbose: bool = False,
predict_likelihood_parameters: bool = False,
**kwargs,
) -> Union[TimeSeries, Sequence[TimeSeries], Sequence[Sequence[TimeSeries]]]:
Expand All @@ -194,7 +198,8 @@ def _optimized_historical_forecasts_all_points(
Rely on _check_optimizable_historical_forecasts() to check that the assumptions are verified.
"""
forecasts_list = []
for idx, series_ in enumerate(series):
iterator = _build_tqdm_iterator(series, verbose)
for idx, series_ in enumerate(iterator):
past_covariates_ = past_covariates[idx] if past_covariates is not None else None
future_covariates_ = (
future_covariates[idx] if future_covariates is not None else None
Expand Down

0 comments on commit c3a6112

Please sign in to comment.