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

wondering if the coreset sampling is only random sampling now #46

Open
YuchenKid opened this issue Jul 4, 2022 · 0 comments
Open

wondering if the coreset sampling is only random sampling now #46

YuchenKid opened this issue Jul 4, 2022 · 0 comments

Comments

@YuchenKid
Copy link

If I understand correctly, the kCenterGreedy.select_batch_ function is merely doing random sampling now. The main reason is that self.already_selected is not updated within the range(N) loop, therefore line 'ind = np.random.choice(np.arange(self.n_obs))' is always executed. To fix it, put self.already_selected = new_batch into the range(N) loop.

Please point it out if I misunderstood anything!

for _ in range(N):
if not self.already_selected:
# Initialize centers with a randomly selected datapoint
ind = np.random.choice(np.arange(self.n_obs))
else:
ind = np.argmax(self.min_distances)
# New examples should not be in already selected since those points
# should have min_distance of zero to a cluster center.
assert ind not in already_selected

  self.update_distances([ind], only_new=True, reset_dist=False)
  new_batch.append(ind)
  print('Maximum distance from cluster centers is %0.2f' % max(self.min_distances))

  self.already_selected = new_batch#already_selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant