Skip to content

Conversation

@Lorenzo-Perini
Copy link
Contributor

Summary: Just moving the files to remove any trace of MCNet from our open source repo.

Differential Revision: D90321838

TaXxER and others added 30 commits October 1, 2025 13:26
…t.py, thresholding.py, and torchscript_modules.py
…th Apple M1/M2 hardware, resulting in segmentation faults. We ignore affected tests.
…conduct_file_exists

Adding Code of Conduct file
… is not release yet on pypi. Here we undo the tuning change to make it compatible with 1.1.2.
- Fix spelling and grammar issues throughout documentation
- Enhance clarity with concrete examples and expanded acronyms
- Correct MCE definition from 'Maximum Calibration Error' to 'Multicalibration Error'
- Fix all code examples to match actual DataFrame-based API
- Add academic references for main paper (KDD 2026), metrics paper, and applications paper
- Update all documentation files with accurate method signatures and parameter names

Files modified:
- README.md: Add proper citations, fix code example API
- pyproject.toml: Fix subject-verb agreement
- website/docs/: Update all doc pages with correct API usage
- website/src/pages/index.js: Update homepage with correct citations and code example
The internal and external repositories are out of sync. This Pull Request attempts to brings them back in sync by patching the GitHub repository. Please carefully review this patch. You must disable ShipIt for your project in order to merge this pull request. DO NOT IMPORT this pull request. Instead, merge it directly on GitHub using the MERGE BUTTON. Re-enable ShipIt after merging.
The internal and external repositories are out of sync. This Pull Request attempts to brings them back in sync by patching the GitHub repository. Please carefully review this patch. You must disable ShipIt for your project in order to merge this pull request. DO NOT IMPORT this pull request. Instead, merge it directly on GitHub using the MERGE BUTTON. Re-enable ShipIt after merging.
The internal and external repositories are out of sync. This Pull Request attempts to brings them back in sync by patching the GitHub repository. Please carefully review this patch. You must disable ShipIt for your project in order to merge this pull request. DO NOT IMPORT this pull request. Instead, merge it directly on GitHub using the MERGE BUTTON. Re-enable ShipIt after merging.
Summary:
Pull Request resolved: facebookincubator/MCGrad#24

We're starting to see some "running out of disk space" errors on the machines that build Sphinx. We have plenty of budget, so let's just throw a bigger machine.

facebookincubator/MCGrad#18

Reviewed By: Lorenzo-Perini

Differential Revision: D88486737

fbshipit-source-id: 3ab67c816a15a6d54bc330106e962b3e1f315e70
TaXxER and others added 19 commits December 29, 2025 10:17
Summary:
Incorporated content from multicalibration research papers into the documentation:

## Some papers by others
- Added use cases for multicalibration (downstream optimization, distribution shift robustness)
    - Kim et al. (2022) and Wu et al. (2024) for distribution shift robustness
- Cited relevant academic papers for claims

## Measuring Multi-calibration Paper (Guy et al., 2025)
- Added new 'Measuring Multicalibration' page explaining the MCE metric
- Covers Kuiper statistic approach, signal-to-noise weighting, usage examples
- Updated sidebar navigation

## 'Multicalibration Yields Better Matchings'
- Added a sentence on effects on optimization of downstream applications + link

Pull Request resolved: facebookincubator/MCGrad#69

Differential Revision: D89721479

Pulled By: TaXxER

fbshipit-source-id: 0efb7b46dde6c95cf1e5ac43eb5d76908a873f7d
Summary:
Pull Request resolved: facebookincubator/MCGrad#63

Code quality improvements for metrics.py following Google Python style guide:

**Type annotations:**
- Removed unused imports (`Dict`, `Tuple` from typing)
- Fixed `**kwargs` type hint from `Dict[str, Any]` to `Any` (the correct type for kwargs values)
- Updated `Tuple` to lowercase `tuple` for Python 3.9+ style

**Replaced assert statements with proper exceptions:**
- Production code should not use `assert` for validation since asserts can be disabled with `-O` flag
- Converted 5 `assert` statements to `raise ValueError()` or `raise AssertionError()` in:
  - `multi_cg_score`: metric validation
  - `kuiper_distribution`: input validation for positive x
  - `rank_multicalibration_error`: segment weight validation
  - `calibration_free_normalized_entropy`: labels shape validation
  - `wrap_multicalibration_error_metric`: segment columns and metric version validation

**Fixed variable shadowing:**
- `calibration_ratio` variable shadowed the function → renamed to `ratio`
- `fpr` variables in `fpr_with_mask` and `fpr_at_precision` shadowed the function → renamed to `false_positive_rate`
- `normalized_entropy` variable shadowed the function → renamed to `ne`

**Extracted magic numbers to module-level constants:**
- Added `KUIPER_STATISTIC_MAX` and `KUIPER_STATISTIC_MIN` as documented constants
- Removed duplicated local definitions inside `kuiper_test()`

**Test cleanup:**
- Removed debug `print()` statement from test

Reviewed By: Lorenzo-Perini

Differential Revision: D89555477

fbshipit-source-id: 79ec8bd3136e939910de188d0ae57afb58932ae2
Summary:
For consistent formatting

Pull Request resolved: facebookincubator/MCGrad#74

Reviewed By: flinder

Differential Revision: D89767566

Pulled By: TaXxER

fbshipit-source-id: f9ed956a0052b27d84cb1e6b7453e37e4dd3ecd7
…e left unchanged (#77)

Summary:
Pull Request resolved: facebookincubator/MCGrad#77

In facebookincubator/MCGrad#42 we added tests that check that metrics.py methods do not alter input dataframes. Here we add similar tests for methods.py (fit and predict methods).

Reviewed By: Lorenzo-Perini

Differential Revision: D90116623

fbshipit-source-id: 54e5a375797e52990455e4c3b717bd41801e69da
…left unchanged (#78)

Summary:
Pull Request resolved: facebookincubator/MCGrad#78

In facebookincubator/MCGrad#42 we added tests that check that metrics.py methods do not alter input dataframes. Here we add similar tests for utils.py.

Reviewed By: Lorenzo-Perini

Differential Revision: D90117080

fbshipit-source-id: 9a03c289f0c61cfb2e72bd332f41ceb86845e5fc
…ts are left unchanged (#79)

Summary:
Pull Request resolved: facebookincubator/MCGrad#79

In facebookincubator/MCGrad#42 we added tests that check that metrics.py methods do not alter input dataframes. Here we add similar tests for segmentation.py.

Reviewed By: Lorenzo-Perini

Differential Revision: D90117308

fbshipit-source-id: 39a04a3a57bf5c7770d2f783d1eb98e12ae3ac71
… left unchanged (#80)

Summary:
Pull Request resolved: facebookincubator/MCGrad#80

In facebookincubator/MCGrad#42 we added tests that check that metrics.py methods do not alter input dataframes. Here we add similar tests for tuning.py.

Reviewed By: Lorenzo-Perini

Differential Revision: D90117657

fbshipit-source-id: ce99065c8bac5b6f00b3122d836bea3cef94c0de
…re left unchanged (#81)

Summary:
Pull Request resolved: facebookincubator/MCGrad#81

In facebookincubator/MCGrad#42 we added tests that check that metrics.py methods do not alter input dataframes. Here we add similar tests for tuning.py.

Reviewed By: Lorenzo-Perini

Differential Revision: D90117860

fbshipit-source-id: a1133c72ce12251c999512314aa5786f96a3ad44
Summary:
Pull Request resolved: facebookincubator/MCGrad#82

This diff removes internal references to wikis, documentation, code, etc from plotting.py.

Reviewed By: Lorenzo-Perini

Differential Revision: D90118362

fbshipit-source-id: f29ae5dded7b0edaf2205db620f4bf8daf6352ba
Summary:
Pull Request resolved: facebookincubator/MCGrad#76

This slipped our tests on Github because we don't have unittests for `plot_learning_curve`. Adding some basic tests here to close the coverage gap.

Reviewed By: TaXxER, Lorenzo-Perini

Differential Revision: D90111397

fbshipit-source-id: 1876a1dc2931e31a7c22be03ab80fe0bba0e0c2d
Summary:
Pull Request resolved: facebookincubator/MCGrad#67

Renamed MCBoost -> MCGrad for the implementation to be open sourced.

**Core Changes (methods.py):**
- Renamed classes: `MCBoost` → `MCGrad`, `RegressionMCBoost` → `RegressionMCGrad`
- Renamed base class: `BaseMCBoost` → `BaseMCGrad`
- Renamed data class: `MCBoostProcessedData` → `MCGradProcessedData`
- Created backward-compatible subclasses `MCBoost` and `RegressionMCBoost` (inheriting from MCGrad) for internal use
- Changed `_check_predictions` and `_check_labels` from `staticmethod` to instance methods to support dynamic class names via `self.__class__.__name__`
- Updated all docstrings, log messages, and error messages to use new class names. Where possible I used the dynamic name. **Where this wasn't possible (docstrings) I default to "MCGrad", favoring consistency in the open source version**

**Plotting Changes (plotting.py):**
- Renamed `plot_learning_curve` parameter: `mcboost_model` → `mcgrad_model`
- Updated all internal variable references from `mcboost_model` to `mcgrad_model`

**Tuning Changes (tuning.py):**
- Renamed function: `tune_mcboost_params` → `tune_mcgrad_params`
- Added backward-compatible alias: `tune_mcboost_params = tune_mcgrad_params`

**Transformer Changes (mcboost_transformer.py):**
- Updated abstract property type hints: `type[methods.BaseMCBoost]` → `type[methods.BaseMCGrad]`
- Updated related comments referencing the abstract return type

**Test Changes (test_methods.py, test_metrics.py):**
- Updated all test parametrization to use `MCGrad`/`RegressionMCGrad`
- Renamed test functions from `test_mcboost_*` → `test_mcgrad_*`
- Updated comments referencing MCBoost to MCGrad
- Updated isinstance checks to use `BaseMCGrad`

Reviewed By: TaXxER

Differential Revision: D89670100

fbshipit-source-id: f5ce436c3565f48ff58bab503b48af7fd5338f92
Summary:
Pull Request resolved: facebookincubator/MCGrad#83

This diff removes internal references to wikis, documentation, code, etc from utils.py and its tests.

Reviewed By: flinder

Differential Revision: D90120757

fbshipit-source-id: 0c97f6f042531c7f3719857332f6f005f1b1e1fc
Summary:
Pull Request resolved: facebookincubator/MCGrad#86

Code quality improvements for segmentation.py and its tests following Google Python style guide and Python Enhancement Proposals (PEPs):

**Logging format (Google style guide 3.10.1):**
- Changed `logger.debug()` from f-string to %-placeholder format
- Logging functions should use pattern-strings with %-placeholders as their first argument, not f-strings, because:
  - Logging implementations can collect unexpanded pattern-strings as queryable fields
  - Prevents spending time rendering messages that no logger is configured to output

**Docstring formatting (PEP 257 / PEP 8 - 80 character limit):**
- Reformatted `get_segment_masks()` docstring to comply with 80-character line limit
- Split long summary line into concise summary + detailed description
- Wrapped all parameter descriptions to fit within 80 characters
- Fixed Notes section formatting to use proper indentation (was using NumPy-style `------` separator)

**Test naming fixes (PEP 8 - descriptive naming):**
- Fixed typo "nana" → "NaN" in two test function comments (lines 35, 106)
- Fixed typo "infequent" → "infrequent" in function name:
  `test_that_collapse_infrequent_values_collapses_correctly_for_happy_path`
- Fixed typo "numer" → "number" in two function names:
  - `test_that_collapse_numeric_values_returns_correct_number_of_values`
  - `test_that_collapse_numeric_values_returns_correct_number_of_values_with_max_values_1`

Reviewed By: flinder

Differential Revision: D90172889

fbshipit-source-id: 35621efbaf68e97d8280214b5d849d1e54ce01f4
Summary:
Pull Request resolved: facebookincubator/MCGrad#85

Code quality improvements for base.py following Google Python style guide.

**Docstring improvements:**
- Standardized docstring format with summary on the same line as opening quotes
- Added consistent punctuation to all parameter descriptions (ending with periods)
- Fixed docstring indentation to use 4-space hanging indent per Google style
- Added missing `:param kwargs:` and `:return:` documentation to `fit_transform` method
- Added class-level docstring to `BaseCalibrator`
- Wrapped long docstring lines to stay within 80 character limit

Reviewed By: flinder

Differential Revision: D90168232

fbshipit-source-id: bca2029327ce2b231b4ceeaa2d51669e97ecff53
Summary:
Pull Request resolved: facebookincubator/MCGrad#87

Renamed MCBoost->MCGrad in OSS documentation examples.

Reviewed By: TaXxER

Differential Revision: D90250234

fbshipit-source-id: 7c5c224811139635e7aa108029d0547334299004
Summary:
Pull Request resolved: facebookincubator/MCGrad#91

Just moving the files to the internal directory and fixing the tests accordingly

Reviewed By: TaXxER

Differential Revision: D90248629

fbshipit-source-id: 575f72fd7da5a0d12e416221dc5450f46dfbe2e5
Summary:
Pull Request resolved: facebookincubator/MCGrad#92

Applied the following code quality fixes:

### `tuning.py`

1. **Wrapped long comment** (line 101) - Split the 121-char comment into two lines for readability
2. **Replaced `assert` with proper exception** (line 166) - Changed `assert df_val is not None` to `raise ValueError(...)` for proper runtime validation instead of debug assertions
3. **Converted string concatenation to f-string** (line 221) - Changed `"lightgbm_autotuning" + str(uuid.uuid4())[:8]` to `f"lightgbm_autotuning_{uuid.uuid4().hex[:8]}"`

### `test_tuning.py`

1. **Fixed PascalCase variable** - `BoTorch_count` → `botorch_count` (Google style: snake_case for variables)
2. **Converted `.format()` to f-strings** - Updated 3 assertion messages to use f-strings
3. **Fixed data slice bug** - Changed `sample_data.iloc[:80]` to `sample_data.iloc[:40]` (the fixture only has 50 samples, so `[:80]` was incorrectly returning all rows instead of an 80/20 split)

Reviewed By: TaXxER

Differential Revision: D90259815

fbshipit-source-id: 5361978a57efd1a7d29111c364df763151b9fae4
Summary:
Pull Request resolved: facebookincubator/MCGrad#93

* Add missing docstring to public data class `ParameterConfig`
* Add :returns: documentation `tune_mcgrad_parameters`
* Add minimal explanation to internal helper `_suppress_logger`

Reviewed By: TaXxER

Differential Revision: D90260538

fbshipit-source-id: cd0ffe4e1e474f9fbd79191a94497f8f1be809c4
Summary: Just moving the files to remove any trace of MCNet from our open source repo.

Differential Revision: D90321838
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 8, 2026
@meta-codesync
Copy link

meta-codesync bot commented Jan 8, 2026

@Lorenzo-Perini has exported this pull request. If you are a Meta employee, you can view the originating Diff in D90321838.

Lorenzo-Perini added a commit to Lorenzo-Perini/MCGrad-1 that referenced this pull request Jan 15, 2026
Summary:
Pull Request resolved: facebookincubator#99

Just moving the files to remove any trace of MCNet from our open source repo.

Reviewed By: TaXxER, flinder

Differential Revision: D90321838
meta-codesync bot pushed a commit that referenced this pull request Jan 15, 2026
Summary:
Pull Request resolved: #99

Just moving the files to remove any trace of MCNet from our open source repo.

Reviewed By: TaXxER, flinder

Differential Revision: D90321838

fbshipit-source-id: c2b3965f7881d7093a19f71f6533dce279bcfe7f
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 Meta Open Source bot. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants