Prophet fit RuntimeError: Error during optimization

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

Prophet fit RuntimeError: Error during optimization

问题

这是我的数据框的外观:

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

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

  1. >>> from prophet import Prophet
  2. >>> m = Prophet()
  3. >>> m.fit(df)
  4. 16:35:16 - cmdstanpy - INFO - [1] 开始处理
  5. 16:35:16 - cmdstanpy - INFO - [1] 处理完成
  6. 16:35:16 - cmdstanpy - ERROR - [1] 错误: 信号6终止 未知错误: -6
  7. 优化异常终止回退到牛顿法
  8. 16:36:22 - cmdstanpy - INFO - [1] 开始处理
  9. 16:36:22 - cmdstanpy - INFO - [1] 处理完成
  10. 16:36:22 - cmdstanpy - ERROR - [1] 错误: 信号6终止 未知错误: -6
  11. ---------------------------------------------------------------------------
  12. 运行时错误 Traceback (most recent call last)
  13. File ~/miniforge3/lib/python3.10/site-packages/prophet/models.py:96 CmdStanPyBackend.fit(self, stan_init, stan_data, **kwargs)
  14. 95 try:
  15. --- 96 self.stan_fit = self.model.optimize(**args)
  16. 97 except RuntimeError as e:
  17. 98 # 回退到牛顿法
  18. 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)
  19. 737 else:
  20. -- 738 raise RuntimeError(msg)
  21. 739 mle = CmdStanMLE(runset)
  22. 运行时错误: 优化期间发生错误 命令 '/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' 失败控制台日志输出
  23. dyld[37030]: 未加载库@rpath/libtbb.dylib
  24. 引用自<AC271190-0BD7-38FF-AFC9-F18DFE088087> /Users/Admin/miniforge3/lib/python3.10/site-packages/prophet/stan_model/prophet_model.bin
  25. 原因尝试'/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
  26. <details>
  27. <summary>英文:</summary>
  28. This is how my dataframe looks like:
  29. [![enter image description here][1]][1]
  30. Then when I try to fit a prophet model, I get this error:
  31. &gt;&gt;&gt; from prophet import Prophet
  32. &gt;&gt;&gt; m = Prophet()
  33. &gt;&gt;&gt; m.fit(df)
  34. 16:35:16 - cmdstanpy - INFO - Chain [1] start processing
  35. 16:35:16 - cmdstanpy - INFO - Chain [1] done processing
  36. 16:35:16 - cmdstanpy - ERROR - Chain [1] error: terminated by signal 6 Unknown error: -6
  37. Optimization terminated abnormally. Falling back to Newton.
  38. 16:36:22 - cmdstanpy - INFO - Chain [1] start processing
  39. 16:36:22 - cmdstanpy - INFO - Chain [1] done processing
  40. 16:36:22 - cmdstanpy - ERROR - Chain [1] error: terminated by signal 6 Unknown error: -6
  41. ---------------------------------------------------------------------------
  42. RuntimeError Traceback (most recent call last)
  43. File ~/miniforge3/lib/python3.10/site-packages/prophet/models.py:96, in CmdStanPyBackend.fit(self, stan_init, stan_data, **kwargs)
  44. 95 try:
  45. ---&gt; 96 self.stan_fit = self.model.optimize(**args)
  46. 97 except RuntimeError as e:
  47. 98 # Fall back on Newton
  48. 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)
  49. 737 else:
  50. --&gt; 738 raise RuntimeError(msg)
  51. 739 mle = CmdStanMLE(runset)
  52. 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:
  53. dyld[37030]: Library not loaded: @rpath/libtbb.dylib
  54. Referenced from: &lt;AC271190-0BD7-38FF-AFC9-F18DFE088087&gt; /Users/Admin/miniforge3/lib/python3.10/site-packages/prophet/stan_model/prophet_model.bin
  55. 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)
  56. During handling of the above exception, another exception occurred:
  57. RuntimeError Traceback (most recent call last)
  58. Input In [7], in &lt;cell line: 3&gt;()
  59. 1 m = Prophet()
  60. ----&gt; 2 m.fit(df)
  61. File ~/miniforge3/lib/python3.10/site-packages/prophet/forecaster.py:1181, in Prophet.fit(self, df, **kwargs)
  62. 1179 self.params = self.stan_backend.sampling(stan_init, dat, self.mcmc_samples, **kwargs)
  63. 1180 else:
  64. -&gt; 1181 self.params = self.stan_backend.fit(stan_init, dat, **kwargs)
  65. 1183 self.stan_fit = self.stan_backend.stan_fit
  66. 1184 # If no changepoints were requested, replace delta with 0s
  67. File ~/miniforge3/lib/python3.10/site-packages/prophet/models.py:103, in CmdStanPyBackend.fit(self, stan_init, stan_data, **kwargs)
  68. 101 logger.warning(&#39;Optimization terminated abnormally. Falling back to Newton.&#39;)
  69. 102 args[&#39;algorithm&#39;] = &#39;Newton&#39;
  70. --&gt; 103 self.stan_fit = self.model.optimize(**args)
  71. 104 params = self.stan_to_dict_numpy(
  72. 105 self.stan_fit.column_names, self.stan_fit.optimized_params_np)
  73. 106 for par in params:
  74. 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)
  75. 736 get_logger().warning(msg)
  76. 737 else:
  77. --&gt; 738 raise RuntimeError(msg)
  78. 739 mle = CmdStanMLE(runset)
  79. 740 return mle
  80. 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:
  81. dyld[37096]: Library not loaded: @rpath/libtbb.dylib
  82. Referenced from: &lt;AC271190-0BD7-38FF-AFC9-F18DFE088087&gt; /Users/Admin/miniforge3/lib/python3.10/site-packages/prophet/stan_model/prophet_model.bin
  83. 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)
  84. Any idea what the problem is? I am on an M1 Mac, if that matters.
  85. [1]: https://i.stack.imgur.com/TP28d.png
  86. </details>
  87. # 答案1
  88. **得分**: 1
  89. 最近遇到了上述错误也许这个帖子对你有帮助 --&gt; https://github.com/facebook/prophet/issues/2354
  90. <details>
  91. <summary>英文:</summary>
  92. Recently ran into the above error, maybe the thread here helps --&gt; https://github.com/facebook/prophet/issues/2354
  93. </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:

确定