[go: up one dir, main page]

Skip to content
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

Possible bug in Resampler #148

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/qinfer/resamplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,8 @@ def __call__(self, model, particle_dist,
n_iters += 1

# Draw x_i from N(mu_i, S).
new_locs[idxs_to_resample, :] = mus + np.dot(S, self._kernel(n_rvs, mus.shape[0])).T
mus_temp = mus[idxs_to_resample, :]
new_locs[idxs_to_resample, :] = mus_temp + np.dot(S, self._kernel(n_rvs, mus_temp.shape[0])).T

# Now we remove from the list any valid models.
# We write it out in a longer form than is strictly necessary so
Expand Down Expand Up @@ -369,7 +370,7 @@ def __call__(self, model, particle_dist,
# This may look a little weird, but it should delete the unused
# elements of js, so that we don't need to reallocate.
js = js[np.logical_not(valid_mask)]
mus = mus[:idxs_to_resample.size, :]


if idxs_to_resample.size:
# We failed to force all models to be valid within maxiter attempts.
Expand Down