Implement weighted samples and robust TRF (Issue #17) - #21
Conversation
- Add robust loss function d(e) = log(1 + (e/σ)²) to utils.py - Add robust_weights() and apply_sample_weights() helpers - Update TRFEstimator.fit() to accept weights and robust parameters - Implement IRLS (Iteratively Reweighted Least Squares) for robust TRF - Use conjugate gradient solver for iterative reweighted least squares - Add _solve_trf() helper method to choose between SVD and CG solvers - Update _fitlists() to support weights and robust mode - Sample weights are applied as WX transformation (map X to WX)
|
Closing this PR as superseded. The branch was built on an old snapshot of We're reopening the work as a smaller, focused fix for issue #17 on a fresh branch off current Thanks for the work — the weighted-least-squares formulation and |
|
Closing as superseded — see comment above. |
Summary
Implements weighted samples and robust TRF estimation as described in Issue #17.
Changes Made
utils.py
robust_loss()function: d(e) = log(1 + (e/σ)²) for robust error computationrobust_weights()function: computes weights for IRLS based on residualsapply_sample_weights()function: applies W to X and y for weighted least squares (maps X to WX)models.py (TRFEstimator)
weightsparameter tofit()method for weighted samplesrobustparameter for robust TRF with IRLSsolverparameter to__init__(): 'auto', 'svd', or 'cg'_solve_trf()helper method to choose between SVD and Conjugate Gradient_fitlists()to support weights and robust modeUsage Example
Mathematical Background
Testing
Related Issues
Closes #17