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
float64_t one_class_classify_example(int32_t idx)
Definition: GUIHMM.cpp:234
CHMM * get_pos()
Definition: GUIHMM.h:120
CLabels * linear_one_class_classify(CLabels *output=NULL)
Definition: GUIHMM.cpp:211
CLabels * classify(CLabels *output=NULL)
Definition: GUIHMM.cpp:147
bool likelihood()
Definition: GUIHMM.cpp:506
CSGInterface * interface
Definition: SGInterface.cpp:41
float64_t PSEUDO
Definition: GUIHMM.h:181
The class Labels models labels, i.e. class assignments of objects.
Definition: Labels.h:35
virtual const char * get_name() const
Definition: GUIHMM.h:156
bool linear_train(char align='l')
Definition: GUIHMM.cpp:119
CHMM * working
Definition: GUIHMM.h:171
bool permutation_entropy(int32_t width=0, int32_t seq_num=-1)
Definition: GUIHMM.cpp:622
UI HMM (Hidden Markov Model)
Definition: GUIHMM.h:25
bool append_model(char *filename, int32_t base1=-1, int32_t base2=-1)
Definition: GUIHMM.cpp:252
CHMM * pos
Definition: GUIHMM.h:174
bool viterbi_train_defined()
Definition: GUIHMM.cpp:109
bool converge(float64_t x, float64_t y)
bool baum_welch_train_defined()
Definition: GUIHMM.cpp:89
bool set_max_dim(char *param)
bool viterbi_train()
Definition: GUIHMM.cpp:99
bool entropy(float64_t *&values, int32_t &len)
Definition: GUIHMM.cpp:597
float64_t get_pseudo()
Definition: GUIHMM.h:132
bool set_hmm_as(char *target)
Definition: GUIHMM.cpp:335
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:76
CHMM * neg
Definition: GUIHMM.h:176
bool baum_welch_train()
Definition: GUIHMM.cpp:50
double float64_t
Definition: common.h:56
bool convergence_criteria(int32_t num_iterations=100, float64_t epsilon=0.001)
Definition: GUIHMM.cpp:323
bool save_likelihood(char *filename, bool is_binary=false)
Definition: GUIHMM.cpp:436
void switch_model(CHMM **m1, CHMM **m2)
float64_t classify_example(int32_t idx)
Definition: GUIHMM.cpp:171
bool relative_entropy(float64_t *&values, int32_t &len)
Definition: GUIHMM.cpp:562
CHMM * get_test()
Definition: GUIHMM.h:124
bool add_states(int32_t num_states=1, float64_t value=0)
Definition: GUIHMM.cpp:306
CHMM * get_current()
Definition: GUIHMM.h:130
bool new_hmm(int32_t n, int32_t m)
Definition: GUIHMM.cpp:42
int32_t M
Definition: GUIHMM.h:183
bool load_definitions(char *filename, bool do_init=false)
Definition: GUIHMM.cpp:414
bool set_num_hmm_tables(char *param)
bool linear_train_from_file(char *param)
bool load(char *filename)
Definition: GUIHMM.cpp:364
CHMM * get_neg()
Definition: GUIHMM.h:122
CSGInterface * ui
Definition: GUIHMM.h:187
bool baum_welch_trans_train()
Definition: GUIHMM.cpp:71
CLabels * one_class_classify(CLabels *output=NULL)
Definition: GUIHMM.cpp:189
void set_current(CHMM *h)
Definition: GUIHMM.h:128
bool normalize(bool keep_dead_states=false)
Definition: GUIHMM.cpp:553
bool output_hmm()
Definition: GUIHMM.cpp:515
CHMM * test
Definition: GUIHMM.h:178
bool chop(float64_t value)
Definition: GUIHMM.cpp:497
bool save(char *filename, bool is_binary=false)
Definition: GUIHMM.cpp:387
bool output_hmm_defined()
Definition: GUIHMM.cpp:524
bool save_path(char *filename, bool is_binary=false)
Definition: GUIHMM.cpp:465
bool set_pseudo(float64_t pseudo)
Definition: GUIHMM.cpp:316
Hidden Markov Model.
Definition: HMM.h:371
bool best_path(int32_t from=0, int32_t to=100)
Definition: GUIHMM.cpp:533

SHOGUN Machine Learning Toolbox - Documentation