-
-
Save cossatot/bb042e307e21134adba497179ca7f35e to your computer and use it in GitHub Desktop.
virgilioamaris
commented
Dec 21, 2019
via email
Sorry, again...
=========
t_start = time.time()
priors = calc_row_likelihood(priors)
t_end = time.time()
print('done with {} calcs in {:.1f} seconds'.format(n_iters, (t_end - t_start)))
done with 100000 calcs in 0.1 seconds
C:\Users\vamaris\AppData\Local\Continuum\anaconda3\lib\site-packages\scipy\stats\stats.py:308: RuntimeWarning: divide by zero encountered in log
log_a = np.log(np.array(a, dtype=dtype))
priors['rel_likelihood'] = priors['likelihood'] / priors['likelihood'].max()
IndexError Traceback (most recent call last)
in
----> 1 priors['rel_likelihood'] = priors['likelihood'] / priors['likelihood'].max()
IndexError: invalid index to scalar variable.
priors.head()
AttributeError Traceback (most recent call last)
in
----> 1 priors.head()
AttributeError: 'numpy.float64' object has no attribute 'head'
As you see Im here.
I see the problem now.
You need to run something like
priors['likelihood'] = priors.apply(calc_row_likelihood, axis=1)
instead of
priors = calc_row_likelihood(priors)
If it doesn't work exactly, read the error messages and try to understand them to find the problem.
Ok. Perfect.
Thank you. It work correctly.
Great, I am glad I could help. Good luck with your research!