pub enum Solver {
Lbfgs,
NewtonCholesky,
}Expand description
The optimization algorithm requested for fitting a GLM, mirroring sklearn’s
solver constructor parameter (sklearn/linear_model/_glm/glm.py:140-145,
StrOptions({"lbfgs", "newton-cholesky"}), default "lbfgs").
Implementation note (R-DEV-7 — Rust analog). ferrolearn fits all GLMs via
IRLS / Fisher-scoring (fn fit_glm_irls); the solver parameter is accepted
for scikit-learn API parity (R-DEV-2) and selects the requested optimizer’s
contract. The penalized GLM objective is convex, so IRLS converges to the
same minimizer as both sklearn’s lbfgs (scipy L-BFGS-B) and
newton-cholesky (Newton-Raphson with an inner Cholesky solve) — all three
are descent methods on one convex objective. Therefore the observable
contract (coef_ / intercept_) matches sklearn for either solver
value, and ferrolearn does not vary the numerical path between them
(verified live: PoissonRegressor(alpha=0.5) gives the same fitted
attributes to ~1e-9 for lbfgs and newton-cholesky).
The type system constrains valid values to the two sklearn options, mirroring
the role of sklearn’s StrOptions parameter constraint.
Variants§
Lbfgs
L-BFGS-B (sklearn’s default "lbfgs"): a quasi-Newton optimizer on the
penalized loss + gradient (glm.py:263-284). In ferrolearn the fit is
performed by IRLS, which reaches the same convex optimum (R-DEV-7).
NewtonCholesky
Newton-Cholesky (sklearn’s "newton-cholesky"): Newton-Raphson steps
with an inner Cholesky solve, equivalent in exact arithmetic to iterated
reweighted least squares (glm.py:72-78, :285-296). In ferrolearn the
fit is performed by IRLS, which reaches the same convex optimum (R-DEV-7).
Trait Implementations§
impl Copy for Solver
impl Eq for Solver
impl StructuralPartialEq for Solver
Auto Trait Implementations§
impl Freeze for Solver
impl RefUnwindSafe for Solver
impl Send for Solver
impl Sync for Solver
impl Unpin for Solver
impl UnsafeUnpin for Solver
impl UnwindSafe for Solver
Blanket Implementations§
impl<T> Boilerplate for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more