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

add metrics wrapper for sharing states across multiple metric #172

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ZhiyuanChen
Copy link

Please read through our contribution guide prior to creating your pull request.

Summary:

This MR introduces a metrics wrapper. It is intended to be used for multiple metrics that shares the same state.

We often calculate multiple metrics when evaluating the performance of our model. For example, we calculate the r^2, MAE, Pearson and Spearman for regression tasks.
They all use the same inputs and targets, but we have to store these state multiple times for each task.
Even worse, when running in distributed environment with multiple nodes, we have to sync these states multiple times.

To address these limitations, this MR introduces a metric wrapper that shares states between multiple tasks.

This MR is still WORK IN PROGRESS. The module name, class name, and additional utilities are yet to determine.
Any feedback is welcome!

Test plan:

Not included as of now, will add later.

Fixes #170

Signed-off-by: Zhiyuan Chen <[email protected]>
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 14, 2023
@ZhiyuanChen ZhiyuanChen marked this pull request as draft August 14, 2023 14:04
@ZhiyuanChen ZhiyuanChen marked this pull request as ready for review August 14, 2023 14:06
@ZhiyuanChen ZhiyuanChen marked this pull request as draft August 14, 2023 14:07
@codecov
Copy link

codecov bot commented Aug 14, 2023

Codecov Report

Merging #172 (5ae4601) into main (83ae20a) will decrease coverage by 0.35%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #172      +/-   ##
==========================================
- Coverage   24.71%   24.36%   -0.35%     
==========================================
  Files         173      174       +1     
  Lines        9892    10034     +142     
==========================================
  Hits         2445     2445              
- Misses       7447     7589     +142     
Files Changed Coverage Δ
torcheval/metrics/metrics.py 0.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ZhiyuanChen ZhiyuanChen marked this pull request as ready for review August 21, 2023 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple metrics sharing the same state
2 participants