Skip to content

[Feature] Add Least Angle Regression - #421

Merged
relf merged 13 commits into
rust-ml:masterfrom
aswin-1111:master
Dec 9, 2025
Merged

relf merged 13 commits into
rust-ml:masterfrom
aswin-1111:master

Conversation

@aswin-1111

Copy link
Copy Markdown
Contributor

Implementation of the Least Angle Regression Algorithm

Note: This PR addresses the same feature as #115, which has been inactive.

Hope this implementation meets the library standards. If any further changes are required, feel free to modify it.

@codecov

codecov Bot commented Nov 28, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.17391% with 63 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.92%. Comparing base (5afd26c) to head (b28824b).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
algorithms/linfa-lars/src/algorithm.rs 82.64% 38 Missing ⚠️
algorithms/linfa-lars/src/lib.rs 27.27% 16 Missing ⚠️
algorithms/linfa-lars/src/hyperparams.rs 74.28% 9 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master     #421    +/-   ##
========================================
  Coverage   76.91%   76.92%            
========================================
  Files         101      104     +3     
  Lines        7045     7321   +276     
========================================
+ Hits         5419     5632   +213     
- Misses       1626     1689    +63     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@relf relf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for this contribution! I find it in pretty good shape, I've just made a first pass mainly wrt the documentation.

Comment thread algorithms/linfa-lars/examples/lars.rs Resolved
Comment thread algorithms/linfa-lars/src/algorithm.rs Resolved
Comment thread algorithms/linfa-lars/src/lib.rs Resolved
Comment thread algorithms/linfa-lars/src/lib.rs Resolved
Comment thread algorithms/linfa-lars/Cargo.toml Resolved
Comment thread algorithms/linfa-lars/src/algorithm.rs Resolved
Comment thread algorithms/linfa-lars/src/algorithm.rs Resolved
Comment thread algorithms/linfa-lars/src/algorithm.rs Resolved
Comment thread algorithms/linfa-lars/Cargo.toml Resolved
Comment thread algorithms/linfa-lars/Cargo.toml Resolved
Comment thread algorithms/linfa-lars/Cargo.toml Resolved
Comment thread algorithms/linfa-lars/Cargo.toml Resolved
Comment thread algorithms/linfa-lars/src/algorithm.rs Resolved
Comment thread algorithms/linfa-lars/src/algorithm.rs Resolved
Comment thread algorithms/linfa-lars/src/algorithm.rs Resolved
Comment thread algorithms/linfa-lars/src/algorithm.rs Resolved
Comment thread algorithms/linfa-lars/src/algorithm.rs Resolved
Comment thread algorithms/linfa-lars/src/algorithm.rs Resolved
@relf
relf merged commit db3cade into rust-ml:master Dec 9, 2025
21 checks passed
@relf

relf commented Dec 9, 2025

Copy link
Copy Markdown
Member

Thank you!

@relf relf mentioned this pull request Dec 10, 2025
1 of 4 tasks
jagan-nuvai added a commit to Nuvai/linfa that referenced this pull request Apr 30, 2026
Brings in master's 0.8.1 release work and downstream commits:
- 4484a55 Bump all crates 0.8.0 -> 0.8.1
- 59fc6c6 Prepare release 0.8.1 (rust-ml#428)
- 54ea637 fix(ica): add missing exponential (rust-ml#426)
- 9b5c424 Add AdaBoost classifier to linfa-ensemble (rust-ml#427)
- db3cade [Feature] Add Least Angle Regression (rust-ml#421)
- Plus website / news / about updates

Conflict resolution: 7 Cargo.toml files (linfa-clustering, linfa-hierarchical,
linfa-linear, linfa-nn, linfa-preprocessing, linfa-reduction, datasets) had
conflicts where master's 0.8.0 -> 0.8.1 version bump landed on lines our
branch had ndarray ecosystem version bumps on. Took the union: master's 0.8.1
plus our ndarray 0.17 / rand 0.9 / sprs 0.11.4 / rand_xoshiro 0.7 versions.

Migration of merged code to our ndarray 0.17 / rand 0.9 ecosystem:

linfa-ensemble (AdaBoost from rust-ml#427)
- src/adaboost.rs: distributions::WeightedIndex -> distr::weighted::WeightedIndex
- src/adaboost_hyperparams.rs: thread_rng() -> rng()

linfa-lars (LARS from rust-ml#421)
- Cargo.toml: bumped to ndarray 0.17 / ndarray-linalg 0.18 / ndarray-stats 0.7
  / linfa-linalg fork branch / ndarray-rand 0.16 / rand_xoshiro 0.7
- src/algorithm.rs:151: extracted RHS into a let-binding to satisfy the
  ndarray-0.17 stricter borrow check on `coef.assign(&(... &coef ...))`
- src/algorithm.rs:600: Uniform::new() now returns Result, added .unwrap()

AdaBoost orphaned pending follow-up
- Removed `mod adaboost;` and `mod adaboost_hyperparams;` from
  linfa-ensemble/src/lib.rs (sources stay on disk for the follow-up PR)
- Gated 6 AdaBoost test functions with #[cfg(any())]
- Removed AdaBoost section from doc comment
- Deleted adaboost_iris example (cannot compile without the public types)
- Reason: AdaBoost's `impl Fit for AdaBoostValidParams<P, R>` writes
  `where P: Fit<...> + Clone`, which under generic P can only be satisfied via
  Linfa's `ParamGuard` blanket impl. The blanket requires `P: ParamGuard +
  Clone, P::Checked: Fit, Error: From<P::Error>`, which under ndarray 0.17's
  reshaped types triggers an infinite trait-solver recursion. Fixing it
  requires structural rework (likely making AdaBoost take a model factory
  rather than generic `Fit`-able params). Out of scope for this dependency
  upgrade PR; tracked separately.

Verified on x86_64-linux (knuckles-dev VM):
  cargo check --workspace --all-targets   -> exit 0, 0 warnings
  cargo test  --workspace                 -> 475 passed, 0 failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants