コード例 #1
0
 def test_seeded_run(self):
     random.seed(1)
     m = AR(c=1, sigma=1, pcoeff=[1, -1, 0.5])
     x = m.generate(10)
     expected = [
         2.28818475, 4.73763036, 3.51578142, 0.15769978, -1.08143967,
         1.55008577, 2.68827216, 0.16063711, -0.55328019, 1.76359339
     ]
     assert x == pytest.approx(expected)
コード例 #2
0
 def test_periodic(self):
     m = AR(c=1, sigma=0, pcoeff=[1, -1])
     x = m.generate(10)
     assert x == [1.0, 2.0, 2.0, 1.0, 0.0, 0.0, 1.0, 2.0, 2.0, 1.0]
コード例 #3
0
 def test_linear_using_buffer(self):
     m = AR(c=1, sigma=0, pcoeff=[1], x_buff=[4])
     x = m.generate(10)
     assert x == [float(x) for x in range(5, 15)]
コード例 #4
0
 def test_white_noise(self):
     m = AR(c=0, sigma=1, pcoeff=[])
     s = pd.Series(m.generate(1000))
     assert s.std() == pytest.approx(1.0, abs=1e2)
     assert s.mean() == pytest.approx(0.0, abs=1e2)
コード例 #5
0
 def test_linear_multiple_calls(self):
     m = AR(c=1, sigma=0, pcoeff=[1])
     x = m.generate(10)
     assert x == [float(x) for x in range(1, 11)]
     x = m.generate(10)
     assert x == [float(x) for x in range(11, 21)]
コード例 #6
0
 def test_linear(self):
     m = AR(c=1, sigma=0, pcoeff=[1])
     x = m.generate(10)
     assert x == [float(x) for x in range(1, 11)]
コード例 #7
0
 def test_constant_generation(self):
     m = AR(c=1, sigma=0)
     x = m.generate(10)
     assert x == [1] * 10
コード例 #8
0
 def test_no_unwanted_api_params(self):
     with pytest.raises(TypeError):
         m = AR(mu=0.0, qcoeff=[])
コード例 #9
0
 def test_default_creation(self):
     m = AR()
     assert m