-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update code base to support per-computed math.log
- Loading branch information
1 parent
618b5bb
commit 22ff836
Showing
7 changed files
with
120 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
networkx==2.1 | ||
pathlib;python_version<"3.4" | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
pytest==3.5.1 | ||
pytest==3.5.1 | ||
|
||
# for pytest helper | ||
pytest-helpers-namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
pytest_plugins = ['helpers_namespace'] | ||
|
||
import pytest | ||
|
||
|
||
@pytest.helpers.register | ||
def train_test_cases(): | ||
basic_test_case = [('A', 'a'), ('B', 'b')] | ||
|
||
test_cases = [ | ||
] | ||
|
||
for i in range(1, 4): | ||
test_cases.append([basic_test_case] * i) | ||
|
||
# return as list of list | ||
return test_cases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/env python | ||
# -*- coding: utf-8 -*- | ||
import pytest | ||
|
||
from MicroHMM.hmm import HMMModel | ||
|
||
|
||
@pytest.mark.parametrize("train_data", pytest.helpers.train_test_cases()) | ||
def test_hmm_train(train_data): | ||
first_train_data = train_data[0] | ||
|
||
hmm_model = HMMModel() | ||
|
||
for single_train_data in train_data: | ||
hmm_model.train_one_line(single_train_data) | ||
|
||
hmm_model.do_train() | ||
|
||
result = hmm_model.predict([i[0] for i in first_train_data]) | ||
|
||
assert first_train_data == result |