SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GUIHMM.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 1999-2008 Soeren Sonnenburg
8  * Written (W) 1999-2008 Gunnar Raetsch
9  * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society
10  */
11 
12 #ifndef __GUIHMM__H
13 #define __GUIHMM__H
14 
15 #include <shogun/lib/config.h>
16 #include <shogun/base/SGObject.h>
18 #include <shogun/features/Labels.h>
19 
20 namespace shogun
21 {
22 class CSGInterface;
23 
25 class CGUIHMM : public CSGObject
26 {
27  public:
29  CGUIHMM() { };
33  CGUIHMM(CSGInterface* interface);
35  ~CGUIHMM();
36 
38  bool new_hmm(int32_t n, int32_t m);
40  bool load(char* filename);
42  bool save(char* filename, bool is_binary=false);
43 
47  bool set_num_hmm_tables(char* param) ;
49  bool baum_welch_train();
55  bool viterbi_train_defined();
57  bool viterbi_train();
61  bool linear_train(char align='l');
65  bool linear_train_from_file(char* param);
67  bool append_model(char* filename, int32_t base1=-1, int32_t base2=-1);
69  bool add_states(int32_t num_states=1, float64_t value=0);
71  bool set_hmm_as(char* target);
73  bool set_pseudo(float64_t pseudo);
76  int32_t num_iterations=100, float64_t epsilon=0.001);
78  bool output_hmm();
80  bool output_hmm_defined();
82  bool best_path(int32_t from=0, int32_t to=100);
86  bool normalize(bool keep_dead_states=false);
91  bool save_path(char* filename, bool is_binary=false);
93  bool save_likelihood(char* filename, bool is_binary=false);
98  bool load_definitions(char* filename, bool do_init=false);
102  bool set_max_dim(char* param);
104  bool likelihood();
106  bool chop(float64_t value);
111  bool relative_entropy(float64_t*& values, int32_t& len);
116  bool entropy(float64_t*& values, int32_t& len);
118  bool permutation_entropy(int32_t width=0, int32_t seq_num=-1);
120  inline CHMM* get_pos() { return pos; }
122  inline CHMM* get_neg() { return neg; }
124  inline CHMM* get_test() { return test; }
128  inline void set_current(CHMM* h) { working=h; }
130  inline CHMM* get_current() { return working; }
132  inline float64_t get_pseudo() { return PSEUDO; }
133 
137  CLabels* classify(CLabels* output=NULL);
141  float64_t classify_example(int32_t idx);
145  CLabels* one_class_classify(CLabels* output=NULL);
154 
156  inline virtual const char* get_name() const { return "GUIHMM"; }
157 
158  protected:
163  bool converge(float64_t x, float64_t y);
168  void switch_model(CHMM** m1, CHMM** m2);
169 
172 
179 
183  int32_t M;
184 
185  protected:
187  CSGInterface* ui;
188 };
189 }
190 #endif

SHOGUN Machine Learning Toolbox - Documentation