(env) ➜ src git:(master) python3 dhmm.py --likelihood gaussian --data ../data/toy_x.csv \
--input ../data/toy_t.csv --test-input ../data/toy_test_t.csv --init ../data/toy_init.pkl \
--output-file out/toy_opt.pkl --opt --num-components 2 --iter 10000 --lengthscale 1.0
Using cached StanModel
STAN OPTIMIZATION COMMAND (LBFGS)
init = user
save_iterations = 1
init_alpha = 0.001
tol_obj = 1e-12
tol_grad = 1e-08
tol_param = 1e-08
tol_rel_obj = 10000
tol_rel_grad = 1e+07
history_size = 5
seed = 0
initial log joint probability = -2662.82
Iter log prob ||dx|| ||grad|| alpha alpha0 # evals Notes
Error evaluating model log probability: Non-finite gradient.
Error evaluating model log probability: Non-finite gradient.
Error evaluating model log probability: Non-finite gradient.
Error evaluating model log probability: Non-finite gradient.
Error evaluating model log probability: Non-finite gradient.
...
Error evaluating model log probability: Non-finite gradient.
Error evaluating model log probability: Non-finite gradient.
Error evaluating model log probability: Non-finite gradient.
25 -362.584 4.79461e-08 1.52197e+11 1e-12 0.001 300 LS failed, Hessian reset
Optimization terminated with error:
Line search failed to achieve a sufficient decrease, no more progress can be made
(env) ➜ src git:(master) python3 dhmm.py --likelihood gaussian --data ../data/toy_x.csv \
--input ../data/toy_t.csv --test-input ../data/toy_test_t.csv --init ../data/toy_init.pkl \
--output-file out/toy_opt.pkl --vb --num-components 2 --iter 10000 --lengthscale 1.0
Using cached StanModel
This is Automatic Differentiation Variational Inference.
(EXPERIMENTAL ALGORITHM: expect frequent updates to the procedure.)
Gradient evaluation took 0.048721 seconds
1000 iterations under these settings should take 48.721 seconds.
Adjust your expectations accordingly!
# Begin eta adaptation.
Traceback (most recent call last):
File "dhmm.py", line 112, in <module>
output_samples=args.samples,
File "dhmm.py", line 39, in dhmm
data=data, verbose=True, seed=seed, **kwargs
File ".../src/cache.py", line 75, in stan_cache
return sm.vb(**kwargs)
File "/usr/local/lib/python3.5/site-packages/pystan/model.py", line 878, in vb
ret, sample = fit._call_sampler(stan_args)
File "stanfit4anon_model_8e8a301e317be9d54c577c5c41e69425_3362315270486115224.pyx", line 804, in stanfit4anon_model_8e8a301e317be9d54c577c5c41e69425_3362315270486115224.StanFit4Model._call_sampler (/var/folders/bw/n0kn7tm92171m6s4_dy83f_m0000gn/T/tmp741ifeld/stanfit4anon_model_8e8a301e317be9d54c577c5c41e69425_3362315270486115224.cpp:15590)
File "stanfit4anon_model_8e8a301e317be9d54c577c5c41e69425_3362315270486115224.pyx", line 398, in stanfit4anon_model_8e8a301e317be9d54c577c5c41e69425_3362315270486115224._call_sampler (/var/folders/bw/n0kn7tm92171m6s4_dy83f_m0000gn/T/tmp741ifeld/stanfit4anon_model_8e8a301e317be9d54c577c5c41e69425_3362315270486115224.cpp:8454)
ValueError: stan::variational::advi::adapt_eta: Cannot compute ELBO using the initial variational distribution. Your model may be either severely ill-conditioned or misspecified.
(env) ➜ src git:(master) python3 dhmm.py --likelihood gaussian --data ../data/toy_x.csv --input ../data/toy_t.csv --test-input ../data/toy_test_t.csv --output-file out/toy.pkl --sample --num-components 2 --iter 10000 --lengthscale 1.0
Using cached StanModel
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "stanfit4anon_model_8e8a301e317be9d54c577c5c41e69425_3362315270486115224.pyx", line 365, in stanfit4anon_model_8e8a301e317be9d54c577c5c41e69425_3362315270486115224._call_sampler_star (/var/folders/bw/n0kn7tm92171m6s4_dy83f_m0000gn/T/tmp741ifeld/stanfit4anon_model_8e8a301e317be9d54c577c5c41e69425_3362315270486115224.cpp:7820)
File "stanfit4anon_model_8e8a301e317be9d54c577c5c41e69425_3362315270486115224.pyx", line 398, in stanfit4anon_model_8e8a301e317be9d54c577c5c41e69425_3362315270486115224._call_sampler (/var/folders/bw/n0kn7tm92171m6s4_dy83f_m0000gn/T/tmp741ifeld/stanfit4anon_model_8e8a301e317be9d54c577c5c41e69425_3362315270486115224.cpp:8454)
RuntimeError: Rejecting initial value:
Log probability evaluates to log(0), i.e. negative infinity.
Stan can't start sampling from this initial value.
Rejecting initial value:
Log probability evaluates to log(0), i.e. negative infinity.
Stan can't start sampling from this initial value.
... (continues for a while with the same error) ...
Initialization between (-2, 2) failed after 100 attempts.
Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.
... (then same thing for other chains) ...
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> <dhmm_gaussian.stan>
--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/h4Xmp-qq3KA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.

I don't see any error message there. Are you using the latest
PyStan? This may just mean that some of the arithmetic underflows
to zero before having log assigned.
You can print out target() as you go:
print("1: target = ", target());
...
print("2: target = ", target());
and so on to try to figure out where the negative infinity is getting
introduced. It may be that some of the arithmetic can be made
more robust by working directly on the log scale.
- Bob
P.S. There should be a comma after "i.e.".
> On Jan 3, 2017, at 4:39 PM, cdip...@g.hmc.edu wrote:
>
> Attached is the output using random inits for {sampling, vb, opt}. All of them have negative infinity log probability (throwing a
> RuntimeError: Rejecting initial value), which given what you said would imply that my model is ill-defined with respect to the constraints?
>
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
> <rand_init_opt.out><rand_init_sample.out><rand_init_vb.out>
--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/h4Xmp-qq3KA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.
> > To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
> > To post to this group, send email to stan-...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
> > <rand_init_opt.out><rand_init_sample.out><rand_init_vb.out>
>
> --
> You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/h4Xmp-qq3KA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.
> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/h4Xmp-qq3KA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.