INNER CODE UNIT · Python
time_of_death
CamDavidsonPilon/lifetimes · lifetimes/generate_data.py:182
time_of_death = random.exponential(scale=1.0 / mu)
# hacky until I can find something better
times = []
next_purchase_in = random.exponential(scale=1.0 / l)
while np.sum(times) + next_purchase_in < min(time_of_death, T[i]):
times.append(next_purchase_in)
next_purchase_in = random.exponential(scale=1.0 / l)
times = np.array(times).cumsum()
df.iloc[i] = (
np.unique(np.array(times).astype(int)).shape[0],
np.max(times if times.shape[0] > 0 else 0),
T[i],
l,
mu,
time_of_death > T[i],
i,