Skip to content

Add per-harmonic ridge_weights support and document PowerShell ridge env vars#45

Merged
pukpr merged 1 commit into
masterfrom
codex/optimize-time-series-fitting-experiments
Jan 17, 2026
Merged

Add per-harmonic ridge_weights support and document PowerShell ridge env vars#45
pukpr merged 1 commit into
masterfrom
codex/optimize-time-series-fitting-experiments

Conversation

@pukpr
Copy link
Copy Markdown
Owner

@pukpr pukpr commented Jan 17, 2026

Motivation

  • Provide fine-grained per-column ridge regularization so higher harmonics can be penalized differently than fundamentals.
  • Ensure the intercept remains unpenalized when callers supply a full per-column ridge vector.
  • Make it easy to run the example locally on PowerShell by documenting the new ridge-related environment variables.

Description

  • Extended fit_sinusoidal_regression(...) to accept ridge_weights, validate that its length matches the design matrix columns, build a diagonal regularization matrix from it, and copy-and-zero the first entry when intercept=True so the intercept is not penalized; scalar ridge behavior is preserved as a fallback.
  • In examples/mlr/lte_mlr.py added parameter reads for Ridge_Base, Ridge_Growth, Ridge_Free, Ridge_Exponent, and Ridge_Linear, computed ridge_weights in the design-matrix order (intercept, sin/cos pairs per harmonic, then linear X), applied a zero penalty for the first Ridge_Free harmonics (and harmonic 1 by default), and passed ridge_weights into fit_sinusoidal_regression(...).
  • Updated examples/mlr/index.md to include a PowerShell snippet that sets example values for Ridge_Base, Ridge_Growth, Ridge_Free, Ridge_Exponent, and Ridge_Linear so users can reproduce the behavior locally.
  • Minor trailing-newline/print tweak in examples/mlr/sinusoidal_regression.py.

Testing

  • No automated tests were run.

Codex Task

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_weights parameter to fit_sinusoidal_regression for per-column regularization control with automatic intercept exclusion
  • Extended lte_mlr.py to 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.

Comment thread examples/mlr/lte_mlr.py
Comment thread examples/mlr/lte_mlr.py
Comment thread examples/mlr/sinusoidal_regression.py
Comment thread examples/mlr/sinusoidal_regression.py
Comment thread examples/mlr/sinusoidal_regression.py
Comment thread examples/mlr/index.md
Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 17, 2026

@pukpr I've opened a new pull request, #46, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 17, 2026

@pukpr I've opened a new pull request, #47, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 17, 2026

@pukpr I've opened a new pull request, #48, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 17, 2026

@pukpr I've opened a new pull request, #49, to work on those changes. Once the pull request is ready, I'll request review from you.

@pukpr pukpr merged commit 3695013 into master Jan 17, 2026
6 checks passed
@pukpr pukpr deleted the codex/optimize-time-series-fitting-experiments branch January 17, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants