Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Metrics] Sklearn metrics #1305

Closed
justusschock opened this issue Mar 30, 2020 · 5 comments · Fixed by #1327
Closed

[Metrics] Sklearn metrics #1305

justusschock opened this issue Mar 30, 2020 · 5 comments · Fixed by #1327
Assignees
Labels
discussion In a discussion stage feature Is an improvement or enhancement help wanted Open to be worked on

Comments

@justusschock
Copy link
Member

Do we want to include metrics of sklearn?

The following constraints would apply if we had an sklearn metric interface:

  • All imports would be within the class space, so sklearn would only remain an optional dependency (due to it's size)
  • All metrics will be provided by sklearn interface at first, but will be removed later on (once we got a native pytorch implementation)

The Advantages:

  • We have a pretty impressive set of metrics directly in the beginning
  • the maintenance effort is minimal
  • they're well tested

The disadvantages

  • For every call to a metric, we need to convert tensors to numpy
  • We will have to synchronise GPU(s) whenever we call a metric with inputs lying on GPU, which may be a bottleneck the users aren't aware of

My proposal

  • Add this layer in the beginning and try to replace as many of the metrics used there by our own :)
  • Explicitly state the downfalls in docs (and maybe also raise a warning on that) to ensure users are aware of this problem.

Thoughts?

cc @Borda @williamFalcon @ethanwharris @PyTorchLightning/core-contributors

@justusschock justusschock added feature Is an improvement or enhancement help wanted Open to be worked on labels Mar 30, 2020
@justusschock justusschock self-assigned this Mar 30, 2020
@justusschock justusschock added this to To do in Metrics package via automation Mar 30, 2020
@ethanwharris
Copy link
Member

The plan looks good :) another option might be to see if there is anything we can use in Skorch - although I don't know to what extent they support on GPU stuff

@justusschock
Copy link
Member Author

IIRC skorch aims on perfect sklearn compatibility, which is why they also use sklearn metrics (not on gpu though).

@ethanwharris
Copy link
Member

Yeah, my mileage with skorch was pretty limited (and quite a while ago), so I'm not really sure what it's about haha

@Borda Borda added the discussion In a discussion stage label Mar 30, 2020
@Borda Borda changed the title [Discussion][Metrics Package] Sklearn metrics [Metrics] Sklearn metrics Mar 30, 2020
@rzepinskip
Copy link
Contributor

The AllenNLP also started with CPU-based metrics to move some of them to GPU later - PR 3851

This was referenced Mar 31, 2020
@stale
Copy link

stale bot commented May 29, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the won't fix This will not be worked on label May 29, 2020
@Borda Borda removed the won't fix This will not be worked on label May 29, 2020
Metrics package automation moved this from To do to Done Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion In a discussion stage feature Is an improvement or enhancement help wanted Open to be worked on
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants