Add rake target margins input#528
Closed
neuralsorcerer wants to merge 5 commits into
Closed
Conversation
talgalili
requested changes
Jul 14, 2026
Comment on lines
+152
to
+171
| if not isinstance(dict_of_dicts, dict): | ||
| raise ValueError( | ||
| "dict_of_dicts must be a dictionary of dictionaries; " | ||
| f"got {type(dict_of_dicts).__name__}." | ||
| ) | ||
| if not dict_of_dicts: | ||
| raise ValueError("dict_of_dicts must be non-empty; got an empty dictionary.") | ||
|
|
||
| totals: Dict[str, float] = {} | ||
| for var_name, inner_dict in dict_of_dicts.items(): | ||
| if not isinstance(var_name, str): | ||
| raise ValueError( | ||
| "Marginal distribution variable names must be strings; " | ||
| f"got {type(var_name).__name__}." | ||
| ) | ||
| if not isinstance(inner_dict, dict) or not inner_dict: | ||
| raise ValueError( | ||
| f"Variable '{var_name}' must map to a non-empty dictionary of " | ||
| f"category {value_label}s." | ||
| ) |
Comment on lines
308
to
311
| sample_df --- (pandas dataframe) a dataframe representing the sample. | ||
| sample_weights --- (pandas series) design weights for sample. | ||
| target_df --- (pandas dataframe) a dataframe representing the target. | ||
| target_weights --- (pandas series) design weights for target. |
talgalili
requested changes
Jul 15, 2026
talgalili
left a comment
Contributor
There was a problem hiding this comment.
Please update function name + fix other LLM inputs. :)
| return totals | ||
|
|
||
|
|
||
| def _marginal_category_presence_key(value: Any) -> str: |
Contributor
There was a problem hiding this comment.
This is a general function - with a very specific name.
I propose using a more general name for the function (and again - update the docstring)
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Contributor
|
@talgalili has imported this pull request. If you are a Meta employee, you can view this in D112085432. |
Comment on lines
+152
to
+171
| if not isinstance(dict_of_dicts, dict): | ||
| raise ValueError( | ||
| "dict_of_dicts must be a dictionary of dictionaries; " | ||
| f"got {type(dict_of_dicts).__name__}." | ||
| ) | ||
| if not dict_of_dicts: | ||
| raise ValueError("dict_of_dicts must be non-empty; got an empty dictionary.") | ||
|
|
||
| totals: Dict[str, float] = {} | ||
| for var_name, inner_dict in dict_of_dicts.items(): | ||
| if not isinstance(var_name, str): | ||
| raise ValueError( | ||
| "Marginal distribution variable names must be strings; " | ||
| f"got {type(var_name).__name__}." | ||
| ) | ||
| if not isinstance(inner_dict, dict) or not inner_dict: | ||
| raise ValueError( | ||
| f"Variable '{var_name}' must map to a non-empty dictionary of " | ||
| f"category {value_label}s." | ||
| ) |
Comment on lines
308
to
+312
| sample_df --- (pandas dataframe) a dataframe representing the sample. | ||
| sample_weights --- (pandas series) design weights for sample. | ||
| target_df --- (pandas dataframe) a dataframe representing the target. | ||
| target_weights --- (pandas series) design weights for target. | ||
| target_margins --- (mapping, optional, keyword-only) known target marginal |
Contributor
|
The PR is in good enough state - I'll take it over to complete some changes - and then land. |
meta-codesync Bot
pushed a commit
that referenced
this pull request
Jul 15, 2026
Summary: Pull Request resolved: #528 Differential Revision: D112085432 Pulled By: talgalili fbshipit-source-id: f75c4a4959939009314c87dfc8b06fd6e415a404
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.