Skip to content

Update anofox-regression to 0.5.2 with new features#45

Merged
sipemu merged 5 commits intomainfrom
feature/update-anofox-regression-0.5.2
Mar 4, 2026
Merged

Update anofox-regression to 0.5.2 with new features#45
sipemu merged 5 commits intomainfrom
feature/update-anofox-regression-0.5.2

Conversation

@sipemu
Copy link
Contributor

@sipemu sipemu commented Mar 1, 2026

Summary

  • Crate update: anofox-regression 0.5.1 → 0.5.2
  • SolverType selection: QR (default), SVD (most robust), Cholesky (fastest) for OLS, Ridge, WLS
  • LambdaScaling: Raw (as-is) and Glmnet (R's glmnet convention) for Ridge and ElasticNet
  • Penalized IRLS: L2 regularization (lambda) parameter for all GLM models (Poisson, Binomial, NegBinomial, Tweedie)
  • HC inference: Heteroscedasticity-consistent standard errors (HC0–HC3) for OLS and WLS
  • Native WlsRegressor: Replaced manual sqrt(w) transformation with upstream WlsRegressor for proper weighted statistics
  • LmDynamic: Time-varying coefficient model using IC-based model averaging with optional LOWESS smoothing
  • Condition diagnostics: Condition number and severity assessment for design matrices
  • Quasi-separation detection: Binary separation and count sparsity checks for GLM data
  • LOWESS smoothing: Standalone locally weighted scatterplot smoothing function
  • FFI wiring: All new features wired through C-compatible FFI layer

Test plan

  • All 144 unit tests pass (was 110 before, added 34 new tests)
  • Zero compiler warnings
  • Tests cover: solver selection (SVD, Cholesky), lambda scaling, penalized GLM, HC inference (HC1, HC3), native WLS, LmDynamic (basic, no smoothing, BIC, edge cases), condition diagnostics, separation detection, LOWESS smoothing

🤖 Generated with Claude Code

sipemu and others added 5 commits March 1, 2026 20:44
- Add SolverType (QR/SVD/Cholesky) selection for OLS, Ridge, WLS
- Add LambdaScaling (Raw/Glmnet) for Ridge and ElasticNet
- Add penalized IRLS (lambda parameter) for all GLM models
- Add HC inference (HC0-HC3 heteroscedasticity-consistent SE) for OLS and WLS
- Replace manual WLS implementation with native WlsRegressor
- Add LmDynamic time-varying coefficient model with IC-based model averaging
- Add condition number diagnostics module
- Add quasi-separation detection for binary/count GLMs
- Add LOWESS smoothing as standalone function
- Wire all new options through FFI layer with C-compatible types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The C header was out of sync with Rust FFI struct definitions after
adding solver, hc_type, lambda_scaling, and lambda fields. This caused
C++ code to create undersized structs, leading to Rust reading
uninitialized memory (OLS returning NULL, WLS segfaulting).

- Add SolverType, LambdaScaling, HcType enums to C header
- Add solver + hc_type fields to OLS and WLS option structs
- Add solver + lambda_scaling fields to Ridge option struct
- Add lambda_scaling field to ElasticNet option struct
- Add lambda field to Poisson, Binomial, NegBinomial, Tweedie options
- Add LmDynamic types and function declarations
- Initialize new fields in all 16 C++ aggregate/table/window functions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The prediction interval tests used y = 2x + 1 (exact linear fit), giving
residual_std_error = 0. With the new SVD solver, this produced zero-width
intervals at all confidence levels, failing the 99% > 90% width comparison.
Adding small noise ensures non-zero residuals for meaningful interval tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sipemu sipemu merged commit ac860c8 into main Mar 4, 2026
28 of 34 checks passed
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.

1 participant