onlinerake.fit_penalized_raking¶
- onlinerake.fit_penalized_raking(features, targets, calibration_strength=0.3, design_weights=None)[source]¶
Minimize the penalized raking objective over all weights at once.
The minimizer is the exponential tilt w_i = d_i exp(-lambda.delta_i) with lambda = c * sum_i w_i delta_i, so it is found from the strictly convex p-dimensional dual G(lambda) = [sum_i d_i exp(-lambda.delta_i) + ||lambda||^2 / (2c)] / sum_i d_i. This is entropy balancing with a ridge on the multipliers; as c grows it approaches raking. Weights are not bounded here, unlike StreamingRaker. As in StreamingRaker, the penalty is computed with design weights divided by their mean and continuous deviations divided by their root mean square; the returned weights are in the units of design_weights.
- Parameters:
- Returns:
Weights of shape (n,).
- Raises:
ValueError – If shapes or settings are invalid.
RuntimeError – If the optimizer does not converge.
- Return type:
npt.NDArray[np.float64]