24 using namespace shogun;
57 CFeatures* trainfeatures=
ui->ui_features->get_train_features();
59 SG_ERROR(
"Assign train features first.\n");
62 SG_ERROR(
"Features must be STRING of type WORD.\n");
78 CFeatures* trainfeatures=
ui->ui_features->get_train_features();
80 SG_ERROR(
"Assign train features first.\n");
83 SG_ERROR(
"Features must be STRING of type WORD.\n");
96 SG_ERROR(
"Assign observation first.\n");
106 SG_ERROR(
"Assign observation first.\n");
116 SG_ERROR(
"Assign observation first.\n");
126 CFeatures* trainfeatures=
ui->ui_features->get_train_features();
128 SG_ERROR(
"Assign train features first.\n");
131 SG_ERROR(
"Features must be STRING of type WORD.\n");
134 ui_features->get_train_features());
136 bool right_align=
false;
139 SG_INFO(
"Using alignment to right.\n");
143 SG_INFO(
"Using alignment to left.\n");
152 ui_features->get_test_features();
165 for (int32_t i=0; i<num_vec; i++)
176 ui_features->get_test_features();
196 ui_features->get_test_features();
206 for (int32_t i=0; i<num_vec; i++)
218 ui_features->get_test_features();
228 for (int32_t i=0; i<num_vec; i++)
241 ui_features->get_test_features();
261 FILE* model_file=fopen(filename,
"r");
263 SG_ERROR(
"Opening file %s failed.\n", filename);
270 SG_ERROR(
"Reading file %s failed.\n", filename);
274 SG_INFO(
"File %s successfully read.\n", filename);
277 if (base1!=-1 && base2!=-1)
282 for (int32_t i=0; i<h->
get_M(); i++)
342 if (strncmp(target,
"POS", 3)==0)
348 else if (strncmp(target,
"NEG", 3)==0)
354 else if (strncmp(target,
"TEST", 4)==0)
361 SG_ERROR(
"Target POS|NEG|TEST is missing.\n");
370 FILE* model_file=fopen(filename,
"r");
372 SG_ERROR(
"Opening file %s failed.\n", filename);
380 SG_INFO(
"Loaded HMM successfully from file %s.\n", filename);
396 FILE* file=fopen(filename,
"w");
405 if (!file || !result)
406 SG_ERROR(
"Writing to file %s failed!\n", filename);
408 SG_INFO(
"Successfully written model into %s!\n", filename);
422 FILE* def_file=fopen(filename,
"r");
424 SG_ERROR(
"Opening file %s failed\n", filename);
428 SG_INFO(
"Definitions successfully read from %s.\n", filename);
432 SG_ERROR(
"Couldn't load definitions form file %s.\n", filename);
445 FILE* file=fopen(filename,
"w");
456 if (!file || !result)
457 SG_ERROR(
"Writing to file %s failed!\n", filename);
459 SG_INFO(
"Successfully written likelihoods into %s!\n", filename);
473 FILE* file=fopen(filename,
"w");
481 ui_features->get_test_features();
488 if (!file || !result)
489 SG_ERROR(
"Writing to file %s failed!\n", filename);
491 SG_INFO(
"Successfully written path into %s!\n", filename);
567 SG_ERROR(
"Set pos and neg HMM first!\n");
573 if (pos_M!=neg_M || pos_N!=neg_N)
574 SG_ERROR(
"Pos and neg HMM's differ in number of emissions or states.\n");
582 for (int32_t i=0; i<pos_N; i++)
584 for (int32_t j=0; j<pos_M; j++)
611 for (int32_t i=0; i<n; i++)
613 for (int32_t j=0; j<m; j++)
630 SG_ERROR(
"Set observations first.\n");