Skip to content

silhouette_samples/silhouette_score: metric_params collides with pinned arguments #713

Closed

Description

@SomSamantray

Problem

Passing metric_params={"be": ...} (or **kwds with be) to tslearn.clustering.silhouette_samples raises TypeError: got multiple values for keyword argument 'be', because the kwds are merged into metric_params_ and splatted into a call that already pins be=be.

Suggested fix

Treat be like n_jobs/verbose: strip it from metric_params_ (the backend is already pinned by instantiate_backend(X)), or explicitly reject it with a clear message. At minimum, document that be cannot be forwarded.

Metadata

Severity: P2
Confidence: 100
Reviewer(s): adversarial (ce-code-review run 20260821-221628-4e205155 on PR #703)
Finding ID: tslearn/clustering/utils.py:347 metric_params={'be': ...} collides with the backend argument

Activity

  1. charavelg commented on Aug 26, 2026

    @charavelg
    Contributor

    I guess the same is true fro silhouette_score, with the addition of the verbose param not being properly handled in silhouette_score.
    Also metric_params parameter documentations of both function need to be updated accordingly.

    Would be nice to pack this into a single PR.

  2. changed the title [-]silhouette_samples: metric_params containing 'be' collides with pinned backend argument[/-] [+]silhouette_samples/silhouette_score: metric_params collides with pinned arguments[/+] on Aug 26, 2026
  3. WilliamK112 commented on Aug 26, 2026

    @WilliamK112
    Contributor

    I would like to take this and include the matching silhouette_score behavior noted above in one focused PR. I will strip backend/parallelism parameters that are already pinned by the public arguments before forwarding metric parameters, document the override behavior for both functions, and add regression tests for both metric_params and direct keyword input. I will leave the separate precomputed behavior from #714 unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions