Skip to content

Commit 92308c2

Browse files
committed
add start of testing hmm
1 parent cff29f3 commit 92308c2

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import logging
2+
import unittest
3+
4+
import numpy as np
5+
from numpy.testing import assert_array_almost_equal
6+
import pandas as pd
7+
8+
from fcest.models.hidden_markov_models import HiddenMarkovModel
9+
10+
logging.basicConfig(
11+
format='%(asctime)s : %(levelname)s : %(message)s',
12+
datefmt='%d-%b-%y %H:%M:%S',
13+
level=logging.INFO
14+
)
15+
16+
17+
class TestHiddenMarkovModel(unittest.TestCase):
18+
"""
19+
Test the HiddenMarkovModel class.
20+
"""
21+
22+
def test_hidden_markov_model(self):
23+
"""
24+
Test various instantiations of the HiddenMarkovModel class.
25+
"""
26+
27+
m = HiddenMarkovModel()
28+
m.fit_model(
29+
training_data_df=self._get_dummy_training_data(),
30+
)
31+
32+
@staticmethod
33+
def _get_dummy_training_data(
34+
num_time_series: int = 2, num_time_steps: int = 400
35+
) -> pd.DataFrame:
36+
np.random.seed(2023)
37+
return pd.DataFrame(
38+
np.random.normal(size=(num_time_steps, num_time_series))
39+
)
40+
41+
42+
if __name__ == "__main__":
43+
unittest.main()

0 commit comments

Comments
 (0)