This repository was archived by the owner on Dec 6, 2023. It is now read-only.
Description I can get the FistaRegressor to converge when data is trivial. The code for the simulated data is below.
from scipy import stats
N , P = 300 , 30
m_true = np .zeros (P )
m_true [:4 ] = [2 , - 2 , 2 , 3 ]
noise = 3 * stats .norm ().rvs (N )
data = 3 * stats .norm ().rvs ((N , P ))
target = data @ m_true + noise
fista = FistaRegressor (
C = 1 / n ,
penalty = 'l1' ,
alpha = lam , # The same alpha LassoCV.alpha_ finds
max_iter = 1000 ,
max_steps = 1000 ,
)
fista .fit (data , target )
(X axis are the individual coefficients and the Y axis are the fitted coef magnitude)
But if I use real data I cannot get it to converge at all.
from statsmodels .tools .tools import add_constant
from sklearn .datasets import load_boston
data , target = load_boston (return_X_y = True )
data = add_constant (data )
(X axis are the individual coefficients and the Y axis are the fitted coef magnitude)
I assume it has something to do with feature scaling but I'm not sure.
Reactions are currently unavailable
I can get the
FistaRegressorto converge when data is trivial. The code for the simulated data is below.(X axis are the individual coefficients and the Y axis are the fitted coef magnitude)
But if I use real data I cannot get it to converge at all.
(X axis are the individual coefficients and the Y axis are the fitted coef magnitude)
I assume it has something to do with feature scaling but I'm not sure.