Prophet fit RuntimeError: Error during optimization

huangapple go评论73阅读模式
英文:

Prophet fit RuntimeError: Error during optimization

问题

这是我的数据框的外观:

[![在此输入图像描述][1]][1]

然后当我尝试拟合prophet模型时,出现了这个错误:

>>> from prophet import Prophet
>>> m = Prophet()
>>> m.fit(df)

16:35:16 - cmdstanpy - INFO - 链 [1] 开始处理
16:35:16 - cmdstanpy - INFO - 链 [1] 处理完成
16:35:16 - cmdstanpy - ERROR - 链 [1] 错误: 信号6终止 未知错误: -6
优化异常终止回退到牛顿法
16:36:22 - cmdstanpy - INFO - 链 [1] 开始处理
16:36:22 - cmdstanpy - INFO - 链 [1] 处理完成
16:36:22 - cmdstanpy - ERROR - 链 [1] 错误: 信号6终止 未知错误: -6
---------------------------------------------------------------------------
运行时错误                              Traceback (most recent call last)
File ~/miniforge3/lib/python3.10/site-packages/prophet/models.py:96在 CmdStanPyBackend.fit(self, stan_init, stan_data, **kwargs) 中
     95 try:
--- 96     self.stan_fit = self.model.optimize(**args)
     97 except RuntimeError as e:
     98     # 回退到牛顿法

File ~/miniforge3/lib/python3.10/site-packages/cmdstanpy/model.py:738在 CmdStanModel.optimize(self, data, seed, inits, output_dir, sig_figs, save_profile, algorithm, init_alpha, tol_obj, tol_rel_obj, tol_grad, tol_rel_grad, tol_param, history_size, iter, save_iterations, require_converged, show_console, refresh, time_fmt, timeout) 中
    737     else:
-- 738         raise RuntimeError(msg)
    739 mle = CmdStanMLE(runset)

运行时错误: 优化期间发生错误 命令 '/Users/Admin/miniforge3/lib/python3.10/site-packages/prophet/stan_model/prophet_model.bin 随机种子=56334 数据文件=/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/tmpcyyh7d7t/2qlqak12.json 初始值=/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/tmpcyyh7d7t/z3_79y1x.json 输出文件=/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/tmpcyyh7d7t/prophet_modelufn_f82n/prophet_model-20230208163516.csv 方法=优化 算法=lbfgs 迭代=10000' 失败控制台日志输出

dyld[37030]: 未加载库@rpath/libtbb.dylib
  引用自<AC271190-0BD7-38FF-AFC9-F18DFE088087> /Users/Admin/miniforge3/lib/python3.10/site-packages/prophet/stan_model/prophet_model.bin
  原因尝试'/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib'无此文件),'/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib'无此文件),'/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib'无此文件),'/System/Volumes/Preboot/Cryptexes/OS@rpath/libtbb.dylib'无此文件),'/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib'无此文件),'/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib'无此文件),'/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib'无此文件),'/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6

<details>
<summary>英文:</summary>

This is how my dataframe looks like:

[![enter image description here][1]][1]

Then when I try to fit a prophet model, I get this error:

    &gt;&gt;&gt; from prophet import Prophet
    &gt;&gt;&gt; m = Prophet()
    &gt;&gt;&gt; m.fit(df)
    
    16:35:16 - cmdstanpy - INFO - Chain [1] start processing
    16:35:16 - cmdstanpy - INFO - Chain [1] done processing
    16:35:16 - cmdstanpy - ERROR - Chain [1] error: terminated by signal 6 Unknown error: -6
    Optimization terminated abnormally. Falling back to Newton.
    16:36:22 - cmdstanpy - INFO - Chain [1] start processing
    16:36:22 - cmdstanpy - INFO - Chain [1] done processing
    16:36:22 - cmdstanpy - ERROR - Chain [1] error: terminated by signal 6 Unknown error: -6
    ---------------------------------------------------------------------------
    RuntimeError                              Traceback (most recent call last)
    File ~/miniforge3/lib/python3.10/site-packages/prophet/models.py:96, in CmdStanPyBackend.fit(self, stan_init, stan_data, **kwargs)
         95 try:
    ---&gt; 96     self.stan_fit = self.model.optimize(**args)
         97 except RuntimeError as e:
         98     # Fall back on Newton
    
    File ~/miniforge3/lib/python3.10/site-packages/cmdstanpy/model.py:738, in CmdStanModel.optimize(self, data, seed, inits, output_dir, sig_figs, save_profile, algorithm, init_alpha, tol_obj, tol_rel_obj, tol_grad, tol_rel_grad, tol_param, history_size, iter, save_iterations, require_converged, show_console, refresh, time_fmt, timeout)
        737     else:
    --&gt; 738         raise RuntimeError(msg)
        739 mle = CmdStanMLE(runset)
    
    RuntimeError: Error during optimization! Command &#39;/Users/Admin/miniforge3/lib/python3.10/site-packages/prophet/stan_model/prophet_model.bin random seed=56334 data file=/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/tmpcyyh7d7t/2qlqak12.json init=/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/tmpcyyh7d7t/z3_79y1x.json output file=/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/tmpcyyh7d7t/prophet_modelufn_f82n/prophet_model-20230208163516.csv method=optimize algorithm=lbfgs iter=10000&#39; failed: console log output:
    
    dyld[37030]: Library not loaded: @rpath/libtbb.dylib
      Referenced from: &lt;AC271190-0BD7-38FF-AFC9-F18DFE088087&gt; /Users/Admin/miniforge3/lib/python3.10/site-packages/prophet/stan_model/prophet_model.bin
      Reason: tried: &#39;/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/System/Volumes/Preboot/Cryptexes/OS@rpath/libtbb.dylib&#39; (no such file), &#39;/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/usr/local/lib/libtbb.dylib&#39; (no such file), &#39;/usr/lib/libtbb.dylib&#39; (no such file, not in dyld cache)
    
    
    During handling of the above exception, another exception occurred:
    
    RuntimeError                              Traceback (most recent call last)
    Input In [7], in &lt;cell line: 3&gt;()
          1 m = Prophet()
    ----&gt; 2 m.fit(df)
    
    File ~/miniforge3/lib/python3.10/site-packages/prophet/forecaster.py:1181, in Prophet.fit(self, df, **kwargs)
       1179     self.params = self.stan_backend.sampling(stan_init, dat, self.mcmc_samples, **kwargs)
       1180 else:
    -&gt; 1181     self.params = self.stan_backend.fit(stan_init, dat, **kwargs)
       1183 self.stan_fit = self.stan_backend.stan_fit
       1184 # If no changepoints were requested, replace delta with 0s
    
    File ~/miniforge3/lib/python3.10/site-packages/prophet/models.py:103, in CmdStanPyBackend.fit(self, stan_init, stan_data, **kwargs)
        101     logger.warning(&#39;Optimization terminated abnormally. Falling back to Newton.&#39;)
        102     args[&#39;algorithm&#39;] = &#39;Newton&#39;
    --&gt; 103     self.stan_fit = self.model.optimize(**args)
        104 params = self.stan_to_dict_numpy(
        105     self.stan_fit.column_names, self.stan_fit.optimized_params_np)
        106 for par in params:
    
    File ~/miniforge3/lib/python3.10/site-packages/cmdstanpy/model.py:738, in CmdStanModel.optimize(self, data, seed, inits, output_dir, sig_figs, save_profile, algorithm, init_alpha, tol_obj, tol_rel_obj, tol_grad, tol_rel_grad, tol_param, history_size, iter, save_iterations, require_converged, show_console, refresh, time_fmt, timeout)
        736         get_logger().warning(msg)
        737     else:
    --&gt; 738         raise RuntimeError(msg)
        739 mle = CmdStanMLE(runset)
        740 return mle
    
    RuntimeError: Error during optimization! Command &#39;/Users/Admin/miniforge3/lib/python3.10/site-packages/prophet/stan_model/prophet_model.bin random seed=73289 data file=/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/tmpcyyh7d7t/6qjofygo.json init=/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/tmpcyyh7d7t/3wkgsh__.json output file=/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/tmpcyyh7d7t/prophet_modelpxzqvzzp/prophet_model-20230208163622.csv method=optimize algorithm=newton iter=10000&#39; failed: console log output:
    
    dyld[37096]: Library not loaded: @rpath/libtbb.dylib
      Referenced from: &lt;AC271190-0BD7-38FF-AFC9-F18DFE088087&gt; /Users/Admin/miniforge3/lib/python3.10/site-packages/prophet/stan_model/prophet_model.bin
      Reason: tried: &#39;/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/System/Volumes/Preboot/Cryptexes/OS@rpath/libtbb.dylib&#39; (no such file), &#39;/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/System/Volumes/Preboot/Cryptexes/OS/private/var/folders/8f/qf0d4l3j2mn5_vw839wgcj1w0000gn/T/pip-install-woutubot/prophet_98a976c6cbfd4e95b7cb41d7d690c7eb/build/lib.macosx-11.0-arm64-cpython-310/prophet/stan_model/cmdstan-2.26.1/stan/lib/stan_math/lib/tbb/libtbb.dylib&#39; (no such file), &#39;/usr/local/lib/libtbb.dylib&#39; (no such file), &#39;/usr/lib/libtbb.dylib&#39; (no such file, not in dyld cache)
    
Any idea what the problem is? I am on an M1 Mac, if that matters.
    
[1]: https://i.stack.imgur.com/TP28d.png

</details>


# 答案1
**得分**: 1

最近遇到了上述错误也许这个帖子对你有帮助 --&gt; https://github.com/facebook/prophet/issues/2354

<details>
<summary>英文:</summary>

Recently ran into the above error, maybe the thread here helps --&gt; https://github.com/facebook/prophet/issues/2354

</details>



huangapple
  • 本文由 发表于 2023年2月8日 19:13:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/75384958.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定