Add per-harmonic ridge_weights support and document PowerShell ridge env vars#45
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the sinusoidal regression functionality to support per-harmonic ridge regularization weights and documents PowerShell environment variables for ridge parameters.
Changes:
- Added
ridge_weightsparameter tofit_sinusoidal_regressionfor per-column regularization control with automatic intercept exclusion - Extended
lte_mlr.pyto compute ridge weights based on harmonic number with configurable base, growth, exponent, and free-harmonic parameters - Added PowerShell environment variable examples for Ridge parameters in the documentation
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| examples/mlr/sinusoidal_regression.py | Added ridge_weights parameter with validation and automatic intercept handling in ridge regularization |
| examples/mlr/lte_mlr.py | Added Ridge parameter reading and ridge_weights calculation logic with per-harmonic penalty computation |
| examples/mlr/index.md | Added PowerShell environment variable examples for Ridge_Base, Ridge_Growth, Ridge_Free, Ridge_Exponent, and Ridge_Linear |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Contributor
This was referenced Jan 17, 2026
Contributor
Contributor
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.
Motivation
Description
fit_sinusoidal_regression(...)to acceptridge_weights, validate that its length matches the design matrix columns, build a diagonal regularization matrix from it, and copy-and-zero the first entry whenintercept=Trueso the intercept is not penalized; scalarridgebehavior is preserved as a fallback.examples/mlr/lte_mlr.pyadded parameter reads forRidge_Base,Ridge_Growth,Ridge_Free,Ridge_Exponent, andRidge_Linear, computedridge_weightsin the design-matrix order (intercept, sin/cos pairs per harmonic, then linear X), applied a zero penalty for the firstRidge_Freeharmonics (and harmonic 1 by default), and passedridge_weightsintofit_sinusoidal_regression(...).examples/mlr/index.mdto include a PowerShell snippet that sets example values forRidge_Base,Ridge_Growth,Ridge_Free,Ridge_Exponent, andRidge_Linearso users can reproduce the behavior locally.examples/mlr/sinusoidal_regression.py.Testing
Codex Task