From db1beca748dc2259ffdd410f75d8d2a212767e09 Mon Sep 17 00:00:00 2001 From: Kylinux <3539594143@qq.com> Date: Sat, 21 Dec 2024 10:11:19 +0800 Subject: [PATCH 1/3] Fix/val_sample_weight error for models inherited from RegressionModel --- darts/models/forecasting/regression_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/darts/models/forecasting/regression_model.py b/darts/models/forecasting/regression_model.py index 5302dc0ab1..b24b58d14f 100644 --- a/darts/models/forecasting/regression_model.py +++ b/darts/models/forecasting/regression_model.py @@ -588,7 +588,7 @@ def _add_val_set_to_kwargs( val_weights = val_weights or None else: val_sets = [(val_samples, val_labels)] - val_weights = val_weight + val_weights = [val_weight] val_set_name, val_weight_name = self.val_set_params return dict(kwargs, **{val_set_name: val_sets, val_weight_name: val_weights}) From 988c996ebd2a723f7fc5f6131b78fcced347e099 Mon Sep 17 00:00:00 2001 From: Kylinux <3539594143@qq.com> Date: Sat, 21 Dec 2024 10:44:53 +0800 Subject: [PATCH 2/3] modify change log --- CHANGELOG.md | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad43f4371f..4ab887efe6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ but cannot always guarantee backwards compatibility. Changes that may **break co [Full Changelog](https://github.com/unit8co/darts/compare/0.31.0...master) +- Fix the bug in [#2579 ](https://github.com/unit8co/darts/issues/2579) which will cause error when setting val_sample_weight when using CatBoost and XGBoost model + ### For users of the library: **Improved** @@ -1403,7 +1405,7 @@ ts: TimeSeries = AirPassengers().load() ```python # Assuming a multivariate TimeSeries named series with 3 columns or variables. # To apply fn to columns with names '0' and '2': - + #old syntax series.map(fn, cols=['0', '2']) # returned a time series with 3 columns #new syntax @@ -1415,13 +1417,13 @@ ts: TimeSeries = AirPassengers().load() ```python #old syntax fillna(series, fill=0) - + #new syntax fill_missing_values(series, fill=0) - + #old syntax auto_fillna(series, **interpolate_kwargs) - + #new syntax fill_missing_values(series, fill='auto', **interpolate_kwargs) fill_missing_values(series, **interpolate_kwargs) # fill='auto' by default @@ -1459,13 +1461,13 @@ ts: TimeSeries = AirPassengers().load() ```python # old syntax: backtest_forecasting(forecasting_model, *args, **kwargs) - + # new syntax: forecasting_model.backtest(*args, **kwargs) - + # old syntax: backtest_regression(regression_model, *args, **kwargs) - + # new syntax: regression_model.backtest(*args, **kwargs) ``` @@ -1474,13 +1476,13 @@ ts: TimeSeries = AirPassengers().load() ```python # old syntax: multivariate_model.fit(multivariate_series, target_indices=[0, 1]) - + # new syntax: multivariate_model.fit(multivariate_series, multivariate_series[["0", "1"]]) - + # old syntax: univariate_model.fit(multivariate_series, component_index=2) - + # new syntax: univariate_model.fit(multivariate_series["2"]) ``` From ac16c5090f8c01e7eb48b4939a764f545afde9bf Mon Sep 17 00:00:00 2001 From: Kylinux <3539594143@qq.com> Date: Sat, 21 Dec 2024 10:50:21 +0800 Subject: [PATCH 3/3] modify the statement --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ab887efe6..6e4e40f0aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ but cannot always guarantee backwards compatibility. Changes that may **break co [Full Changelog](https://github.com/unit8co/darts/compare/0.31.0...master) -- Fix the bug in [#2579 ](https://github.com/unit8co/darts/issues/2579) which will cause error when setting val_sample_weight when using CatBoost and XGBoost model +- Fix the bug in [#2579 ](https://github.com/unit8co/darts/issues/2579) that causes an error when `val_sample_weight` is set in the CatBoost and XGBoost models. ### For users of the library: