jakeret / abcpmc

Approximate Bayesian Computation Population Monte Carlo
GNU General Public License v3.0
39 stars 19 forks source link

Solution for pool.dists =[] #21

Open JinfengM opened 2 years ago

JinfengM commented 2 years ago

When the code "eps.eps = np.percentile(pool.dists, alpha, axis=0) " raised a exception, this might because pool.dists is null. My solution is adding the following code: res = self.mapFunc(wrapper, range(self.N))

    res_thetas=copy.deepcopy(res)
    res_dists=copy.deepcopy(res)
    res_cnts=copy.deepcopy(res)

    #res = self.mapFunc(wrapper, range(self.N))

    thetas = np.array([theta for (theta, _, _) in res_thetas])
    print('thetas is : {0}'.format(thetas))

    dists = np.array([dist for (_, dist, _) in res_dists])
    print('dists is : {0}'.format(dists))

    cnts = np.sum([cnt for (_, _, cnt) in res_cnts])
    print('cnts is : {0}'.format(cnts))
    ws = np.ones(self.N) / self.N

the same for "res = self.mapFunc(particleProposal, range(self.N))"