jmschrei / pomegranate

Fast, flexible and easy to use probabilistic modelling in Python.
http://pomegranate.readthedocs.org/en/latest/
MIT License
3.35k stars 589 forks source link

[BUG] StudentT: Distribution `name` is incorrectly overwritten when subclassing #1070

Closed AKuederle closed 2 months ago

AKuederle commented 10 months ago

Describe the bug As the name of the distribution is set in the __init__, any distribution that subclasses another distribution, needs to make sure that name is set after calling super.

This goes wrong for the StudentT distribution.

StudentT().name # <- prints "Normal"

This is an easy fix in this case, but it might be worse it to change the way name is set. As it is a class and not an instance variable, it might be easier to just define it in the class body directly and not the __init__. This way it can be overwritten without worrying about the correct order in the init.

jmschrei commented 2 months ago

This should be fixed in v1.1.0, thanks!