-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blobs function error #407
Comments
This is an issue with your log-posterior. The line above should be returning a single value, not a tuple. |
Thx. <''' def log_prior(params): def log_like(params): def log_prob(params): coords = np.random.randn(32, 3) log_prior_samps = sampler.get_blobs() print(log_prior_samps.shape) # (100, 32) ''' In another hand, my program ran for a long time before it went wrong. |
The problem is with the |
Thank you for your meticulous debugging. This is the cause of the error, and now the problem is resolved. |
General information:
Problem description:
Expected behavior:
Blobs function
Actual behavior:
After running normally for some time, an error is reported:
378012 Traceback (most recent call last):
378013 File "/home/yuebb/.local/lib/python3.9/site-packages/emcee/ensemble.py", line 492, in compute_log_prob
378014 log_prob = np.array([float(l[0]) for l in results])
378015 File "/home/yuebb/.local/lib/python3.9/site-packages/emcee/ensemble.py", line 492, in
378016 log_prob = np.array([float(l[0]) for l in results])
378017 TypeError: 'float' object is not subscriptable
378018
378019 During handling of the above exception, another exception occurred:
378020
378021 Traceback (most recent call last):
378022 File "/public/data/yuebb/Neutrino/SkyWalker/bin/JUNOMCMC/JUNO_C13_Pool.py", line 146, in
378023 sampler.run_mcmc(starting_guesses, nsteps)
378024 File "/home/yuebb/.local/lib/python3.9/site-packages/emcee/ensemble.py", line 443, in run_mcmc
378025 for results in self.sample(initial_state, iterations=nsteps, **kwargs):
378026 File "/home/yuebb/.local/lib/python3.9/site-packages/emcee/ensemble.py", line 402, in sample
378027 state, accepted = move.propose(model, state)
378028 File "/home/yuebb/.local/lib/python3.9/site-packages/emcee/moves/red_blue.py", line 93, in propose
378029 new_log_probs, new_blobs = model.compute_log_prob_fn(q)
378030 File "/home/yuebb/.local/lib/python3.9/site-packages/emcee/ensemble.py", line 495, in compute_log_prob
378031 log_prob = np.array([float(l) for l in results])
378032 File "/home/yuebb/.local/lib/python3.9/site-packages/emcee/ensemble.py", line 495, in
378033 log_prob = np.array([float(l) for l in results])
378034 TypeError: float() argument must be a string or a number, not 'tuple'
What have you tried so far?:
Minimal example:
The text was updated successfully, but these errors were encountered: