Skip to content

Remove "warn_on_dtype" from check_array #13324

Closed

Description

@amueller

We're not using warn_on_dtype any more (see #13306) and so we should deprecate it.

Activity

  1. added
    Easy
    good first issue
    on Feb 28, 2019
  2. amueller commented on Feb 28, 2019

    @amueller
    MemberAuthor

    Actually, it's still used in check_pairwise_array. Do we want to keep it there?

  3. 2sang commented on Feb 28, 2019

    @2sang

    Where could I find the function check_pairwise_array you mentioned?

  4. jnothman commented on Mar 1, 2019

    @jnothman
    Member
  5. added a commit that references this issue on Mar 11, 2019
  6. jnothman commented on Mar 12, 2019

    @jnothman
    Member

    I'm not inspired by its use in pairwise... Happy to see it go. What would you change if you received that warning?

  7. jnothman commented on Mar 12, 2019

    @jnothman
    Member

    I suppose you'd consider casting your data first to avoid repeated recasting??

  8. praths007 commented on Mar 13, 2019

    @praths007
    Contributor

    Assuming that no warnings should be issued for datatype changes in arrays. If warn_on_dtype were to be removed from check_pairwise_array, shouldn't the parameter be removed from check_array (under /validation) as well? Because apart from check_pairwise_array no other method passes warn_on_dtype parameter to it.

    Or is the assumption wrong and this feature of issuing warnings on type changes will be required going forward?

  9. jnothman commented on Mar 13, 2019

    @jnothman
    Member
  10. praths007 commented on Mar 13, 2019

    @praths007
    Contributor

    should that be done in a different PR? Because it might involve updating test cases under /pairwise and /validation

  11. jnothman commented on Mar 17, 2019

    @jnothman
    Member

    Sorry, I didn't understand the usage. There is no warn_on_dtype parameter to check_pairwise_arrays, it only makes use of check_array's warn_on_dtype parameter. We would only need to remove its usage in check_pairwise_arrays and deprecate its acceptance in check_array.

    I don't know whether the warning is useful in pairwise metrics. @amueller?

  12. NicolasHug commented on Mar 23, 2019

    @NicolasHug
    Member

    I don't know whether the warning is useful in pairwise metrics. @amueller?

    Here's what I found:

    1. check_pairwise_arrays is the only tool that makes use of the warn_on_dtype parameter of check_array. This is only the case when the dtype parameter of check_pairwise_arrays is not None.
    2. The only call to check_pairwise_arrays with a non-None dtype is in pairwise_distances(), for these metrics only:
    # These distances recquire boolean arrays, when using scipy.spatial.distance
    PAIRWISE_BOOLEAN_FUNCTIONS = [
        'dice',
        'jaccard',
        'kulsinski',
        'matching',
        'rogerstanimoto',
        'russellrao',
        'sokalmichener',
        'sokalsneath',
        'yule',
    ]

    This was introduced in #6932. We need this because scipy computations are wrong if the arrays are floats: see #4523 (comment) for a summary.


    May I propose the following:

    The input data need to be converted to bool for boolean metric {metric}. This will create a copy. To remove this warning, explicitly convert the data using e.g. X = X.astype(np.bool) (same for Y if needed).

  13. jnothman commented on Mar 24, 2019

    @jnothman
    Member
  14. MohammedKhandwawala commented on Mar 26, 2019

    @MohammedKhandwawala

    @amueller is anyone working on this? or can i take this issue.

  15. NicolasHug commented on Mar 26, 2019

    @NicolasHug
    Member

    @MohammedKhandwawala you can see in the feed here things like

    Someone referenced this issue xx days ago

    these are often pull requests addressing the issue (but not always).

    Sorry, we're not good at updating labels

  16. rth commented on Jul 3, 2019

    @rth
    Member

    @NicolasHug This was fully fixed in #13382, right? Then we can also close #13434?

  17. NicolasHug commented on Jul 4, 2019

    @NicolasHug
    Member

    Yes, thanks for the reminder! Closing both issues

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

    Easygood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions