Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to interpret the output of the ganger_lasso #143

Open
cunjunyu opened this issue Oct 14, 2023 · 3 comments
Open

how to interpret the output of the ganger_lasso #143

cunjunyu opened this issue Oct 14, 2023 · 3 comments

Comments

@cunjunyu
Copy link

Hi, thanks for the great work.

I am currently experimenting with the granger_lasso algorithm provided in the repository.

Given that one time series has N dimensions, and the time lag is equal to T.
The shape of the output of granger_lasso is [N, N * T].

May I know how I should interpret this and convert it into a [T, N, N] matrix where, along the time lag dimension, the matrix [N, N] represents the influence of the i-th node on the j-th node.

Thank you!

@kunwuz
Copy link
Collaborator

kunwuz commented Oct 16, 2023

Hi, maybe something as follows could be helpful:

reshaped_coeff = np.zeros((T, N, N))
for t in range(T):
    block = coeff[:, N*t:N*(t+1)]
    reshaped_coeff[t] = block

@cunjunyu
Copy link
Author

Thank you for the prompt reply.

I have one more thing to clarify. In the implementation, it says:

The ij-th entry in A_k represents the causal influence from the j-th variable to the i-th variable.

Should I expect the same for the reshaped matrix?

Thank you!

@mingming-gong
Copy link

it should be guaranteed if you use the code provided by kunwz. You can also check whether the t-th NxN matrix is the same as coeff[:, Nt:N(t+1)].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants