'Stop Printing INFO:cmdstanpy:start chain 1, INFO:cmdstanpy:finish chain 1
I am running FBProphet with cmdstanpy instead of pystan. For my purpose, I have to run training and predictions multiple times in a jupyter notebook which results in constantly printing :
INFO:cmdstanpy:start chain 1
INFO:cmdstanpy:finish chain 1
The issue arises when I have to run this for more than 10000 models (Im predicting values for each day individually after updating the training set) and which prints 20000 lines. This makes the notebook extremely slow. Is there any way I can stop FBProphet frmo printing these two lines?
Things Ive tried:
- Verbose False gives an error :
TypeError Traceback (most recent call last)
<ipython-input-126-586e1241babb> in <module>
17 model = Prophet(uncertainty_samples=True, weekly_seasonality = True,
18 yearly_seasonality= True, changepoint_prior_scale = 0.5,
---> 19 daily_seasonality=False, verbose = False)
20 model.add_seasonality(name='monthly', period=30.5, fourier_order=2)
TypeError: __init__() got an unexpected keyword argument 'verbose'
- how to control output from fbprophet? This does not supress the output.
Please Advice.
Solution 1:[1]
The logging level can be controlled by the logger option in the CmdStanModel object when it is created:
import logging
logger = logging.getLogger('simple_example')
logger.setLevel(logging.WARNING)
CmdStanModel(stan_file=your_path,logger=logger)
See https://docs.python.org/3/howto/logging.html#logging-levels for more options. The above just creates a custom logger so that only warning-level messages will be printed, rather than the default info-level as defined in the CmdStanPy utils (https://cmdstanpy.readthedocs.io/en/v0.9.67/_modules/cmdstanpy/utils.html)
Solution 2:[2]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | GC83 |
| Solution 2 | uniquegino |
