Skip to content

Support Hindsight PR in TorchRec #2627

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

Closed
wants to merge 1 commit into from

Conversation

iamzainhuda
Copy link
Contributor

Summary:
Pull request TDB after approvals.

Overview

This diff implements HindsightTargetPR metric into TorchRec. This will also include a bucketized version. Thrift changes submitted ahead in D66216486.

Implementation

  1. Create X-wide granular array to store metric states where each index represents the threshold. For bucketization, each bucket will be stacked in the next dimension within the state tensor.
  2. Calculate minimum threshold that meets target_precision.
  3. Calculate precision and recall points with target threshold.

Metrics

This metric will return the following curves:

  • hindsight_target_pr: this is the calculated threshold for the window state to maximize recall while achieving the target precision.
  • hindsight_target_precision: this is the achieved precision with hindsight_target_pr.
  • hindsight_target_recall: this is the achieved recall with hindsight_target_pr.

Usage

Hindsight PR metrics are primarily useful to mimic the calibration system within identity team. Please adjust the bucketization and window size accordingly to best approximate this.

Note: since the states are stored as a dimensional tensor, multiple tasks will not be supported for this metric.

Differential Revision: D65867461

@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 Dec 10, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D65867461

iamzainhuda pushed a commit to iamzainhuda/torchrec that referenced this pull request Dec 10, 2024
Summary:

### Overview
This diff implements HindsightTargetPR metric into TorchRec. This will also include a bucketized version. Thrift changes submitted ahead in D66216486.

### Implementation
1) Create X-wide granular array to store metric states where each index represents the threshold. For bucketization, each bucket will be stacked in the next dimension within the state tensor.
2) Calculate minimum threshold that meets target_precision.
3) Calculate precision and recall points with target threshold.

### Metrics
This metric will return the following curves:
* hindsight_target_pr: this is the calculated threshold for the window state to maximize recall while achieving the target precision.
* hindsight_target_precision: this is the achieved precision with hindsight_target_pr.
* hindsight_target_recall: this is the achieved recall with hindsight_target_pr.

### Usage
Hindsight PR metrics are primarily useful to mimic the calibration system within identity team. Please adjust the bucketization and window size accordingly to best approximate this.

Note: since the states are stored as a dimensional tensor, multiple tasks will not be supported for this metric.

Reviewed By: iamzainhuda

Differential Revision: D65867461
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D65867461

iamzainhuda pushed a commit to iamzainhuda/torchrec that referenced this pull request Dec 10, 2024
Summary:

### Overview
This diff implements HindsightTargetPR metric into TorchRec. This will also include a bucketized version. Thrift changes submitted ahead in D66216486.

### Implementation
1) Create X-wide granular array to store metric states where each index represents the threshold. For bucketization, each bucket will be stacked in the next dimension within the state tensor.
2) Calculate minimum threshold that meets target_precision.
3) Calculate precision and recall points with target threshold.

### Metrics
This metric will return the following curves:
* hindsight_target_pr: this is the calculated threshold for the window state to maximize recall while achieving the target precision.
* hindsight_target_precision: this is the achieved precision with hindsight_target_pr.
* hindsight_target_recall: this is the achieved recall with hindsight_target_pr.

### Usage
Hindsight PR metrics are primarily useful to mimic the calibration system within identity team. Please adjust the bucketization and window size accordingly to best approximate this.

Note: since the states are stored as a dimensional tensor, multiple tasks will not be supported for this metric.

Reviewed By: iamzainhuda

Differential Revision: D65867461
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D65867461

Summary:

### Overview
This diff implements HindsightTargetPR metric into TorchRec. This will also include a bucketized version. Thrift changes submitted ahead in D66216486.

### Implementation
1) Create X-wide granular array to store metric states where each index represents the threshold. For bucketization, each bucket will be stacked in the next dimension within the state tensor.
2) Calculate minimum threshold that meets target_precision.
3) Calculate precision and recall points with target threshold.

### Metrics
This metric will return the following curves:
* hindsight_target_pr: this is the calculated threshold for the window state to maximize recall while achieving the target precision.
* hindsight_target_precision: this is the achieved precision with hindsight_target_pr.
* hindsight_target_recall: this is the achieved recall with hindsight_target_pr.

### Usage
Hindsight PR metrics are primarily useful to mimic the calibration system within identity team. Please adjust the bucketization and window size accordingly to best approximate this.

Note: since the states are stored as a dimensional tensor, multiple tasks will not be supported for this metric.

Reviewed By: iamzainhuda

Differential Revision: D65867461
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D65867461

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. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants