-
Notifications
You must be signed in to change notification settings - Fork 21
under what condition will the algorithm not converge? #23
Comments
Seems like some of your data are infinite. Did you clean your data before fitting the model? |
Yes,I have transformed my X to quantiles between 0 to 1, and y is also winsorized. I debugged the code, and found that in the loop of solving w, if I set a small alpha, w would be very large after several steps and the go to infinite. That's how the error 'array must not contain infs or NaNs' comes. So under what condition do this happen? |
I have found the problem. The stepsize in the inner group loop is not properly set. The method will converge if the stepsize is smaller. It seems that your method do not strictly follow the paper of Noah Simon. |
Thanks for your investigations. The group lasso implementation is actually vendored. Mind sharing how you fixed the problem? We might want to have our own group lasso implementation. |
I just set a smaller stepsize and increase the increase iterations. This is a very simple adjustment which sacrifices efficiency. I think a better solution is to change the stepsize dynamically according to the paper. |
I am training a group lasso model with time series data, which means rho=0 in my model. In every month, I train the model with the data in the past 24 months. The parameter alpha is very stable, around 0.0005. However, in several months, when I move ahead by one month, which means that I replace the data of month t-24 with the data of the latest month, the model do not converge. In this case, I need a far more larger parameters, which is aroung 0.002 to make the model converge. I am wondering why this happens. Because I only replace a small portion(less than 5%) of the training data, but the parameters change sharply. This may cause instability of the model, as in the previous month, I may choose 30 features, however in the current month, I can only choose 16 features.
Traceback (most recent call last):
File "D:\Program Files\Python\Python36\lib\site-packages\IPython\core\interactiveshell.py", line 2963, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 4, in
model = model.fit(p, y)
File "D:\Program Files\Python\Python36\lib\site-packages\sparsereg\model\group_lasso.py", line 33, in fit
max_iter=self.max_iter, rtol=self.tol)
File "D:\Program Files\Python\Python36\lib\site-packages\sparsereg\vendor\group_lasso\group_lasso.py", line 92, in sparse_group_lasso
delta = linalg.norm(tmp - w_new[group])
File "D:\Program Files\Python\Python36\lib\site-packages\scipy\linalg\misc.py", line 137, in norm
a = np.asarray_chkfinite(a)
File "D:\Program Files\Python\Python36\lib\site-packages\numpy\lib\function_base.py", line 1233, in asarray_chkfinite
"array must not contain infs or NaNs")
ValueError: array must not contain infs or NaNs
The text was updated successfully, but these errors were encountered: