GiulioRossetti / cdlib

Community Discovery Library
http://cdlib.readthedocs.io
BSD 2-Clause "Simplified" License
368 stars 71 forks source link

AttributeError: module 'cdlib.algorithms' has no attribute 'XXX' #166

Closed BradKML closed 3 years ago

BradKML commented 3 years ago

Describe the bug

from cdlib import algorithms
<insert code for creating a Graph here, with G being the variable>
for i in [algorithms.gemsec, algorithms.head_tail, algorithms.kcut, algorithms.lswl, algorithms.lswl_plus, algorithms.paris, algorithms.pycombo, algorithms.ricci_community, algorithms.scd, algorithms.threshold_clustering]:
  communities = i(G)

To Reproduce Steps to reproduce the behavior:

Expected behavior expect that this would work since other algorithms checks out. [algorithms.aslpaw, algorithms.chinesewhispers, algorithms.edmot, algorithms.der, algorithms.cpm, algorithms.ga, algorithms.gdmp2, algorithms.greedy_modularity, algorithms.infomap, algorithms.significance_communities, algorithms.surprise_communities, algorithms.walktrap, algorithms.sbm_dl, algorithms.sbm_dl_nested]

Utility To quickly iterate through multiple algorithms at once

GiulioRossetti commented 3 years ago

Hi, some CDlib algorithms require additional, mandatory, parameters for which there is not a default value. Thus, this is not a bug but an expected behavior.

For such a reason the code snippet you provided cannot be applied as a default solution to instantiate iteratively all exposed algorithms.

GiulioRossetti commented 3 years ago

Moreover, there is already a way to pool algorithms. See https://cdlib.readthedocs.io/en/latest/reference/ensemble.html#multiple-instantiation

BradKML commented 3 years ago

@GiulioRossetti what if instead of pooling, we are trying to do cross-model evaluations?

GiulioRossetti commented 3 years ago

@GiulioRossetti what if instead of pooling, we are trying to do cross-model evaluations?

To perform cross-model evaluation/comparison, given a graph you still need to compute a set of clusterings, each applying a different algorithm to it. For such a purpose pooling (or even grid search if you aim to fine-tune model parameters) is fine since it only offers a standard way to structure multi-model experiments.