SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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/labels/Labels.h>
20 
21 namespace shogun
22 {
23 class CSGInterface;
24 
26 class CGUIHMM : public CSGObject
27 {
28  public:
30  CGUIHMM() { };
34  CGUIHMM(CSGInterface* interface);
36  ~CGUIHMM();
37 
39  bool new_hmm(int32_t n, int32_t m);
41  bool load(char* filename);
43  bool save(char* filename, bool is_binary=false);
44 
48  bool set_num_hmm_tables(char* param) ;
50  bool baum_welch_train();
56  bool viterbi_train_defined();
58  bool viterbi_train();
62  bool linear_train(char align='l');
66  bool linear_train_from_file(char* param);
68  bool append_model(char* filename, int32_t base1=-1, int32_t base2=-1);
70  bool add_states(int32_t num_states=1, float64_t value=0);
72  bool set_hmm_as(char* target);
74  bool set_pseudo(float64_t pseudo);
77  int32_t num_iterations=100, float64_t epsilon=0.001);
79  bool output_hmm();
81  bool output_hmm_defined();
83  bool best_path(int32_t from=0, int32_t to=100);
87  bool normalize(bool keep_dead_states=false);
92  bool save_path(char* filename, bool is_binary=false);
94  bool save_likelihood(char* filename, bool is_binary=false);
99  bool load_definitions(char* filename, bool do_init=false);
103  bool set_max_dim(char* param);
105  bool likelihood();
107  bool chop(float64_t value);
112  bool relative_entropy(float64_t*& values, int32_t& len);
117  bool entropy(float64_t*& values, int32_t& len);
119  bool permutation_entropy(int32_t width=0, int32_t seq_num=-1);
121  inline CHMM* get_pos() { return pos; }
123  inline CHMM* get_neg() { return neg; }
125  inline CHMM* get_test() { return test; }
129  inline void set_current(CHMM* h) { working=h; }
131  inline CHMM* get_current() { return working; }
133  inline float64_t get_pseudo() { return PSEUDO; }
134 
142  float64_t classify_example(int32_t idx);
155 
157  virtual const char* get_name() const { return "GUIHMM"; }
158 
159  protected:
164  bool converge(float64_t x, float64_t y);
169  void switch_model(CHMM** m1, CHMM** m2);
170 
173 
180 
184  int32_t M;
185 
186  protected:
188  CSGInterface* ui;
189 };
190 }
191 #endif

SHOGUN Machine Learning Toolbox - Documentation