Implement weighted samples and robust TRF (Issue #17)#21
Open
Hugo-W wants to merge 1 commit into
Open
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)
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.
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