antmd / graph-tool

graph-tool - Efficient network analysis
GNU General Public License v3.0
96 stars 5 forks source link

Incorrect exponential distribution parameter names in BlockState #9

Open andreamusso96 opened 1 year ago

andreamusso96 commented 1 year ago

When using "real-exponential" weight in the BlockState class there is an inconsistency between the source code and documentation.

The documentation states that for the "real-exponential" or "discrete-poisson" weights the parameter lists is "r", "theta". Here is the exact sentence in the documentation:

The parameter list is ``["r", "theta"]``, corresponding to the parameters of the Gamma distribution. 

However, if one calls BlockState feeding "rec_params=[{"r":1, "theta": 2}" a bug occurs. Namely,

unknown parameters for weight type: ['r', 'theta']

The reason behind this bug can be found in the source code. The relevant source code reads:

...
elif rt in [libinference.rec_type.real_exponential,
                        libinference.rec_type.discrete_poisson]:
                if rec_params[i] != "microcanonical":
                    defaults = {"alpha": 1,
                                "beta": self.rec[i].fa.mean()}
                else:
                    defaults = {"alpha": numpy.nan,
                                "beta": numpy.nan}
...

Hence, the parameters "r" and "theta" are actually called "alpha" and "beta" in the source code.

count0 commented 7 months ago

This is NOT the official repository of graph-tool! It's a clone someone made over 9 years ago!

The actual repository is here: https://git.skewed.de/count0/graph-tool

If you want the developers to actually see your issues, please post there!