Skip to content

Adjusting tolerance for solvers #35

@t-silvers

Description

@t-silvers

Hi, Thanks for writing this useful package.

It looks like FISTA isn't respecting values passed to tol. I haven't checked other solvers or poked around much otherwise. See below to reproduce.

from yaglm.Glm import Glm
from yaglm.config.penalty import Lasso
from yaglm.solver.FISTA import FISTA
from yaglm.toy_data import sample_sparse_lin_reg

X, y, _ = sample_sparse_lin_reg(n_samples=100, n_features=1000)

mod = Glm(loss='lin_reg', penalty=Lasso(), solver=FISTA())
#                                 ~~~~~~~ <- 'lasso' in Readme.md, but isn't supported
mod.fit(X, y)
# /path/to/lib/python3.10/site-packages/scipy/sparse/linalg/_eigen/_svds.py:314: UserWarning: Exited at iteration 20 with accuracies
# [0.93402857]
# not reaching the requested tolerance 3.162277660168379e-06.
#   eigvals, eigvec = lobpcg(XH_X, X, tol=tol ** 2, maxiter=maxiter,
# etc.

import numpy as np
mod = Glm(loss='lin_reg', penalty=Lasso(), solver=FISTA(tol=np.inf))
mod.fit(X, y)
# same UserWarning

print(mod.solver.tol)
# inf

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions