restored the test so that it contains everything except the line that hangs AppVeyor
import pandas as pd
import keanu as kn
import numpy as np
-def test_temp_pass():
- assert True
-def test_temp_fail():
- assert False
def test_coalmining():
FILE = "data/coal-mining-disaster-data.csv"
@@ -19,17 +15,16 @@ def test_coalmining():
m.late_rate = kn.Exponential(1.0)
m.years = np.array(data.index)
+ m.beforeSwitch = False
# m.beforeSwitch = m.switchpoint > m.years
- # m.rates = kn.DoubleIf([1, 1], beforeSwitch, m.early_rate, m.late_rate)
- # m.disasters = kn.Poisson(m.rates)
+ m.rates = kn.DoubleIf([1, 1], m.beforeSwitch, m.early_rate, m.late_rate)
+ m.disasters = kn.Poisson(m.rates)
- # m.disasters.observe(data.values)
+ m.disasters.observe(data.values)
- # net = kn.BayesNet(m.switchpoint.getConnectedGraph())
- # posterior_dist_samples = kn.MetropolisHastings().get_posterior_samples(net, net.getLatentVertices(), 50000)
- # posterior_dist_samples.drop(10000).downSample(5)
+ net = kn.BayesNet(m.switchpoint.getConnectedGraph())
+ posterior_dist_samples = kn.MetropolisHastings().get_posterior_samples(net, net.getLatentVertices(), 50000)
+ posterior_dist_samples.drop(10000).downSample(5)
- # switch_year = posterior_dist_samples.getIntegerTensorSamples(m.switchpoint.unwrap()).getScalarMode()
- # assert switch_year == 1890
-
- assert False
+ switch_year = posterior_dist_samples.getIntegerTensorSamples(m.switchpoint.unwrap()).getScalarMode()
+ assert switch_year == 1890
