Skip to content

ECM model.solve taking forever to run #3

@renantes

Description

@renantes

Hey there! First, I want to thank you for making this awesome package available.

I am trying to run an ECM on the attached csv file, which is an adjacency matrix of 866 nodes and 711718 non-null edges.
The problem is that I never get through model.solve. The only one that worked was "L-BFGS-B", but errors were huge.
I've already tried other methods, but they didn't work out.
Am I doing something wrong? Would you have any suggestion?
The python code I am running is:

"import pandas as pd
import numpy as np
import networkx as nx
import scipy.sparse
from maxent_graph import ecm

Load the proximity matrix

proximity_df = pd.read_csv('THECSVFILE.CSV', index_col=0)

Convert both the index and columns to integers to ensure they match

proximity_df.index = proximity_df.index.astype(int)
proximity_df.columns = proximity_df.columns.astype(int)

Create a sparse adjacency matrix from the proximity DataFrame

adj_matrix = proximity_df.values

Initialize the ECM model with the sparse adjacency matrix

model = ecm.ECM(adj_matrix)

Get the initial guess for the model

initial_guess = model.get_initial_guess()

Solve the model

solution = model.solve(initial_guess, method="trust-krylov", verbose=True)

Get the pval matrix from the solution

pval_M = model.get_pval_matrix(solution.x, adj_matrix)
dense_matrix = pval_M.toarray()
pval_df = pd.DataFrame(dense_matrix, index=proximity_df.index, columns=proximity_df.columns)

Print the pval matrix

print(pval_df)

proximidades_movingwindow_0.csv

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions