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")
float64_t one_class_classify_example(int32_t idx)
void chop(float64_t value)
set any model parameter with probability smaller than value to ZERO
bool save_likelihood(FILE *file)
Real Labels are real-valued labels.
int32_t get_M() const
access function for number of observations M
bool save_model(FILE *file)
void set_observations(CStringFeatures< uint16_t > *obs, CHMM *hmm=NULL)
bool linear_train(char align='l')
floatmax_t get_max_num_symbols()
bool permutation_entropy(int32_t width=0, int32_t seq_num=-1)
bool append_model(char *filename, int32_t base1=-1, int32_t base2=-1)
viterbi only for defined transitions/observations
virtual int32_t get_num_vectors() const
baum welch only for defined transitions/observations
bool viterbi_train_defined()
bool linear_train(bool right_align=false)
estimates linear model from observations.
bool save_model_bin(FILE *file)
static float64_t relative_entropy(float64_t *p, float64_t *q, int32_t len)
float64_t get_b(T_STATES line_, uint16_t column) const
bool baum_welch_viterbi_train(BaumWelchViterbiType type)
floatmax_t get_original_num_symbols()
bool baum_welch_train_defined()
bool set_label(int32_t idx, float64_t label)
uint16_t get_best_path_state(int32_t dim, int32_t t)
CStringFeatures< uint16_t > * get_observations()
return observation pointer
bool entropy(float64_t *&values, int32_t &len)
static const float64_t epsilon
float64_t model_probability(int32_t dimension=-1)
inline proxy for model probability.
bool set_hmm_as(char *target)
floatmax_t get_num_symbols()
Class SGObject is the base class of all shogun objects.
static float64_t entropy(float64_t *p, int32_t len)
bool permutation_entropy(int32_t window_width, int32_t sequence_number)
compute permutation entropy
void add_states(int32_t num_states, float64_t default_val=0)
bool convergence_criteria(int32_t num_iterations=100, float64_t epsilon=0.001)
bool save_likelihood(char *filename, bool is_binary=false)
virtual EFeatureClass get_feature_class() const =0
float64_t classify_example(int32_t idx)
bool relative_entropy(float64_t *&values, int32_t &len)
float64_t best_path(int32_t dimension)
CRegressionLabels * linear_one_class_classify(CRegressionLabels *output=NULL)
bool set_epsilon(float64_t eps)
bool append_model(CHMM *append_model, float64_t *cur_out, float64_t *app_out)
CRegressionLabels * one_class_classify(CRegressionLabels *output=NULL)
bool load_definitions(FILE *file, bool verbose, bool initialize=true)
bool set_iterations(int32_t num)
bool add_states(int32_t num_states=1, float64_t value=0)
float64_t linear_model_probability(int32_t dimension)
baum welch only for specified transitions
all of classes and functions are contained in the shogun namespace
bool new_hmm(int32_t n, int32_t m)
bool load_definitions(char *filename, bool do_init=false)
The class Features is the base class of all feature objects.
bool load(char *filename)
bool baum_welch_trans_train()
CRegressionLabels * classify(CRegressionLabels *output=NULL)
bool normalize(bool keep_dead_states=false)
bool chop(float64_t value)
void output_model_defined(bool verbose=false)
performs output_model only for the defined transitions etc
bool save(char *filename, bool is_binary=false)
void output_model(bool verbose=false)
bool output_hmm_defined()
bool save_path(char *filename, bool is_binary=false)
void normalize(bool keep_dead_states=false)
normalize the model to satisfy stochasticity
bool set_pseudo(float64_t pseudo)
T_STATES get_N() const
access function for number of states N
bool best_path(int32_t from=0, int32_t to=100)
virtual EFeatureType get_feature_type() const =0
bool save_path(FILE *file)
virtual int32_t get_vector_length(int32_t vec_num)