Skip to content

Commit

Permalink
Fix Json input with new transition data structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules Françoise committed Apr 27, 2016
1 parent 1865407 commit b98d8ee
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/models/hierarchical_hmm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,7 @@ void xmm::HierarchicalHMM::from_json(JSONNode root) {
"Wrong type for node 'prior': was expecting "
"'JSON_ARRAY'",
root_it->name());
prior.resize(numModels);
json2vector(*root_it, prior, numModels);

// Get High-level Exit Probabilities
Expand All @@ -942,6 +943,7 @@ void xmm::HierarchicalHMM::from_json(JSONNode root) {
"Wrong type for node 'exit': was expecting "
"'JSON_ARRAY'",
root_it->name());
exitTransition.resize(numModels);
json2vector(*root_it, exitTransition, numModels);

// Get High-level Transition Matrix
Expand All @@ -956,9 +958,11 @@ void xmm::HierarchicalHMM::from_json(JSONNode root) {
std::vector<double> trans(numModels * numModels);
json2vector(*root_it, trans, numModels * numModels);
transition.resize(numModels);
for (int i = 0; i < numModels; i++)
for (int i = 0; i < numModels; i++) {
transition[i].resize(numModels);
for (int j = 0; j < numModels; j++)
transition[i][j] = trans[i * numModels + j];
}

} catch (JSONException& e) {
throw JSONException(e, root.name());
Expand Down

0 comments on commit b98d8ee

Please sign in to comment.