Closed ljschumacher closed 3 years ago
Sorry @ljschumacher , this issue must have gotten lost. Does this problem only occur if you set the initial population size rather low?
I'm not sure as it's been a while but I think yes. I can't say whether the initial size was low, but it was resolved by increasing it.
Hi @ljschumacher , closing here. Feel free to reopen if the issue persists.
When using the AdaptivePopulationSize strategy I sometimes get the following error, which seems to be mitigated if I increase the starting population size `/usr/local/lib/python3.7/site-packages/scipy/stats/stats.py:1072: RuntimeWarning: invalid value encountered in true_divide return a.std(axis) / a.mean(axis) EE
Traceback (most recent call last): ... history = abc_runner.run(minimum_epsilon=5, max_nr_populations=number_of_smc_populations) File "/usr/local/lib/python3.7/site-packages/pyabc/smc.py", line 917, in run t+1, sample, population, acceptance_rate) File "/usr/local/lib/python3.7/site-packages/pyabc/smc.py", line 965, in _prepare_next_iteration self._adapt_population_size(t) File "/usr/local/lib/python3.7/site-packages/pyabc/smc.py", line 1043, in _adapt_population_size self.population_size.update(copied_transitions, w, t) File "/usr/local/lib/python3.7/site-packages/pyabc/populationstrategy.py", line 212, in update lambda nr_particles: calc_cv(nr_particles, model_weights, File "/usr/local/lib/python3.7/site-packages/pyabc/transition/predict_population_size.py", line 53, in predict_population_size popt, f, finv = fitpowerlaw(n_sampleslist, cvs) File "/usr/local/lib/python3.7/site-packages/pyabc/cv/powerlaw.py", line 16, in fitpowerlaw popt, = curve_fit(power_law, x, y, p0=[.5, 1 / 5]) File "/usr/local/lib/python3.7/site-packages/scipy/optimize/minpack.py", line 713, in curve_fit ydata = np.asarray_chkfinite(ydata, float) File "/usr/local/lib/python3.7/site-packages/numpy/lib/function_base.py", line 486, in asarray_chkfinite "array must not contain infs or NaNs") ValueError: array must not contain infs or NaNs`
I suspect this issue comes about in the CV estimation when they are too few particles?
My suggestion would be to either add a warning or a more informative error message