-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
to_fit
data in NHPP/NHPPAgeReplacementPolicy
#28
Comments
If we dedicate |
I want to highlight another issue with the current For NHPP, this issue becomes even more pronounced. At the moment, I don’t see a clear way to avoid writing an inefficient and inelegant for-loop to process these resulting 1D arrays generated by Thus, my suggestion is to rethink the relationship between Here’s how I envision this work: while the structure of the generators (yield arrays) in |
After several attempts, I realized that the problem might be more complex than it initially seemed. Here's why: model = Weibull(...)
model1 = Gompertz(...)
policy = AgeReplacementPolicy(model, ..., model1=model1, ...) Once defined, I can use the sample_data = policy.sample(nb_samples=10, end_time=...)
sample_data.mean_total_reward() However, calling time, event, entry = sample_data.to_fit(t0, tf) makes no sense in this context. The issue stems from the ambiguity about which model the lifetimes were derived from. This creates confusion as it is unclear whether the lifetimes correspond to
ProposalA better and more intuitive approach can be structured as follows: # Extract fit data directly from the base model
time, event, entry = model.get_fit_data(size=..., t0, tf)
# With age replacement (ar) censoring applied
time, event, entry = AgeReplacementModel(model).get_fit_data(ar, size=..., t0, tf)
# When `t0 != 0`, apply left truncations
time, event, entry = model.get_fit_data(size=..., t0, tf) # Where t0 != 0 With this setup:
What About
|
duplicated in #32 |
only for branch v2.0.0/nhpp
Both
NHPP
andNHPPAgeReplacementPolicy
can be used to sample data.However, I think that
NHPP
should not be used to sample data, as it leads to two problems:end_time
toNHPP.sample
is not straightforward and can quickly lead to errors if theend_time
(the time horizon) is too large. It doesn’t even need to be very high for this issue to arise, as the generated durations can grow rapidly in number with very small values. Leaving this responsibility inNHPP.sample
might lead to ambiguous behavior or errors that are hard to diagnose.to_fit
to convert generated data to fit-like arguments would be problematic because setting thet0
andtf
observation window is difficult when data can be contained within a very small interval. I don’t want a new user learning aboutNHPP
to be confused or disturbed by unintuitive warnings or behaviors specific toNHPP
that would be hard to explain.That's why I want to propose this solution:
process
module, which model stochastic processes, should not have thesample
function as part of their interface. As a consequence, I would remove these methods fromRenewalProcess
andRenewalRewardProcess
.policies
module should include asample
method.This approach makes more sense to me, as it would help enforce the separation of concerns between stochastic processes and policies. It would also solve the issues described above, as the
end_time
could be set without any problem withinNHPPAgeReplacementPolicy
.What do you think?
The text was updated successfully, but these errors were encountered: