BorgwardtLab/WWL

numpy 1.26.4 incompatible with ContinuousWeisfeilerLehman._preprocess_graphs

Closed this issue · 0 comments

node_features = np.asarray(node_features)

Hi team,

I've recently upgraded numpy from 1.23.4 to 1.26.4 and am no longer able to execute ContinuousWeisfeilerLehman.fit_transform because of an error that occurs in ContinuousWeisfeilerLehman._preprocess_graphs in line 162:

File ~/.conda/envs/graphcompass_venv/lib/python3.10/site-packages/wwl/propagation_scheme.py:162, in ContinuousWeisfeilerLehman._preprocess_graphs(self, X)
    157 # By default, keep degree or label as features, if other features shall
    158 # to be used (e.g. the one from the TU Dortmund website), 
    159 # provide them to the fit_transform function.
    161 n_nodes = np.asarray(n_nodes)
--> 162 node_features = np.asarray(node_features)
    164 return node_features, adj_mat, n_nodes

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (79,) + inhomogeneous part.

Newer versions of numpy no longer (silently) support creating arrays out of list-of-lists with sublists of unequal length, which is exactly what our node_features object is. Newer version require that we specify dtype=object as in
node_features = np.asarray(node_features, dtype=object) to explicitly allow this.

I can create a PR to address this issue. Thanks for your support!

Merel