Repository: ourownstory/neural_prophet

Issue:
Torch error under some optimization parameters during attempted Optuna outer-loop optimization
**Prerequisites**

* [ ] Put an X between the brackets on this line if you have done all of the following:
    * Reproduced the problem in a new virtualenv with only neuralprophet installed, directly from github:
      ```shell
      git clone <copied link from github>
      cd neural_prophet
      pip install .
      ```
    * Checked the Answered Questions on the Github Discussion board: https://github.com/ourownstory/neural_prophet/discussions
      If you have the same question but the Answer does not solve your issue, please continue the conversation there.
    * Checked that your issue isn't already filed: https://github.com/ourownstory/neural_prophet/issues
      If you have the same issue but there is a twist to your situation, please add an explanation there.
    * Considered whether your bug might actually be solvable by getting a question answered: 
      * Please [post a package use question](https://github.com/ourownstory/neural_prophet/discussions/categories/q-a-get-help-using-neuralprophet)
      * Please [post a forecasting best practice question](https://github.com/ourownstory/neural_prophet/discussions/categories/q-a-forecasting-best-practices)
      * Please [post an idea or feedback](https://github.com/ourownstory/neural_prophet/discussions/categories/ideas-feedback)

**Describe the bug**

Torch error under some optimization parameters during attempted Optuna outer-loop optimization.

Re-constructing the Optuna study will sometimes result in a run that works, but I expect at some point in optimization this error will return

Using the following configuration (optuna iteration)
```
Trial 0 failed with parameters: {'n_lags': 1, 'yearly_seasonality': 39, 'weekly_seasonality': 2, 'seasonality_reg': 8.209708790860189, 'trend_reg': 53.074534968657375, 'ar_reg': 0.18826427641273322, 'seasonality_mode': 'additive', 'trend_reg_threshold': True, 'ar_layers': [4, 4], 'changepoints_range': 0.9355036539269569, 'n_changepoints': 19}
```

```

File [/scratch/devgab/C3_admissions/timeseries/lib/python3.12/site-packages/neuralprophet/utils.py:141](http://10.116.134.8:8888/lab/tree/timeseries/lib/python3.12/site-packages/neuralprophet/utils.py#line=140), in reg_func_trend(weights, threshold)
    139 abs_weights = torch.abs(weights)
    140 if threshold is not None and not math.isclose(threshold, 0):
--> 141     abs_weights = torch.clamp(abs_weights - threshold, min=0.0)
    142 reg = torch.mean(torch.sum(abs_weights, dim=-1)).squeeze()
    143 return reg

RuntimeError: Subtraction, the `-` operator, with a bool tensor is not supported. If you are trying to invert a mask, use the `~` or `logical_not()` operator instead.
```

**To Reproduce**

Reproducing is currently random due to parameter sampling in Optuna

**Expected behavior**

No crash.

**What actually happens**

```
RuntimeError: Subtraction, the `-` operator, with a bool tensor is not supported. If you are trying to invert a mask, use the `~` or `logical_not()` operator instead.
```

**Screenshots**

If applicable, add screenshots and console printouts to help explain your problem.

**Environment (please complete the following information):**

```
$ micromamba list
List of packages in environment: "/scratch/devgab/C3_admissions/timeseries"

  Name                           Version         Build                         Channel    
────────────────────────────────────────────────────────────────────────────────────────────
  _libgcc_mutex                  0.1             conda_forge                   conda-forge
  _openmp_mutex                  4.5             2_gnu                         conda-forge
  alembic                        1.13.1          pyhd8ed1ab_1                  conda-forge
  ansi2html                      1.9.1           py312h7900ff3_0               conda-forge
  anyio                          4.3.0           pyhd8ed1ab_0                  conda-forge
  argon2-cffi                    23.1.0          pyhd8ed1ab_0                  conda-forge
  argon2-cffi-bindings           21.2.0          py312h98912ed_4               conda-forge
  arrow                          1.3.0           pyhd8ed1ab_0                  conda-forge
  asttokens                      2.4.1           pyhd8ed1ab_0                  conda-forge
  async-lru                      2.0.4           pyhd8ed1ab_0                  conda-forge
  attrs                          23.2.0          pyh71513ae_0                  conda-forge
  babel                          2.14.0          pyhd8ed1ab_0                  conda-forge
  beautifulsoup4                 4.12.3          pyha770c72_0                  conda-forge
  binutils_impl_linux-64         2.40            ha1999f0_1                    conda-forge
  binutils_linux-64              2.40            hdade7a5_3                    conda-forge
  blas                           1.0             mkl                           conda-forge
  bleach                         6.1.0           pyhd8ed1ab_0                  conda-forge
  blinker                        1.8.2           pyhd8ed1ab_0                  conda-forge
  brotli                         1.1.0           hd590300_1                    conda-forge
  brotli-bin                     1.1.0           hd590300_1                    conda-forge
  brotli-python                  1.1.0           py312h30efb56_1               conda-forge
  bzip2                          1.0.8           hd590300_5                    conda-forge
  ca-certificates                2024.2.2        hbcca054_0                    conda-forge
  cached-property                1.5.2           hd8ed1ab_1                    conda-forge
  cached_property                1.5.2           pyha770c72_1                  conda-forge
  certifi                        2024.2.2        pyhd8ed1ab_0                  conda-forge
  cffi                           1.16.0          py312hf06ca03_0               conda-forge
  charset-normalizer             3.3.2           pyhd8ed1ab_0                  conda-forge
  click                          8.1.7           unix_pyh707e725_0             conda-forge
  cmdstan                        2.33.1          hff4ab46_0                    conda-forge
  cmdstanpy                      1.2.2           pyhd8ed1ab_0                  conda-forge
  colorama                       0.4.6           pyhd8ed1ab_0                  conda-forge
  colorlog                       6.8.2           py312h7900ff3_0               conda-forge
  comm                           0.2.2           pyhd8ed1ab_0                  conda-forge
  contourpy                      1.2.1           py312h8572e83_0               conda-forge
  convertdate                    2.4.0           pyhd8ed1ab_0                  conda-forge
  cuda-cudart                    12.1.105        0                             nvidia     
  cuda-cupti                     12.1.105        0                             nvidia     
  cuda-libraries                 12.1.0          0                             nvidia     
  cuda-nvrtc                     12.1.105        0                             nvidia     
  cuda-nvtx                      12.1.105        0                             nvidia     
  cuda-opencl                    12.4.127        0                             nvidia     
  cuda-runtime                   12.1.0          0                             nvidia     
  cycler                         0.12.1          pyhd8ed1ab_0                  conda-forge
  dash                           0.39.0          py_0                          plotly     
  dash-core-components           0.44.0          py_0                          plotly     
  dash-html-components           0.14.0          py_0                          plotly     
  dash-renderer                  0.20.0          py_0                          plotly     
  dash-table                     3.6.0           py_0                          plotly     
  debugpy                        1.8.1           py312h30efb56_0               conda-forge
  decorator                      5.1.1           pyhd8ed1ab_0                  conda-forge
  defusedxml                     0.7.1           pyhd8ed1ab_0                  conda-forge
  entrypoints                    0.4             pyhd8ed1ab_0                  conda-forge
  ephem                          4.1.5           py312h98912ed_1               conda-forge
  exceptiongroup                 1.2.0           pyhd8ed1ab_2                  conda-forge
  executing                      2.0.1           pyhd8ed1ab_0                  conda-forge
  expat                          2.6.2           h59595ed_0                    conda-forge
  filelock                       3.14.0          pyhd8ed1ab_0                  conda-forge
  flask                          3.0.3           pyhd8ed1ab_0                  conda-forge
  flask-compress                 1.4.0           py_0                          plotly     
  font-ttf-dejavu-sans-mono      2.37            hab24e00_0                    conda-forge
  font-ttf-inconsolata           3.000           h77eed37_0                    conda-forge
  font-ttf-source-code-pro       2.038           h77eed37_0                    conda-forge
  font-ttf-ubuntu                0.83            h77eed37_2                    conda-forge
  fontconfig                     2.14.2          h14ed4e7_0                    conda-forge
  fonts-conda-forge              1               0                             conda-forge
  fonttools                      4.52.4          py312h9a8786e_0               conda-forge
  fqdn                           1.5.1           pyhd8ed1ab_0                  conda-forge
  freetype                       2.12.1          h267a509_2                    conda-forge
  gcc_impl_linux-64              12.3.0          h58ffeeb_7                    conda-forge
  gcc_linux-64                   12.3.0          h6477408_3                    conda-forge
  gmp                            6.3.0           h59595ed_1                    conda-forge
  gmpy2                          2.1.5           py312h1d5cde6_1               conda-forge
  greenlet                       3.0.3           py312h30efb56_0               conda-forge
  gxx_impl_linux-64              12.3.0          h2a574ab_7                    conda-forge
  gxx_linux-64                   12.3.0          h4a1b8e8_3                    conda-forge
  h11                            0.14.0          pyhd8ed1ab_0                  conda-forge
  h2                             4.1.0           pyhd8ed1ab_0                  conda-forge
  holidays                       0.49            pyhd8ed1ab_0                  conda-forge
  hpack                          4.0.0           pyh9f0ad1d_0                  conda-forge
  httpcore                       1.0.5           pyhd8ed1ab_0                  conda-forge
  httpx                          0.27.0          pyhd8ed1ab_0                  conda-forge
  hyperframe                     6.0.1           pyhd8ed1ab_0                  conda-forge
  icu                            73.2            h59595ed_0                    conda-forge
  idna                           3.7             pyhd8ed1ab_0                  conda-forge
  importlib-metadata             7.1.0           pyha770c72_0                  conda-forge
  importlib_metadata             7.1.0           hd8ed1ab_0                    conda-forge
  importlib_resources            6.4.0           pyhd8ed1ab_0                  conda-forge
  intel-openmp                   2022.1.0        h9e868ea_3769                            
  ipykernel                      6.29.3          pyhd33586a_0                  conda-forge
  ipython                        8.24.0          pyh707e725_0                  conda-forge
  ipywidgets                     8.1.3           pyhd8ed1ab_0                  conda-forge
  isoduration                    20.11.0         pyhd8ed1ab_0                  conda-forge
  itsdangerous                   2.2.0           pyhd8ed1ab_0                  conda-forge
  jedi                           0.19.1          pyhd8ed1ab_0                  conda-forge
  jinja2                         3.1.4           pyhd8ed1ab_0                  conda-forge
  joblib                         1.4.2           pyhd8ed1ab_0                  conda-forge
  json5                          0.9.25          pyhd8ed1ab_0                  conda-forge
  jsonpointer                    2.4             py312h7900ff3_3               conda-forge
  jsonschema                     4.22.0          pyhd8ed1ab_0                  conda-forge
  jsonschema-specifications      2023.12.1       pyhd8ed1ab_0                  conda-forge
  jsonschema-with-format-nongpl  4.22.0          pyhd8ed1ab_0                  conda-forge
  jupyter-collaboration          2.1.0           pyhd8ed1ab_0                  conda-forge
  jupyter-dash                   0.4.2           py_0                          plotly     
  jupyter-lsp                    2.2.5           pyhd8ed1ab_0                  conda-forge
  jupyter_client                 8.6.2           pyhd8ed1ab_0                  conda-forge
  jupyter_core                   5.7.2           py312h7900ff3_0               conda-forge
  jupyter_events                 0.10.0          pyhd8ed1ab_0                  conda-forge
  jupyter_server                 2.14.0          pyhd8ed1ab_0                  conda-forge
  jupyter_server_fileid          0.9.2           pyhd8ed1ab_0                  conda-forge
  jupyter_server_terminals       0.5.3           pyhd8ed1ab_0                  conda-forge
  jupyter_ydoc                   2.0.1           pyhd8ed1ab_0                  conda-forge
  jupyterlab                     4.2.1           pyhd8ed1ab_0                  conda-forge
  jupyterlab_pygments            0.3.0           pyhd8ed1ab_1                  conda-forge
  jupyterlab_server              2.27.2          pyhd8ed1ab_0                  conda-forge
  jupyterlab_widgets             3.0.11          pyhd8ed1ab_0                  conda-forge
  kaleido-core                   0.2.1           h3644ca4_0                    conda-forge
  kernel-headers_linux-64        2.6.32          he073ed8_17                   conda-forge
  keyutils                       1.6.1           h166bdaf_0                    conda-forge
  kiwisolver                     1.4.5           py312h8572e83_1               conda-forge
  krb5                           1.21.2          h659d440_0                    conda-forge
  lcms2                          2.16            hb7c19ff_0                    conda-forge
  ld_impl_linux-64               2.40            hf3520f5_1                    conda-forge
  lerc                           4.0.0           h27087fc_0                    conda-forge
  libblas                        3.9.0           16_linux64_mkl                conda-forge
  libbrotlicommon                1.1.0           hd590300_1                    conda-forge
  libbrotlidec                   1.1.0           hd590300_1                    conda-forge
  libbrotlienc                   1.1.0           hd590300_1                    conda-forge
  libcblas                       3.9.0           16_linux64_mkl                conda-forge
  libcublas                      12.1.0.26       0                             nvidia     
  libcufft                       11.0.2.4        0                             nvidia     
  libcufile                      1.9.1.3         0                             nvidia     
  libcurand                      10.3.5.147      0                             nvidia     
  libcusolver                    11.4.4.55       0                             nvidia     
  libcusparse                    12.0.2.55       0                             nvidia     
  libdeflate                     1.20            hd590300_0                    conda-forge
  libedit                        3.1.20191231    he28a2e2_2                    conda-forge
  libexpat                       2.6.2           h59595ed_0                    conda-forge
  libffi                         3.4.2           h7f98852_5                    conda-forge
  libgcc-devel_linux-64          12.3.0          h0223996_107                  conda-forge
  libgcc-ng                      13.2.0          h77fa898_7                    conda-forge
  libgfortran-ng                 13.2.0          h69a702a_7                    conda-forge
  libgfortran5                   13.2.0          hca663fb_7                    conda-forge
  libgomp                        13.2.0          h77fa898_7                    conda-forge
  libhwloc                       2.10.0          default_h5622ce7_1001         conda-forge
  libiconv                       1.17            hd590300_2                    conda-forge
  libjpeg-turbo                  3.0.0           hd590300_1                    conda-forge
  liblapack                      3.9.0           16_linux64_mkl                conda-forge
  libnpp                         12.0.2.50       0                             nvidia     
  libnsl                         2.0.1           hd590300_0                    conda-forge
  libnvjitlink                   12.1.105        0                             nvidia     
  libnvjpeg                      12.1.1.14       0                             nvidia     
  libpng                         1.6.43          h2797004_0                    conda-forge
  libsanitizer                   12.3.0          hb8811af_7                    conda-forge
  libsodium                      1.0.18          h36c2ea0_1                    conda-forge
  libsqlite                      3.45.3          h2797004_0                    conda-forge
  libstdcxx-devel_linux-64       12.3.0          h0223996_107                  conda-forge
  libstdcxx-ng                   13.2.0          hc0a3c3a_7                    conda-forge
  libtiff                        4.6.0           h1dd3fc0_3                    conda-forge
  libuuid                        2.38.1          h0b41bf4_0                    conda-forge
  libwebp-base                   1.4.0           hd590300_0                    conda-forge
  libxcb                         1.15            h0b41bf4_0                    conda-forge
  libxcrypt                      4.4.36          hd590300_1                    conda-forge
  libxml2                        2.12.7          hc051c1a_0                    conda-forge
  libzlib                        1.2.13          h4ab18f5_6                    conda-forge
  llvm-openmp                    15.0.7          h0cdce71_0                    conda-forge
  lunarcalendar                  0.0.9           py_0                          conda-forge
  make                           4.3             hd18ef5c_1                    conda-forge
  mako                           1.3.5           pyhd8ed1ab_0                  conda-forge
  markupsafe                     2.1.5           py312h98912ed_0               conda-forge
  mathjax                        2.7.7           ha770c72_3                    conda-forge
  matplotlib-base                3.8.4           py312h20ab3a6_2               conda-forge
  matplotlib-inline              0.1.7           pyhd8ed1ab_0                  conda-forge
  mistune                        3.0.2           pyhd8ed1ab_0                  conda-forge
  mkl                            2022.1.0        hc2b9512_224                             
  mpc                            1.3.1           hfe3b2da_0                    conda-forge
  mpfr                           4.2.1           h9458935_1                    conda-forge
  mpmath                         1.3.0           pyhd8ed1ab_0                  conda-forge
  munkres                        1.1.4           pyh9f0ad1d_0                  conda-forge
  nbclient                       0.10.0          pyhd8ed1ab_0                  conda-forge
  nbconvert-core                 7.16.4          pyhd8ed1ab_0                  conda-forge
  nbformat                       5.10.4          pyhd8ed1ab_0                  conda-forge
  ncurses                        6.5             h59595ed_0                    conda-forge
  nest-asyncio                   1.6.0           pyhd8ed1ab_0                  conda-forge
  networkx                       3.3             pyhd8ed1ab_1                  conda-forge
  notebook-shim                  0.2.4           pyhd8ed1ab_0                  conda-forge
  nspr                           4.35            h27087fc_0                    conda-forge
  nss                            3.100           hca3bf56_0                    conda-forge
  numpy                          1.26.4          py312heda63a1_0               conda-forge
  openjpeg                       2.5.2           h488ebb8_0                    conda-forge
  openssl                        3.3.0           h4ab18f5_3                    conda-forge
  optuna                         3.6.0           pyhd8ed1ab_0                  conda-forge
  overrides                      7.7.0           pyhd8ed1ab_0                  conda-forge
  packaging                      24.0            pyhd8ed1ab_0                  conda-forge
  pandas                         2.2.2           py312h1d6d2e6_1               conda-forge
  pandocfilters                  1.5.0           pyhd8ed1ab_0                  conda-forge
  parso                          0.8.4           pyhd8ed1ab_0                  conda-forge
  pexpect                        4.9.0           pyhd8ed1ab_0                  conda-forge
  pickleshare                    0.7.5           py_1003                       conda-forge
  pillow                         10.3.0          py312hdcec9eb_0               conda-forge
  pip                            24.0            pyhd8ed1ab_0                  conda-forge
  pkgutil-resolve-name           1.3.10          pyhd8ed1ab_1                  conda-forge
  platformdirs                   4.2.2           pyhd8ed1ab_0                  conda-forge
  plotly                         5.22.0          py_0                          plotly     
  polars                         0.20.30         py312hc7f843c_0               conda-forge
  prometheus_client              0.20.0          pyhd8ed1ab_0                  conda-forge
  prompt-toolkit                 3.0.42          pyha770c72_0                  conda-forge
  prophet                        1.1.5           py312h4f541b2_1               conda-forge
  psutil                         5.9.8           py312h98912ed_0               conda-forge
  pthread-stubs                  0.4             h36c2ea0_1001                 conda-forge
  ptyprocess                     0.7.0           pyhd3deb0d_0                  conda-forge
  pure_eval                      0.2.2           pyhd8ed1ab_0                  conda-forge
  pycparser                      2.22            pyhd8ed1ab_0                  conda-forge
  pycrdt                         0.8.25          py312h4413252_0               conda-forge
  pycrdt-websocket               0.13.4          pyhd8ed1ab_0                  conda-forge
  pygments                       2.18.0          pyhd8ed1ab_0                  conda-forge
  pymeeus                        0.5.12          pyhd8ed1ab_0                  conda-forge
  pyparsing                      3.1.2           pyhd8ed1ab_0                  conda-forge
  pysocks                        1.7.1           pyha2e5f31_6                  conda-forge
  python                         3.12.3          hab00c5b_0_cpython            conda-forge
  python-dateutil                2.9.0           pyhd8ed1ab_0                  conda-forge
  python-fastjsonschema          2.19.1          pyhd8ed1ab_0                  conda-forge
  python-json-logger             2.0.7           pyhd8ed1ab_0                  conda-forge
  python-kaleido                 0.2.1           pyhd8ed1ab_0                  conda-forge
  python-tzdata                  2024.1          pyhd8ed1ab_0                  conda-forge
  python_abi                     3.12            4_cp312                       conda-forge
  pytorch                        2.3.0           py3.12_cuda12.1_cudnn8.9.2_0  pytorch    
  pytorch-cuda                   12.1            ha16c6d3_5                    pytorch    
  pytorch-mutex                  1.0             cuda                          pytorch    
  pytz                           2024.1          pyhd8ed1ab_0                  conda-forge
  pyyaml                         6.0.1           py312h98912ed_1               conda-forge
  pyzmq                          26.0.3          py312h8fd38d8_0               conda-forge
  readline                       8.2             h8228510_1                    conda-forge
  referencing                    0.35.1          pyhd8ed1ab_0                  conda-forge
  requests                       2.32.2          pyhd8ed1ab_0                  conda-forge
  retrying                       1.3.3           py_2                          conda-forge
  rfc3339-validator              0.1.4           pyhd8ed1ab_0                  conda-forge
  rfc3986-validator              0.1.1           pyh9f0ad1d_0                  conda-forge
  rpds-py                        0.18.1          py312h4413252_0               conda-forge
  scikit-base                    0.7.8           pyhecae5ae_1                  conda-forge
  scikit-learn                   1.4.2           py312h1fcc3ea_1               conda-forge
  scipy                          1.13.1          py312hc2bc53b_0               conda-forge
  send2trash                     1.8.3           pyh0d859eb_0                  conda-forge
  setuptools                     70.0.0          pyhd8ed1ab_0                  conda-forge
  six                            1.16.0          pyh6c4a22f_0                  conda-forge
  sktime                         0.29.0          py312h7900ff3_1               conda-forge
  sniffio                        1.3.1           pyhd8ed1ab_0                  conda-forge
  soupsieve                      2.5             pyhd8ed1ab_1                  conda-forge
  sqlalchemy                     2.0.30          py312h9a8786e_0               conda-forge
  sqlite                         3.45.3          h2c6b66d_0                    conda-forge
  sqlite-anyio                   0.2.0           pyhd8ed1ab_0                  conda-forge
  stack_data                     0.6.2           pyhd8ed1ab_0                  conda-forge
  stanio                         0.5.0           pyhd8ed1ab_0                  conda-forge
  sympy                          1.12            pypyh9d50eac_103              conda-forge
  sysroot_linux-64               2.12            he073ed8_17                   conda-forge
  tbb                            2021.12.0       h297d8ca_1                    conda-forge
  tbb-devel                      2021.12.0       h7c56ddd_1                    conda-forge
  tenacity                       8.3.0           pyhd8ed1ab_0                  conda-forge
  terminado                      0.18.1          pyh0d859eb_0                  conda-forge
  threadpoolctl                  3.5.0           pyhc1e730c_0                  conda-forge
  tinycss2                       1.3.0           pyhd8ed1ab_0                  conda-forge
  tk                             8.6.13          noxft_h4845f30_101            conda-forge
  tomli                          2.0.1           pyhd8ed1ab_0                  conda-forge
  tornado                        6.4             py312h98912ed_0               conda-forge
  tqdm                           4.66.4          pyhd8ed1ab_0                  conda-forge
  traitlets                      5.14.3          pyhd8ed1ab_0                  conda-forge
  types-python-dateutil          2.9.0.20240316  pyhd8ed1ab_0                  conda-forge
  typing-extensions              4.11.0          hd8ed1ab_0                    conda-forge
  typing_extensions              4.11.0          pyha770c72_0                  conda-forge
  typing_utils                   0.1.0           pyhd8ed1ab_0                  conda-forge
  tzdata                         2024a           h0c530f3_0                    conda-forge
  uri-template                   1.3.0           pyhd8ed1ab_0                  conda-forge
  urllib3                        2.2.1           pyhd8ed1ab_0                  conda-forge
  wcwidth                        0.2.13          pyhd8ed1ab_0                  conda-forge
  webcolors                      1.13            pyhd8ed1ab_0                  conda-forge
  webencodings                   0.5.1           pyhd8ed1ab_2                  conda-forge
  websocket-client               1.8.0           pyhd8ed1ab_0                  conda-forge
  werkzeug                       3.0.3           pyhd8ed1ab_0                  conda-forge
  wheel                          0.43.0          pyhd8ed1ab_1                  conda-forge
  widgetsnbextension             4.0.11          pyhd8ed1ab_0                  conda-forge
  xorg-libxau                    1.0.11          hd590300_0                    conda-forge
  xorg-libxdmcp                  1.1.3           h7f98852_0                    conda-forge
  xz                             5.2.6           h166bdaf_0                    conda-forge
  yaml                           0.2.5           h7f98852_2                    conda-forge
  zeromq                         4.3.5           h75354e8_4                    conda-forge
  zipp                           3.17.0          pyhd8ed1ab_0                  conda-forge
  zlib                           1.2.13          h4ab18f5_6                    conda-forge
  zstd                           1.5.6           ha6fb4c9_0                    conda-forge

$ pip list
Package                   Version
------------------------- --------------
absl-py                   2.1.0
aiohttp                   3.9.5
aiosignal                 1.3.1
alembic                   1.13.1
ansi2html                 0.0.0
anyio                     4.3.0
argon2-cffi               23.1.0
argon2-cffi-bindings      21.2.0
arrow                     1.3.0
asttokens                 2.4.1
async-lru                 2.0.4
attrs                     23.2.0
Babel                     2.14.0
beautifulsoup4            4.12.3
bleach                    6.1.0
blinker                   1.8.2
Brotli                    1.1.0
cached-property           1.5.2
captum                    0.7.0
certifi                   2024.2.2
cffi                      1.16.0
charset-normalizer        3.3.2
click                     8.1.7
cmdstanpy                 1.2.2
colorama                  0.4.6
colorlog                  6.8.2
comm                      0.2.2
contourpy                 1.2.1
convertdate               2.4.0
cycler                    0.12.1
dash                      2.17.0
dash-core-components      2.0.0
dash-html-components      2.0.0
dash-renderer             0.20.0
dash-table                5.0.0
debugpy                   1.8.1
decorator                 5.1.1
defusedxml                0.7.1
entrypoints               0.4
ephem                     4.1.5
exceptiongroup            1.2.0
executing                 2.0.1
fastjsonschema            2.19.1
filelock                  3.14.0
Flask                     3.0.3
Flask-Compress            1.4.0
fonttools                 4.52.4
fqdn                      1.5.1
frozenlist                1.4.1
fsspec                    2024.5.0
gmpy2                     2.1.5
greenlet                  3.0.3
grpcio                    1.64.0
h11                       0.14.0
h2                        4.1.0
holidays                  0.49
hpack                     4.0.0
httpcore                  1.0.5
httpx                     0.27.0
hyperframe                6.0.1
idna                      3.7
importlib_metadata        7.1.0
importlib_resources       6.4.0
ipykernel                 6.29.3
ipython                   8.24.0
ipywidgets                8.1.3
isoduration               20.11.0
itsdangerous              2.2.0
jedi                      0.19.1
Jinja2                    3.1.4
joblib                    1.4.2
json5                     0.9.25
jsonpointer               2.4
jsonschema                4.22.0
jsonschema-specifications 2023.12.1
jupyter_client            8.6.2
jupyter_collaboration     2.1.0
jupyter_core              5.7.2
jupyter-dash              0.4.2
jupyter-events            0.10.0
jupyter-lsp               2.2.5
jupyter_server            2.14.0
jupyter_server_fileid     0.9.2
jupyter_server_terminals  0.5.3
jupyter-ydoc              2.0.1
jupyterlab                4.2.1
jupyterlab_pygments       0.3.0
jupyterlab_server         2.27.2
jupyterlab_widgets        3.0.11
kaleido                   0.2.1
kiwisolver                1.4.5
lightning-utilities       0.11.2
LunarCalendar             0.0.9
Mako                      1.3.5
Markdown                  3.6
MarkupSafe                2.1.5
matplotlib                3.8.4
matplotlib-inline         0.1.7
meteostat                 1.6.7
mistune                   3.0.2
mpmath                    1.3.0
multidict                 6.0.5
munkres                   1.1.4
nbclient                  0.10.0
nbconvert                 7.16.4
nbformat                  5.10.4
nest_asyncio              1.6.0
networkx                  3.3
neuralprophet             0.8.0
notebook_shim             0.2.4
numpy                     1.26.4
optuna                    3.6.0
orjson                    3.10.3
overrides                 7.7.0
packaging                 24.0
pandas                    2.2.2
pandocfilters             1.5.0
parso                     0.8.4
pexpect                   4.9.0
pickleshare               0.7.5
pillow                    10.3.0
pip                       24.0
pkgutil_resolve_name      1.3.10
platformdirs              4.2.2
plotly                    5.22.0
plotly-resampler          0.10.0
polars                    0.20.30
prometheus_client         0.20.0
prompt-toolkit            3.0.42
prophet                   1.1.5
protobuf                  5.27.0
psutil                    5.9.8
ptyprocess                0.7.0
pure-eval                 0.2.2
pycparser                 2.22
pycrdt                    0.8.25
pycrdt-websocket          0.13.4
Pygments                  2.18.0
PyMeeus                   0.5.12
pyparsing                 3.1.2
PySocks                   1.7.1
python-dateutil           2.9.0
python-json-logger        2.0.7
pytorch-lightning         1.9.5
pytz                      2024.1
PyYAML                    6.0.1
pyzmq                     26.0.3
referencing               0.35.1
requests                  2.32.2
retrying                  1.3.3
rfc3339-validator         0.1.4
rfc3986-validator         0.1.1
rpds-py                   0.18.1
scikit-base               0.7.8
scikit-learn              1.4.2
scipy                     1.13.1
Send2Trash                1.8.3
setuptools                70.0.0
six                       1.16.0
sktime                    0.29.0
sniffio                   1.3.1
soupsieve                 2.5
SQLAlchemy                2.0.30
sqlite-anyio              0.2.0
stack-data                0.6.2
stanio                    0.5.0
sympy                     1.12
tenacity                  8.3.0
tensorboard               2.16.2
tensorboard-data-server   0.7.2
terminado                 0.18.1
threadpoolctl             3.5.0
tinycss2                  1.3.0
tomli                     2.0.1
torch                     2.3.0
torchmetrics              1.4.0.post0
tornado                   6.4
tqdm                      4.66.4
traitlets                 5.14.3
tsdownsample              0.1.3
types-python-dateutil     2.9.0.20240316
typing_extensions         4.11.0
typing-utils              0.1.0
tzdata                    2024.1
uri-template              1.3.0
urllib3                   2.2.1
wcwidth                   0.2.13
webcolors                 1.13
webencodings              0.5.1
websocket-client          1.8.0
Werkzeug                  3.0.3
wheel                     0.43.0
widgetsnbextension        4.0.11
yarl                      1.9.4
zipp                      3.17.0


```


Discussion:

Resolving patch:
diff --git a/neuralprophet/forecaster.py b/neuralprophet/forecaster.py
--- a/neuralprophet/forecaster.py
+++ b/neuralprophet/forecaster.py
@@ -457,19 +457,6 @@ def __init__(
             drop_missing=drop_missing,
         )
 
-        # Training
-        self.config_train = configure.Train(
-            quantiles=quantiles,
-            learning_rate=learning_rate,
-            epochs=epochs,
-            batch_size=batch_size,
-            loss_func=loss_func,
-            optimizer=optimizer,
-            newer_samples_weight=newer_samples_weight,
-            newer_samples_start=newer_samples_start,
-            trend_reg_threshold=trend_reg_threshold,
-        )
-
         if isinstance(collect_metrics, list):
             log.info(
                 DeprecationWarning(
@@ -499,6 +486,19 @@ def __init__(
             trend_local_reg=trend_local_reg,
         )
 
+        # Training
+        self.config_train = configure.Train(
+            quantiles=quantiles,
+            learning_rate=learning_rate,
+            epochs=epochs,
+            batch_size=batch_size,
+            loss_func=loss_func,
+            optimizer=optimizer,
+            newer_samples_weight=newer_samples_weight,
+            newer_samples_start=newer_samples_start,
+            trend_reg_threshold=self.config_trend.trend_reg_threshold,
+        )
+
         # Seasonality
         self.config_seasonality = configure.ConfigSeasonality(
             mode=seasonality_mode,


Test patch: