Skip to content

BUG: Typiclust fails for datasets with duplicate instances #451

Closed

Description

@tpham93

Describe the issue:

Typiclust fails if a clusters have zero instances assigned

Reproduce the bug via a code example:

typi_clust = TypiClust(random_state=0, k=3)
X_dup = X[[1, 0, 0, 0, 0, 0, 0, 0, 0]]
y_dup = [np.nan]*len(X_dup)
typi_clust.query(
    X_dup, y_dup, batch_size=6, return_utilities=True
)

Error message:

skactiveml/pool/tests/test_typi_clust.py: 100 warnings
  C:\Users\tpham\anaconda3\envs\skaml\lib\site-packages\sklearn\base.py:1473: ConvergenceWarning: Number of distinct clusters (2) found smaller than n_clusters (6). Possibly due to duplicate points in X.
    return fit_method(estimator, *args, **kwargs)

skactiveml/pool/tests/test_typi_clust.py: 312 warnings
  c:\Users\tpham\Desktop\Arbeit\scikit-activeml\skactiveml\pool\_typi_clust.py:218: RuntimeWarning: divide by zero encountered in reciprocal
    typi = ((1 / k) * knn) ** (-1)

Context for the issue:

No response

Activity

  1. linked a pull request that will close this issueDevelopment #453on Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions