Skip to content

Commit

Permalink
Bugfix in DISE because labels were not used
Browse files Browse the repository at this point in the history
  • Loading branch information
FarnazH committed Nov 12, 2023
1 parent d8c7fff commit 183e253
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion selector/methods/distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def select_from_cluster(self, X, size, labels=None):
raise ValueError(
f"ref_index is not less than the number of samples; {self.ref_index} >= {len(X)}."
)
# pass subset of X to optimize_radius if cluster_ids is not None
# pass subset of X to optimize_radius if labels is not None
if labels is not None:
X = X[labels]
return optimize_radius(self, X, size, labels)
Expand Down Expand Up @@ -493,6 +493,10 @@ def select_from_cluster(self, X, size, labels=None):
raise ValueError(
f"ref_index is not less than the number of samples; {self.ref_index} >= {len(X)}."
)
# pass subset of X to optimize_radius if labels is not None
if labels is not None:
X = X[labels]

if X.shape[0] < size:
raise RuntimeError(
f"Number of samples is less than the requested sample size: {X.shape[0]} < {size}."
Expand Down

0 comments on commit 183e253

Please sign in to comment.