Closed ikarmann closed 4 months ago
Hi, thanks for reporting the bug. Could you post a short snippet of what produced the error, and the changes you made to fix it?
Hello!
I tried running
glasso.model_selection(modelselect_params={'lambda1_range':np.logspace(0,-2,20), 'lambda2_range':[1e-8]}, method='eBIC')
and got an indexing error from line
grid1 = L1.shape[0]; grid2 = L2.shape[1]
in the function grid_search as L2 becomes 1-dimensional.
As a solution I added the lines
if len(L1.shape) == 1: L1 = np.expand_dims(L1, 1)
if len(L2.shape) == 1: L2 = np.expand_dims(L2, 1)
before that.
Additionally, newer versions of numpy have deprecated the np.int and np.float aliases, so I had to remove those from the assert
statements.
Thank you and congrats for the insightful developments in graphical lasso.
thanks, I will look into it.
Two remarks:
lambda2
very small, you essentially solve K independent Single Graphical Lasso problems; so if this is what you want to do, you can do that also without the lambda2-range.np.float
issue in version 0.2.0I just realized that removing the .squeeze()
from the lambda_grid
is a more reasonable solution.
I was trying to make parameter search over lambda1 keeping lambda2 constant. However this results in indexing error since the internal variable L2 becomes an 1-dimensional array. I solved the problem by adding np.expand_dims if L2 is 1d. Maybe this could be incorporated in the code.
Tx