python - How to subclass scipy.stats.norm? -


i'd subclass scipy.stats.norm can have instances of frozen distributions (i.e. specific means/variances) additional functionality. however, can't past first step of constructing instance.

edit: here transcript of interactive session demonstrates problem (there's nothing sleeves)

in [1]: import scipy.stats  in [2]: class a(scipy.stats.norm):    ...:     def __init__(self):    ...:         super( a, self).__init__()    ...:             ...:          --------------------------------------------------------------------------- typeerror                                 traceback (most recent call last)  /home/dave/src/python2.7/density_estimation/<ipython console> in <module>()  /usr/lib64/python2.7/site-packages/scipy/stats/distributions.pyc in __init__(self, momtype, a, b, xa, xb, xtol, badvalue, name, longname, shapes, extradoc)     958      959         if longname none: --> 960             if name[0] in ['aeiouaeiou']:     961                 hstr = "an "     962             else:  typeerror: error when calling metaclass bases     'nonetype' object not subscriptable 

i can see scipy.stats doing sort of weird thing norm specific instance of (sometype?), it's not normal class definition, don't see how invoke constructor it.

edit #2: scipy version may relevant.

in [19]: scipy.__version__ out[19]: '0.9.0' 

scipy.stats.norm not class. instance of scipy.stats.norm_gen. calling norm(*args, **kwds) return instance of rv_frozen norm , arguments gave it. if want new kind of frozen distribution, subclass rv_frozen add methods , instantiate norm , arguments. don't worry subclassing norm_gen.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -