Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[MXNET-173]fix acc metric shape miss match #10446

Merged
merged 4 commits into from
Apr 11, 2018

Conversation

roywei
Copy link
Member

@roywei roywei commented Apr 6, 2018

Description

fix issue #2116
This only happens when label is provided in 2D array through custom data iterator, it was not affecting major use cases because most of the time, the labels are provided in 1D or built in iterators.
The root cause is label and pred_label in 'acc' metric have different shapes during check_label_shapes. It's similar to 'ce' metric which works fine because it ravel the label shape before check.
Flatten label and pred_label for equal comparison, and 'acc' needed flattened result anyway

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with MXNET-173
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • Flatten pre_label and label for equal comparison, the metric need to return flattened result anyway

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

@roywei roywei requested a review from szha as a code owner April 6, 2018 20:58
@roywei roywei changed the title [WIP][MXNET-173]fix acc metric shape miss match [MXNET-173]fix acc metric shape miss match Apr 6, 2018
@roywei roywei force-pushed the metric_shape_miss_match branch 2 times, most recently from 4232318 to bf7d7db Compare April 8, 2018 22:48
@Roshrini
Copy link
Member

Roshrini commented Apr 9, 2018

@reminisce @sandeep-krishnamurthy Can you review?

@roywei
Copy link
Member Author

roywei commented Apr 10, 2018

@hetong007 could you help to take a look at this in metric.py? Thanks!

@hetong007
Copy link
Contributor

@roywei can you please add test for it? I see you checked "All changes have test coverage" but find no related change.

@roywei roywei force-pushed the metric_shape_miss_match branch from bf7d7db to 0944d6d Compare April 10, 2018 19:28
@roywei
Copy link
Member Author

roywei commented Apr 10, 2018

@hetong007 updated with unit test

Copy link
Contributor

@sandeep-krishnamurthy sandeep-krishnamurthy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@roywei roywei force-pushed the metric_shape_miss_match branch from 7329675 to 7c0f54a Compare April 10, 2018 20:52
@hetong007 hetong007 merged commit e42f7e0 into apache:master Apr 11, 2018
rahul003 pushed a commit to rahul003/mxnet that referenced this pull request Jun 4, 2018
* fix acc metric shape miss match

* add unit test

* fix style

* fix python2 division
zheng-da pushed a commit to zheng-da/incubator-mxnet that referenced this pull request Jun 28, 2018
* fix acc metric shape miss match

* add unit test

* fix style

* fix python2 division
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants