GUIHMM.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 1999-2008 Soeren Sonnenburg
00008  * Written (W) 1999-2008 Gunnar Raetsch
00009  * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society
00010  */
00011 
00012 #ifndef __GUIHMM__H
00013 #define __GUIHMM__H
00014 
00015 #include <shogun/lib/config.h>
00016 #include <shogun/base/SGObject.h>
00017 #include <shogun/distributions/HMM.h>
00018 #include <shogun/labels/Labels.h>
00019 #include <shogun/labels/RegressionLabels.h>
00020 
00021 namespace shogun
00022 {
00023 class CSGInterface;
00024 
00026 class CGUIHMM : public CSGObject
00027 {
00028     public:
00030         CGUIHMM() { };
00034         CGUIHMM(CSGInterface* interface);
00036         ~CGUIHMM();
00037 
00039         bool new_hmm(int32_t n, int32_t m);
00041         bool load(char* filename);
00043         bool save(char* filename, bool is_binary=false);
00044 
00048         bool set_num_hmm_tables(char* param) ;
00050         bool baum_welch_train();
00052         bool baum_welch_trans_train();
00054         bool baum_welch_train_defined();
00056         bool viterbi_train_defined();
00058         bool viterbi_train();
00062         bool linear_train(char align='l');
00066         bool linear_train_from_file(char* param);
00068         bool append_model(char* filename, int32_t base1=-1, int32_t base2=-1);
00070         bool add_states(int32_t num_states=1, float64_t value=0);
00072         bool set_hmm_as(char* target);
00074         bool set_pseudo(float64_t pseudo);
00076         bool convergence_criteria(
00077             int32_t num_iterations=100, float64_t epsilon=0.001);
00079         bool output_hmm();
00081         bool output_hmm_defined();
00083         bool best_path(int32_t from=0, int32_t to=100);
00087         bool normalize(bool keep_dead_states=false);
00092         bool save_path(char* filename, bool is_binary=false);
00094         bool save_likelihood(char* filename, bool is_binary=false);
00099         bool load_definitions(char* filename, bool do_init=false);
00103         bool set_max_dim(char* param);
00105         bool likelihood();
00107         bool chop(float64_t value);
00112         bool relative_entropy(float64_t*& values, int32_t& len);
00117         bool entropy(float64_t*& values, int32_t& len);
00119         bool permutation_entropy(int32_t width=0, int32_t seq_num=-1);
00121         inline CHMM* get_pos() { return pos; }
00123         inline CHMM* get_neg() { return neg; }
00125         inline CHMM* get_test() { return test; }
00129         inline void set_current(CHMM* h) { working=h; }
00131         inline CHMM* get_current() { return working; }
00133         inline float64_t get_pseudo() { return PSEUDO; }
00134 
00138         CRegressionLabels* classify(CRegressionLabels* output=NULL);
00142         float64_t classify_example(int32_t idx);
00146         CRegressionLabels* one_class_classify(CRegressionLabels* output=NULL);
00150         CRegressionLabels* linear_one_class_classify(CRegressionLabels* output=NULL);
00154         float64_t one_class_classify_example(int32_t idx);
00155 
00157         virtual const char* get_name() const { return "GUIHMM"; }
00158 
00159     protected:
00164         bool converge(float64_t x, float64_t y);
00169         void switch_model(CHMM** m1, CHMM** m2);
00170 
00172         CHMM* working;
00173 
00175         CHMM* pos;
00177         CHMM* neg;
00179         CHMM* test;
00180 
00182         float64_t PSEUDO;
00184         int32_t M;
00185 
00186     protected:
00188         CSGInterface* ui;
00189 };
00190 }
00191 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation