The KaplanMeierFitter class (KM) has a handy label attribute: a plot of the fitted values will inherit the label in the legend.
However, the corresponding attribute of an instance becomes _label:
km1 = KM(label='S1: Stage III')
km1.label # 'S1: Stage III'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-116-bb7f3ecaa1b2> in <module>
----> 1 km1.label
AttributeError: 'KaplanMeierFitter' object has no attribute 'label'
Having to run dir() on an instance to find out if/how a class attribute is inherited is a drawback, especially when working with multiple models programmatically.
Is there a specific reason for this?
The KaplanMeierFitter class (KM) has a handy
label
attribute: a plot of the fitted values will inherit the label in the legend. However, the corresponding attribute of an instance becomes_label
:But
Having to run dir() on an instance to find out if/how a class attribute is inherited is a drawback, especially when working with multiple models programmatically. Is there a specific reason for this?