0

I'm a newbie to pymc3 and bayesian analysis. What I want to analyze is as follows:

data schema: (with 60000 rows)

x_1, x_2, survival_duration

I want to model how 'amazing' a certain case is, with features x_1 and x_2(Not the exact prediction points from the model).

My modeling assumption is:

mu = a * x_1 + b * x_2 + c

survival_duration ~ Exp(1/mu)

My code is as follows:

"""
x_1, x_2, survival_duration: 60000 values for each
a = pm.Normal("a", mu=0, sigma=1)
b = pm.Normal("b", mu=0, sigma=1)
c = pm.Normal("c", mu=0, sigma=1)
mu = a * x_1 + b * x_2 + c

survival_duration ~ Exponential(mu)
"""

model = pm.Model()
with model:
    a = pm.Exponential("a", lam=1)
    b = pm.Exponential("b", lam=1)
    c = pm.Uniform("c", lower=0, upper=100)
    mu = pm.Deterministic("mu", a * x_1 + b * x_2 + c)
    likelihood = pm.Exponential("survival_duration", lam=1/mu, observed=survival_duration)
    trace = pm.sample(1000, chains=4)

And I got some reasonable posteriors for a, b, and c.

Then how can I evaluate that this properly models distributions conditioned by x_1 and x_2?

Any scalar values for evaluations? or any visualizations available?

Thank you.!

merv
  • 67,214
  • 13
  • 180
  • 245
ryanc
  • 1
  • 1

0 Answers0