error with analytical solver with collapsing bound and noise > 1
When I try to run a DDM with noise > 1 and a linear collapsing bound using the analytical solver, I get errors such as the following (see below).
I think it has something to do with the collapsing bound, since it doesn't happen with the same model where I've set the slope on the collapse = 0. It happens at the outset of running the model. It does not happen with the numerical solver.
I am probably just going to work around this at the moment, but I wanted to note the issue.
Traceback (most recent call last):
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/multiprocess/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/multiprocess/pool.py", line 48, in mapstar
return list(map(*args))
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/paranoid_scientist-0.2.2-py3.9.egg/paranoid/decorators.py", line 114, in _decorated
return func(*args, **kwargs)
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/pyddm-0.5.2-py3.9.egg/ddm/model.py", line 510, in solve
return self.solve_analytical(conditions=conditions)
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/paranoid_scientist-0.2.2-py3.9.egg/paranoid/decorators.py", line 114, in _decorated
return func(*args, **kwargs)
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/pyddm-0.5.2-py3.9.egg/ddm/model.py", line 544, in solve_analytical
anal_pdf_corr, anal_pdf_err = analytic_ddm(self.get_dependence("drift").get_drift(t=0, conditions=conditions),
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/pyddm-0.5.2-py3.9.egg/ddm/analytic.py", line 93, in analytic_ddm
dist_cor = analytic_ddm_linbound(b_upper, -drift+b_slope, -b_lower, -drift-b_slope, teval_valid)
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/pyddm-0.5.2-py3.9.egg/ddm/analytic.py", line 41, in analytic_ddm_linbound
np.exp(tmp*(n+1)*(n*a1-(n+1)*a2))*((2*n+1)*a1-2*(n+1)*a2)
FloatingPointError: overflow encountered in exp
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/nathan/Dropbox/Goldlab/correlated/doFit_realsubj.py", line 187, in <module>
main()
File "/Users/nathan/Dropbox/Goldlab/correlated/doFit_realsubj.py", line 169, in main
model_fit = gdw.run_model(sample,model=model,subj=subj,sess=sess,it=it,
File "/Users/nathan/Dropbox/Goldlab/correlated/gddmwrapper/base.py", line 110, in run_model
model_fit = fit_adjust_model(sample=sample, model=model,**kwargs)
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/pyddm-0.5.2-py3.9.egg/ddm/functions.py", line 347, in fit_adjust_model
x_fit = differential_evolution(_fit_model, constraints, **fitparams)
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/scipy/optimize/_differentialevolution.py", line 392, in differential_evolution
ret = solver.solve()
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/scipy/optimize/_differentialevolution.py", line 984, in solve
self._calculate_population_energies(
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/scipy/optimize/_differentialevolution.py", line 1116, in _calculate_population_energies
calc_energies = list(
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/scipy/_lib/_util.py", line 407, in __call__
return self.f(x, *self.args)
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/pyddm-0.5.2-py3.9.egg/ddm/functions.py", line 329, in _fit_model
lossf = lf.loss(m)
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/paranoid_scientist-0.2.2-py3.9.egg/paranoid/decorators.py", line 114, in _decorated
return func(*args, **kwargs)
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/pyddm-0.5.2-py3.9.egg/ddm/models/loss.py", line 170, in loss
sols = self.cache_by_conditions(model)
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/pyddm-0.5.2-py3.9.egg/ddm/models/loss.py", line 96, in cache_by_conditions
return solve_all_conditions(model, self.sample, conditions=self.required_conditions, method=self.method)
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/pyddm-0.5.2-py3.9.egg/ddm/functions.py", line 484, in solve_all_conditions
sols = _parallel_pool.map(meth, conds, chunksize=1)
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/multiprocess/pool.py", line 364, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/Users/nathan/opt/miniconda3-x86/lib/python3.9/site-packages/multiprocess/pool.py", line 771, in get
raise self._value
FloatingPointError: overflow encountered in exp
Thanks for the bug report! I can't seem to replicate this though - could you please provide an example model/parameters which has this error?
Here is an example of the models I'm running (I've run w/ other noise values than this, but this is one example):
Thanks, Nathan
import numpy as np
from ddm import Model, Fittable, Drift
from ddm.models import NoiseConstant, BoundCollapsingLinear
from ddm.models import OverlayChain, OverlayNonDecision, OverlayUniformMixture
class DriftSNR(Drift):
name = 'Drift depends linearly on SNR'
required_parameters = ['driftSNR']
required_conditions = ['mu']
def get_drift(self, conditions, **kwargs):
return self.driftSNR * np.abs(conditions['mu'])
ddm_baseCL = Model(name='baseCL',
drift=DriftSNR(driftSNR=Fittable(minval=0.1, maxval=30)),
noise=NoiseConstant(noise=1.34),
bound=BoundCollapsingLinear(B=Fittable(minval=0.1, maxval=6),
t=Fittable(minval=0.0,maxval=6)),
overlay=OverlayChain(overlays=[OverlayNonDecision(nondectime=Fittable(minval=0, maxval=3)),
OverlayUniformMixture(umixturecoef=Fittable(minval=0.001, maxval=0.3))]),
dx=0.005, dt=0.005, T_dur=16)
I have tried a couple examples by plugging in values to your "Fittable" values and still can't seem to reproduce it. Does this happen on the latest version (with the C solver)? If so, could you please provide a few specific values for the Fittables so that I can reproduce it? I just need one specific case which causes the error to debug it. Thanks!