Open Cooliebaj opened 9 months ago
I'm also with the same problem... digging deeper into the logs I saw that this error is being raised in cmdstanpy backend.
RuntimeError: Error during optimization! Command '/home/victor/Projects/Infra/natto-forecaster/venv/lib/python3.9/site-packages/prophet/stan_model/prophet_model.bin random seed=99561 data file=/tmp/tmpdy1bc6ti/l6ubkhnj.json init=/tmp/tmpdy1bc6ti/5gzpegdq.json output file=/tmp/tmpdy1bc6ti/prophet_modelxvyk50xw/prophet_model-20231201112246.csv method=optimize algorithm=newton iter=10000' failed: console log output:
method = optimize
optimize
algorithm = newton
newton
jacobian = 0 (Default)
iter = 10000
save_iterations = 0 (Default)
id = 1 (Default)
data
file = /tmp/tmpdy1bc6ti/l6ubkhnj.json
init = /tmp/tmpdy1bc6ti/5gzpegdq.json
random
seed = 99561
output
file = /tmp/tmpdy1bc6ti/prophet_modelxvyk50xw/prophet_model-20231201112246.csv
diagnostic_file = (Default)
refresh = 100 (Default)
sig_figs = -1 (Default)
profile_file = profile.csv (Default)
num_threads = 1 (Default)
Rejecting initial value:
Error evaluating the log probability at the initial value.
Exception: normal_lpdf: Random variable is nan, but must be not nan! (in 'prophet.stan', line 130, column 2 to column 19)
Initialization between (-2, 2) failed after 1 attempts.
Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.
Initialization failed.
I've already tried changing the parameters, specifying initial values and clearing Nan values but, since doesn't seem to be in Prophet initialization, any of them worked. My code if needed:
# Create a new Prophet model with the loaded parameters
prophet_model = Prophet(**model)
# Fit the model with the data
df_for_prophet = data[["DTNEG", "QTDNEG"]].rename(
columns={"DTNEG": "ds", "QTDNEG": "y"}
)
# Convert 'y' column to numeric, coercing errors
df_for_prophet["y"] = pd.to_numeric(df_for_prophet["y"], errors="coerce")
# Drop rows with NaN values after conversion
df_for_prophet = df_for_prophet.dropna(subset=["y"])
# Set options to display more rows and columns
pd.set_option("display.max_rows", None)
pd.set_option("display.max_columns", None)
# print(
# {
# "pickle_parameters": {**model},
# "Loaded Prophet model for product": product,
# "model_name": model_name,
# "df": df_for_prophet,
# }
# )
prophet_model.fit(df_for_prophet) # error is being raised inside this function
# Reset display options to default values
pd.reset_option("display.max_rows")
pd.reset_option("display.max_columns")
Thanks in advance
Same problem, prophet 1.1.5:
16:35:26 - cmdstanpy - INFO - Chain [1] start processing 16:35:26 - cmdstanpy - INFO - Chain [1] done processing 16:35:26 - cmdstanpy - ERROR - Chain [1] error: terminated by signal 3221225657 Optimization terminated abnormally. Falling back to Newton. 16:35:27 - cmdstanpy - INFO - Chain [1] start processing 16:35:27 - cmdstanpy - INFO - Chain [1] done processing 16:35:27 - cmdstanpy - ERROR - Chain [1] error: terminated by signal 3221225657 Traceback (most recent call last): File "C:\Users\danyb\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\prophet\models.py", line 121, in fit self.stan_fit = self.model.optimize(**args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\danyb\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\cmdstanpy\model.py", line 659, in optimize raise RuntimeError(msg) RuntimeError: Error during optimization! Command 'C:\Users\danyb\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\prophet\stan_model\prophet_model.bin random seed=82529 data file=C:\Users\danyb\AppData\Local\Temp\tmpz_z9dcxk\chl1mqe7.json init=C:\Users\danyb\AppData\Local\Temp\tmpz_z9dcxk\cfjxi_pi.json output file=C:\Users\danyb\AppData\Local\Temp\tmpz_z9dcxk\prophet_modelq8hb3fxt\prophet_model-20240421163526.csv method=optimize algorithm=lbfgs iter=10000' failed:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "d:\Uni\3 anno\1 sem\AI\progetti_corso_AI\progetto_finale\src\fbprophet\fbprhphet_prova.py", line 73, in
hi Borgna02. I had the same problem like you about the
_self.stanfit = self.model.optimize(**args)
I want to ask you how to handle this error if you already solve it
hi Borgna02. I had the same problem like you about the
_self.stanfit = self.model.optimize(**args)
I want to ask you how to handle this error if you already solve it
Hi, i solved it executing the script on ubuntu 22.04, prophet 1.1.1 and holidays 0.18.0.
I don't know if at the moment is possible to execute it on windows..
I've tried using Prophet 1.1.1 and holidays 0.18.0 on Windows 11, but I'm still encountering the same error.
Please Help asap I have a project due in a couple days and I am trying to use prophet here is my code and error message. I am creating a stock market prediction web app. Every time I put in code for m=prophet() and try to use it this is what I get.
RuntimeError: Error during optimization! Command 'C:\Users\jorba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\prophet\stan_model\prophet_model.bin random seed=47623 data file=C:\Users\jorba\AppData\Local\Temp\tmpdettfxal\x5flnp8b.json init=C:\Users\jorba\AppData\Local\Temp\tmpdettfxal\g2_1pp2n.json output file=C:\Users\jorba\AppData\Local\Temp\tmpdettfxal\prophet_modeli_5ct35q\prophet_model-20231201164815.csv method=optimize algorithm=newton iter=10000' failed: Traceback: File "C:\Users\jorba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 534, in _run_script exec(code, module.dict) File "C:\Users\jorba\PROJECT.py", line 47, in
m.fit(df_train)
File "C:\Users\jorba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\prophet\forecaster.py", line 1232, in fit
self.params = self.stan_backend.fit(stan_init, dat, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jorba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\prophet\models.py", line 128, in fit
self.stan_fit = self.model.optimize(args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jorba\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\cmdstanpy\model.py", line 696, in optimize
raise RuntimeError(msg)
PROJECT.txt