1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Ridge and Lasso regression (glmnet-compatible implementations).
//!
//! This module provides regularized regression methods that are compatible with
//! R's glmnet package. The implementations follow the same objective functions,
//! standardization conventions, and scaling approaches as glmnet.
//!
//! # Objective Function
//!
//! The elastic net objective (which includes ridge and lasso as special cases) is:
//!
//! ```text
//! minimize over (β₀, β):
//!
//! (1/(2n)) * Σᵢ (yᵢ - β₀ - xᵢᵀβ)²
//! + λ * [(1 - α) * ||β||₂² / 2 + α * ||β||₁]
//! ```
//!
//! Where:
//! - `α = 0`: Ridge regression (L2 penalty)
//! - `α = 1`: Lasso regression (L1 penalty)
//! - `β₀` (intercept) is **never penalized**
//! - `λ` controls the overall penalty strength
//!
//! # Standardization
//!
//! By default, predictors are standardized before fitting (matching glmnet's
//! `standardize=TRUE` default):
//!
//! - Each column of X is centered to mean 0 (if intercept is used)
//! - Each column is scaled to unit variance
//! - Coefficients are returned on the **original scale**
//!
//! # Compatibility with glmnet
//!
//! These implementations match R's glmnet behavior:
//!
//! - Same objective function form
//! - Same standardization defaults
//! - Intercept is never penalized
//! - Coefficients are returned on original data scale
//!
//! # Modules
//!
//! - [`preprocess`] - Data standardization utilities
//! - [`elastic_net`] - Core elastic net implementation
//! - [`ridge`] - Ridge regression (L2 penalty)
//! - [`lasso`] - Lasso regression (L1 penalty)
//! - [`path`] - Lambda path generation for regularization paths
// Re-exports for convenience
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;