Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
djx0126 committed Oct 15, 2017
1 parent c8109e2 commit 8f46008
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions HMM/hmm_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ def run_test_on_X(X, clf):
sum_loose_test_accuracy = 0
sum_loose_verify_accuracy = 0
n_run = 10
best_accuracy = 0

for i in range(n_run):
clf = train_on_X(X_train)
accuracy, loose_accuracy = run_test_on_X(X_train, clf)
Expand All @@ -189,6 +191,9 @@ def run_test_on_X(X, clf):
sum_loose_accuracy += loose_accuracy
sum_loose_test_accuracy += test_loose_accuracy
sum_loose_verify_accuracy += verify_loose_accuracy
if accuracy + test_accuracy > best_accuracy:
best_accuracy = accuracy + test_accuracy
best_model = clf

print(sum_accuracy/n_run)
print(sum_test_accuracy/n_run)
Expand All @@ -198,3 +203,9 @@ def run_test_on_X(X, clf):
print(sum_loose_test_accuracy/n_run)
print(sum_loose_verify_accuracy/n_run)

print('start')
print(best_model.startprob_)
print('trans')
print(best_model.transmat_)
print('emission')
print(best_model.emissionprob_)

0 comments on commit 8f46008

Please sign in to comment.