davidhallac / TVGL

53 stars 24 forks source link

Python 3: name 'semidefinite' is not defined #7

Open fabian-sp opened 5 years ago

fabian-sp commented 5 years ago

Hi David,

I tried to get TVGL running in Python 3.7 and conducted the steps: 1) 2to3 applied to the whole directory 2) install cvxpy 0.4 and snap 3) in cvxpy.atoms.log_sum_exp i had to change scipy.misc to scipy.special for the import of logsumexp

When running exampleTVGL.py I get the error name 'semidefinite' is not defined

I do not quite understand where semidefinite should come from, can you help me with the issue?

Barbab1 commented 3 years ago

Did you managed to run the code? I followed your step 1 and 2 and get: SyntaxError: import * only allowed at module level

fabian-sp commented 3 years ago

I think this could be solved as well (you just have to replace import * ). But if you want to do Time-Varying Graphical Lasso, there are other packages as well which are running in Python 3.x., for example https://github.com/fdtomasi/regain or my own implementation https://github.com/fabian-sp/GGLasso.

Barbab1 commented 3 years ago

Replace import * with? Thank you for the kind response. At first glance (now I am going to look more carefully) it seems that the two links are not directly referring the Time-Varying Graphical Lasso paper code which I was looking for (one of them is the Latent Variable Time-varying Network Graphical Lasso and the other Multiple Graphical Lasso problem), but thank you they could be very useful for me. Are there some similar packages also for Matlab? Is there an updated python 3.x version of the code of the TVGL paper?

fabian-sp commented 3 years ago

instead of * list all functions that are used from the module. So regain implemented Time-varying Graphical Lasso with and without Latent Varibales, the version without is here https://github.com/fdtomasi/regain/blob/master/regain/covariance/time_graphical_lasso_.py My package has Group Graphical Lasso and Fused (=Time-Varying) Graphical Lasso. So both packages should be adequate for solving Time-Varying GL problems.

I don't know of a TVGL version for 3.x, also not sure whether there is code for Matlab.

Barbab1 commented 3 years ago

Thank you 💪🏻

Dedalus9 commented 1 year ago

@fabian-sp It seems that regain's implementation of Time-varying Graphical Lasso only ever outputs a diagonal matrix for each time point when the sample size for each time point is one. This is a flaw in their implementation.