22 using namespace shogun;
55 CFeatures* trainfeatures=
ui->ui_features->get_train_features();
57 SG_ERROR(
"Assign train features first.\n");
60 SG_ERROR(
"Features must be STRING of type WORD.\n");
76 CFeatures* trainfeatures=
ui->ui_features->get_train_features();
78 SG_ERROR(
"Assign train features first.\n");
81 SG_ERROR(
"Features must be STRING of type WORD.\n");
94 SG_ERROR(
"Assign observation first.\n");
104 SG_ERROR(
"Assign observation first.\n");
114 SG_ERROR(
"Assign observation first.\n");
124 CFeatures* trainfeatures=
ui->ui_features->get_train_features();
126 SG_ERROR(
"Assign train features first.\n");
129 SG_ERROR(
"Features must be STRING of type WORD.\n");
132 ui_features->get_train_features());
134 bool right_align=
false;
137 SG_INFO(
"Using alignment to right.\n");
141 SG_INFO(
"Using alignment to left.\n");
150 ui_features->get_test_features();
163 for (int32_t i=0; i<num_vec; i++)
174 ui_features->get_test_features();
194 ui_features->get_test_features();
204 for (int32_t i=0; i<num_vec; i++)
216 ui_features->get_test_features();
226 for (int32_t i=0; i<num_vec; i++)
239 ui_features->get_test_features();
259 FILE* model_file=fopen(filename,
"r");
261 SG_ERROR(
"Opening file %s failed.\n", filename);
268 SG_ERROR(
"Reading file %s failed.\n", filename);
272 SG_INFO(
"File %s successfully read.\n", filename);
275 if (base1!=-1 && base2!=-1)
280 for (int32_t i=0; i<h->
get_M(); i++)
340 if (strncmp(target,
"POS", 3)==0)
346 else if (strncmp(target,
"NEG", 3)==0)
352 else if (strncmp(target,
"TEST", 4)==0)
359 SG_ERROR(
"Target POS|NEG|TEST is missing.\n");
368 FILE* model_file=fopen(filename,
"r");
370 SG_ERROR(
"Opening file %s failed.\n", filename);
378 SG_INFO(
"Loaded HMM successfully from file %s.\n", filename);
394 FILE* file=fopen(filename,
"w");
403 if (!file || !result)
404 SG_ERROR(
"Writing to file %s failed!\n", filename);
406 SG_INFO(
"Successfully written model into %s!\n", filename);
420 FILE* def_file=fopen(filename,
"r");
422 SG_ERROR(
"Opening file %s failed\n", filename);
426 SG_INFO(
"Definitions successfully read from %s.\n", filename);
430 SG_ERROR(
"Couldn't load definitions form file %s.\n", filename);
443 FILE* file=fopen(filename,
"w");
454 if (!file || !result)
455 SG_ERROR(
"Writing to file %s failed!\n", filename);
457 SG_INFO(
"Successfully written likelihoods into %s!\n", filename);
471 FILE* file=fopen(filename,
"w");
479 ui_features->get_test_features();
486 if (!file || !result)
487 SG_ERROR(
"Writing to file %s failed!\n", filename);
489 SG_INFO(
"Successfully written path into %s!\n", filename);
565 SG_ERROR(
"Set pos and neg HMM first!\n");
571 if (pos_M!=neg_M || pos_N!=neg_N)
572 SG_ERROR(
"Pos and neg HMM's differ in number of emissions or states.\n");
580 for (int32_t i=0; i<pos_N; i++)
582 for (int32_t j=0; j<pos_M; j++)
609 for (int32_t i=0; i<n; i++)
611 for (int32_t j=0; j<m; j++)
628 SG_ERROR(
"Set observations first.\n");