Skip to content

Prevent repeated checking and typecasting in check_pairwise #3807

Closed
@MechCoder

Description

@MechCoder

In this Pull Request #3802 , around 0.5s out of 1.2s is spent in check_pairwise_arrays which is huge, because I call pairwise_distances_argmin_min repeatedly.

  1. There is dtype casting two times in check_pairwiseto make sure X and Y are float, first is to convert it into a ndarray, and the second is to cast it into float. Should there be a dtype argument provided externally so that lines from https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/metrics/pairwise.py#L98 to L104 can be removed.
  2. Should there be a check_input=False argument in the various metrics to avoid multiple checking of the input arrays? so that the user can override check_pairwise_arrays

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