I am attempting to follow the tutorial here to do parametric survival analysis. This works to some extent but the predictive posterior on the y (time to failure) gives large numbers with the median time going well into 10’s years whereas I expect a machine to last at most 5 years.
I attempted to circumvent this by introducing an intermediary variable called mean (see model below) to restrict how far out this model can predict the mode time for a gumbel distribution.
def gumbel_sf(y, μ, σ): """ Survival function of Gumbel distribution. (1 - cdf) """ return 1. - tt.exp(-tt.exp(-(y - μ) / σ)) with pm.Model() as weibull_model: β = pm.Normal('β', 0., 1, shape=D) μ = X_.dot(β) s = pm.Bound(pm.Normal, lower=0, upper=0.1)('s', 5.) mean = pm.Bound(pm.Normal, lower=ymin, upper=ymax)('μ', μ, 0.05, shape=N) # Likelihood y_obs = pm.Gumbel('y_obs', mean[death_], s, observed=Y_[death_]) y_cens = pm.Potential('y_cens', gumbel_sf(Y_[~death_], mean[~death_], s)) # sample from posterior trace = pm.sample(tune=1000)
So I have a few questions about this,
- After sampling for ~300 steps I get the error below. How do I fix this?
ValueError: Mass matrix contains zeros on the diagonal.
The derivative of RV
μ_interval__.ravel() is zero.
- If I don’t include
shape=Nin the line for
meanI get the error:
IndexError: too many indices for array. I’m a bit surprised that I needed to include that, comments?
- Is there a better/correct way of bounding the estimated time left? I tried bounding the gumbel distribution but then I get the error that I cannot bound observed variables.
- I get the warning
FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)]. What does this mean. It is referring to my
Questions 1 and 2 are the more important questions to me. Any thoughts comments would be highly appreciated.