Skip to content

Incorrect exponential distribution parameter names in BlockState #9

@andreamusso96

Description

@andreamusso96

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.

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