Comments (1)
Full traceback:
2024-02-12 12:55:11 - orbit - INFO - Optimizing (PyStan) with algorithm: LBFGS.
2024-02-12 12:55:11 - orbit - INFO - First time in running stan model:ktrlite. Expect 3 - 5 minutes for compilation.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[1], line 15
6 df = pd.DataFrame({
7 "ds": pd.date_range("2021-01-01", "2023-12-31", freq="D"),
8 "y": np.random.normal(size=1095),
9 })
11 ktr = KTR(
12 response_col="y",
13 date_col="ds",
14 )
---> 15 ktr.fit(df)
File /opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/orbit/forecaster/svi.py:36, in SVIForecaster.fit(self, df, point_method, keep_samples, sampling_temperature, **kwargs)
28 def fit(
29 self,
30 df,
(...)
34 **kwargs,
35 ):
---> 36 super().fit(df, sampling_temperature=sampling_temperature, **kwargs)
37 self._point_method = point_method
39 if point_method is not None:
File /opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/orbit/forecaster/forecaster.py:147, in Forecaster.fit(self, df, **kwargs)
145 self._set_training_meta(df)
146 # customize module
--> 147 self._model.set_dynamic_attributes(
148 df=df, training_meta=self.get_training_meta()
149 )
150 # based on the model and df, set training input
151 self.set_training_data_input()
File /opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/orbit/template/ktr.py:1002, in KTRModel.set_dynamic_attributes(self, df, training_meta)
1000 self._set_coefficients_kernel_matrix(df, training_meta)
1001 self._set_knots_scale_matrix(df, training_meta)
-> 1002 self._set_levs_and_seas(df, training_meta)
1003 self._filter_coef_prior(df)
1004 self._set_valid_response_attributes(training_meta)
File /opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/orbit/template/ktr.py:883, in KTRModel._set_levs_and_seas(self, df, training_meta)
865 # use ktrlite to derive levs and seas
866 ktrlite = KTRLite(
867 response_col=response_col,
868 date_col=date_col,
(...)
881 **self.ktrlite_optim_args,
882 )
--> 883 ktrlite.fit(df=df)
884 # self._ktrlite_model = ktrlite
885 ktrlite_pt_posteriors = ktrlite.get_point_posteriors()
File /opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/orbit/forecaster/map.py:23, in MAPForecaster.fit(self, df, **kwargs)
22 def fit(self, df, **kwargs):
---> 23 super().fit(df, **kwargs)
24 posterior_samples = self._posterior_samples
25 map_posterior = {}
File /opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/orbit/forecaster/forecaster.py:162, in Forecaster.fit(self, df, **kwargs)
158 model_param_names = self._model.get_model_param_names()
160 # note that estimator will search for the .stan, .pyro model file based on the
161 # estimator type and model_name provided
--> 162 _posterior_samples, training_metrics = estimator.fit(
163 model_name=model_name,
164 model_param_names=model_param_names,
165 data_input=data_input,
166 fitter=self._model.get_fitter(),
167 init_values=init_values,
168 **kwargs,
169 )
170 self._posterior_samples = _posterior_samples
171 self._training_metrics = training_metrics
File /opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/orbit/estimators/stan_estimator.py:205, in StanEstimatorMAP.fit(self, model_name, model_param_names, data_input, fitter, init_values)
197 def fit(
198 self,
199 model_name,
(...)
203 init_values=None,
204 ):
--> 205 compiled_mod = get_compiled_stan_model(model_name)
206 data_input.update({"T_STAR": 1.0})
208 # passing callable from the model as seen in `initfun1()`
209 # init_values = init_values or self.stan_init
210
211 # in case optimizing fails with given algorithm fallback to `Newton`
212 # init values interface can be referred here: https://cmdstanpy.readthedocs.io/en/stable-0.9.65/api.html
213 # Dict [Str, np.array] where key is the param name and value array dim matches the param dim
File /opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/orbit/utils/stan.py:64, in get_compiled_stan_model(stan_model_name)
60 def get_compiled_stan_model(stan_model_name):
61 """
62 Load compiled Stan model
63 """
---> 64 compiled_model = compile_stan_model(stan_model_name)
65 with open(compiled_model, "rb") as f:
66 return pickle.load(f)
File /opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/orbit/utils/stan.py:52, in compile_stan_model(stan_model_name)
43 if not os.path.isfile(compiled_model) or os.path.getmtime(
44 compiled_model
45 ) < os.path.getmtime(source_model):
47 logger.info(
48 "First time in running stan model:{}. Expect 3 - 5 minutes for compilation.".format(
49 stan_model_name
50 )
51 )
---> 52 sm = CmdStanModel(stan_file=source_model)
54 with open(compiled_model, "wb") as f:
55 pickle.dump(sm, f, protocol=pickle.HIGHEST_PROTOCOL)
File /opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/cmdstanpy/model.py:215, in CmdStanModel.__init__(self, model_name, stan_file, exe_file, force_compile, stanc_options, cpp_options, user_header, compile)
211 if not cmdstan_version_before(
212 2, 27
213 ): # unknown end of version range
214 try:
--> 215 model_info = self.src_info()
216 if 'parameters' in model_info:
217 self._fixed_param |= len(model_info['parameters']) == 0
File /opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/cmdstanpy/model.py:321, in CmdStanModel.src_info(self)
319 if self.stan_file is None or cmdstan_version_before(2, 27):
320 return {}
--> 321 return compilation.src_info(str(self.stan_file), self._compiler_options)
File /opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/cmdstanpy/compilation.py:355, in src_info(stan_file, compiler_options)
353 proc = subprocess.run(cmd, capture_output=True, text=True, check=False)
354 if proc.returncode:
--> 355 raise ValueError(
356 f"Failed to get source info for Stan model "
357 f"'{stan_file}'. Console:\n{proc.stderr}"
358 )
359 result: Dict[str, Any] = json.loads(proc.stdout)
360 return result
ValueError: Failed to get source info for Stan model '/opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/orbit/stan/ktrlite.stan'. Console:
Syntax error in '/opt/homebrew/anaconda3/envs/fido-forecast-expr/lib/python3.9/site-packages/orbit/stan/ktrlite.stan', line 11, column 21 to column 22, parsing error:
-------------------------------------------------
9: int<lower=0> DOF;
10: vector[NUM_OF_OBS] RESPONSE;
11: int WHICH_VALID_RES[N_VALID_RES];
^
12: // trend related
13: int<lower=0> N_KNOTS_LEV;
-------------------------------------------------
";" expected after variable declaration.
from orbit.
Related Issues (20)
- overwrite option for cmdstanpy should be False HOT 1
- Support for Python 3.10
- Support more flexible prediction range or improve documentation about prediction range. HOT 1
- KTR predict method doesn't consider single knot case.
- cannot import name 'DLTFull' from 'orbit.models.dlt' HOT 2
- Forecast is Not connected to latest actuals HOT 1
- cmdstanpy does not find the ktrlite stan file
- Installation fails with LLVM libc++ version 16 on M1 Mac
- Update load_iclaims()
- Add ipywidgets into dependencies
- Explore folder pruning while installing cmdstanpy
- Read the docs update by pruning deprecated .rst files
- Documentation Update for v1.1.4.3
- Question: How to set 'date' frequency to minutes \ seconds? HOT 1
- Running cmdstanpy with `exe_file` arg
- Recover linting github action job on black
- Dockerfile to create image ready for quick fit and forecast
- Error while installing package with pip install orbit-ml (version 1.1.4.6) HOT 5
- fit method fail for Timezone aware timeseries HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orbit.