Access to a Frozen Distribution's Name
When creating a frozen distribution from the scipy.stats
package, how can the distribution's name be accessed once the distribution instance is frozen? Trying to access the .name
attribute produces an error since it is no longer an attribute of the rv
variable.
import scipy.stats as stats
# Get the name of the distribution
print 'gamma :', stats.norm.name
# Create frozen distribution
rv = stats.norm()
# Get the name of the frozen distribution
print 'rv :', rv.name
gamma : norm
rv :
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
9
10 # Get the name of the frozen distribution
---> 11 print 'rv :', rv.name
AttributeError: 'rv_frozen' object has no attribute 'name'
The Frozen Distribution
rv_frozen
ClassThe frozen distribution, or
rv_frozen
class creates an instance of the distribution during initialization and this is stored in theself.dist
attribute. To access attributes of the original distribution, userv.dist.{attribute}
.