Skip to content

Validate outcome model sample weights#548

Open
neuralsorcerer wants to merge 4 commits into
facebookresearch:mainfrom
neuralsorcerer:out
Open

Validate outcome model sample weights#548
neuralsorcerer wants to merge 4 commits into
facebookresearch:mainfrom
neuralsorcerer:out

Conversation

@neuralsorcerer

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings July 25, 2026 02:41
@meta-cla meta-cla Bot added the cla signed label Jul 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

One newly introduced ValueError message uses inconsistent parameter/input names (sample_weights/sample_df) relative to the fit_outcome_model API, reducing how actionable the validation error is for callers.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Low

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment thread balance/outcome_models/outcome_model.py
Copilot AI review requested due to automatic review settings July 25, 2026 04:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

One validation path still produces confusing error text (referring to “sample_df/sample_weights”) and the new elementwise type-check loop can be cheaply optimized to avoid Python iteration for numeric dtypes.

Review details

Comments suppressed due to low confidence (1)

balance/outcome_models/outcome_model.py:449

  • _check_weighting_methods_input is called with object_name="sample", so length/index mismatch errors mention "sample_df" / "sample_weights" even though this API uses covars_df + sample_weight; that makes the ValueError less actionable and contradicts the changelog’s wording.
    _check_weighting_methods_input(covars_df, sample_weight_series, "sample")
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Low

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment thread balance/outcome_models/outcome_model.py Outdated
Copilot AI review requested due to automatic review settings July 25, 2026 13:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

A misleading error-message path can still surface (sample_df/sample_weights) due to _check_weighting_methods_input(..., object_name="sample"), undermining the PR’s goal of actionable validation errors.

Review details

Comments suppressed due to low confidence (1)

balance/outcome_models/outcome_model.py:450

  • _prepare_sample_weight relies on _check_weighting_methods_input(..., object_name="sample"), which can raise errors mentioning sample_df / sample_weights on length/index mismatches. In the outcome-model API the parameter is sample_weight and the reference frame is covars_df, so those messages are misleading and inconsistent with the other ValueErrors in this function (which correctly mention sample_weight / covars_df). Consider validating length/index here with outcome-model-specific, actionable messages and dropping the _check_weighting_methods_input call.
    _check_weighting_methods_input(covars_df, sample_weight_series, "sample")

  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Low

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

@talgalili

Copy link
Copy Markdown
Contributor

@neuralsorcerer is the latest response by copilot correct? WDYT?

@neuralsorcerer

Copy link
Copy Markdown
Collaborator Author

@neuralsorcerer is the latest response by copilot correct? WDYT?

Not required. We can proceed to merge.

@meta-codesync

meta-codesync Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@talgalili has imported this pull request. If you are a Meta employee, you can view this in D113763728.

Comment thread balance/outcome_models/outcome_model.py Outdated
Copilot AI review requested due to automatic review settings July 27, 2026 14:52
@facebook-github-tools

Copy link
Copy Markdown

@neuralsorcerer has updated the pull request. You must reimport the pull request before landing.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@neuralsorcerer
neuralsorcerer requested a review from talgalili July 27, 2026 14:57

@talgalili talgalili left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Breaking 2.9 :)

@neuralsorcerer

Copy link
Copy Markdown
Collaborator Author

Breaking 2.9 :)

Please re-execute the CI, it should pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants