Repository navigation
DOC document gamma, bound, project_lambda, and signed_weights on Moment - #1751
SpiliosDimakopoulos wants to merge 2 commits into
Conversation
The base class methods only had one-line docstrings without Parameters or Returns sections. Describe what each method takes and returns, based on how ExponentiatedGradient and GridSearch use them (fixes fairlearn#232).
| pandas.Series | ||
| Lagrange multipliers that are equivalent to `lambda_vec` for the |
There was a problem hiding this comment.
[P2] Describe the non-decreasing Lagrangian guarantee
Could we say that the projected multipliers produce the same or a higher Lagrangian value, rather than an equivalent one? For example, with default DemographicParity() and two groups, projecting pd.Series(1.0, index=moment.index) returns all zeros. The constraint term changes from -0.04 to 0.0 because bound() is 0.01, even though the inner product with gamma is unchanged. This is expected behavior and matches the existing UtilityParity.project_lambda docstring. The equality implied here gives custom Moment implementations the wrong contract.
| One weight per sample. The reductions algorithms add the weights of the | ||
| objective and the constraints, use the sign of the sum to choose the label | ||
| for a cost-sensitive learning problem, and the absolute value as the | ||
| sample weight when calling the underlying estimator. |
There was a problem hiding this comment.
[P2] Distinguish regression weights from classification relabelling
Could we limit the relabelling description to ClassificationMoment and describe regression separately? For example, GridSearch with BoundedGroupLoss(SquareLoss(...)) keeps the original continuous y and uses these weights to reweight the samples. It does not choose new 0/1 labels from their signs. That path also skips adding objective weights when the objective is already in the constraint span. Since Moment is the base class for both classification and regression, the current description gives users implementing a regression moment the wrong picture.
Refs #232.
The base
Momentmethodsgamma,bound,project_lambda, andsigned_weightsonly had one-line docstrings. I added Parameters and Returns sections describing what each method takes and returns, based on howExponentiatedGradientuses them (the Lagrangian iserror + sum(lambda * (gamma - bound)), and the sign of the summed signed weights picks the label for the cost-sensitive learning step).No behavior change. Added a line to the v0.15.0 changelog.