Delete bayesian_model.py
Browse files- bayesian_model.py +0 -27
bayesian_model.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Pyro model for online learning of component failure probabilities.
|
| 3 |
-
"""
|
| 4 |
-
import pyro
|
| 5 |
-
import pyro.distributions as dist
|
| 6 |
-
import torch
|
| 7 |
-
|
| 8 |
-
def failure_model(observations=None):
|
| 9 |
-
"""
|
| 10 |
-
Bayesian model for component failure rates.
|
| 11 |
-
observations: tensor of observed failures (0/1) for each component.
|
| 12 |
-
"""
|
| 13 |
-
# Priors for different component types
|
| 14 |
-
switch_failure_rate = pyro.sample("switch_failure", dist.Beta(1, 10))
|
| 15 |
-
server_failure_rate = pyro.sample("server_failure", dist.Beta(1, 20))
|
| 16 |
-
service_failure_rate = pyro.sample("service_failure", dist.Beta(1, 5))
|
| 17 |
-
|
| 18 |
-
# If observations provided, condition on them
|
| 19 |
-
if observations is not None:
|
| 20 |
-
with pyro.plate("components", len(observations)):
|
| 21 |
-
pyro.sample("obs", dist.Bernoulli(probs=...), obs=observations)
|
| 22 |
-
|
| 23 |
-
return {
|
| 24 |
-
"switch": switch_failure_rate,
|
| 25 |
-
"server": server_failure_rate,
|
| 26 |
-
"service": service_failure_rate
|
| 27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|