You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exploring non-absolutely continuous models with respect to the Lebesgue-Stiltjes measure in the context of age replacement policy, I would like to use relife functions (typically, renewal_equation_solver) with modified model objects that include this preventive replacement.
To do so, we need the methods of these modified model objects to have the same inputs as a classic model objects. This means not calling ar explicitly when calling the sf method of an AgeReplacementModel, but instead retrieving ar from the model's attributes. Typically, we would like to do :
from relife.core.nested_model import AgeReplacementModel
from relife.models import Weibull
model = Weibull(shape=7.351,rate=0.036)
replacement_model = AgeReplacementModel(model,ar=15) # Create a model with age replacement 15. This will override the sf method of the Weibull method.
t = np.linspace(0,100,1000)
plt.plot(t,replacement_model.sf(t)) # We don't need to give ar as input when calling sf
Which would allow us to use renewal_equation_solver with replacement_model, since replacement_model.sf doesn't need an ar input :
If AgeReplacementModel is not supposed to be part of the user's API, we could instantiate these replacement model objects with a method of the LifetimeModel class that will create an AgeReplacementModel when called. For example :
I've supported this idea in #27#32. In both cases, I encourage the use of fluent interface or something close to it.
The remaining question is: should a_r (or a_0 in the case of LeftTruncatedModel) be implemented as an attribute? Personally, I have a preference for using attributes because, in many scenarios like yours, an alternative approach would require using utilities like functools.partial or similar tools to assign a value to a_r
Exploring non-absolutely continuous models with respect to the Lebesgue-Stiltjes measure in the context of age replacement policy, I would like to use relife functions (typically,
renewal_equation_solver
) with modified model objects that include this preventive replacement.To do so, we need the methods of these modified model objects to have the same inputs as a classic model objects. This means not calling
ar
explicitly when calling thesf
method of anAgeReplacementModel
, but instead retrievingar
from the model's attributes. Typically, we would like to do :Which would allow us to use
renewal_equation_solver
withreplacement_model
, sincereplacement_model.sf
doesn't need anar
input :If
AgeReplacementModel
is not supposed to be part of the user's API, we could instantiate these replacement model objects with a method of theLifetimeModel
class that will create anAgeReplacementModel
when called. For example :The text was updated successfully, but these errors were encountered: