ToPS
HiddenMarkovModelCreator.hpp
00001 /*
00002  *       HiddenMarkovModelCreator.hpp
00003  *
00004  *       Copyright 2011 Andre Yoshiaki Kashiwabara <akashiwabara@usp.br>
00005  *                      Ígor Bonádio <ibonadio@ime.usp.br>
00006  *                      Vitor Onuchic <vitoronuchic@gmail.com>
00007  *                      Alan Mitchell Durham <aland@usp.br>
00008  *
00009  *       This program is free software; you can redistribute it and/or modify
00010  *       it under the terms of the GNU  General Public License as published by
00011  *       the Free Software Foundation; either version 3 of the License, or
00012  *       (at your option) any later version.
00013  *
00014  *       This program is distributed in the hope that it will be useful,
00015  *       but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  *       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  *       GNU General Public License for more details.
00018  *
00019  *       You should have received a copy of the GNU General Public License
00020  *       along with this program; if not, write to the Free Software
00021  *       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00022  *       MA 02110-1301, USA.
00023  */
00024 
00025 #ifndef HIDDEN_MARKOV_MODEL_CREATOR_HPP
00026 #define HIDDEN_MARKOV_MODEL_CREATOR_HPP
00027 
00028 #include "crossplatform.hpp"
00029 
00030 #include "ProbabilisticModelCreator.hpp"
00031 #include "ProbabilisticModel.hpp"
00032 #include <boost/shared_ptr.hpp>
00033 
00034 namespace tops {
00036   class DLLEXPORT HiddenMarkovModelCreator : public ProbabilisticModelCreator
00037   {
00038   public:
00039     HiddenMarkovModelCreator() {}
00040     virtual ~HiddenMarkovModelCreator(){};
00041     virtual ProbabilisticModelPtr create(ProbabilisticModelParameters & parameters) const ;
00042 
00043     virtual std::string help() const
00044     {
00045       std::stringstream out;
00046       out << "\nUSAGE: " << std::endl;
00047       out << "Mandatory parameters: " << std::endl;
00048       out << "\tstate_names" << std::endl;
00049       out << "\tobservation_symbols" << std::endl;
00050       out << "\tinitial_probabilities" << std::endl;
00051       out << "\ttransitions" << std::endl;
00052       out << "\temission_probabilities" << std::endl;
00053       out << "Example: " << std::endl;
00054       out << "\tmodel_name = \"HiddenMarkovModel\"" << std::endl;
00055       out << "\tstate_names = (\"F\",\"L\")" << std::endl;
00056       out << "\tobservation_symbols = (\"1\",\"2\",\"3\",\"4\",\"5\",\"6\")" << std::endl;
00057       out << "\ttransitions = (\"F\" | \"F\": 0.7;" << std::endl;
00058       out << "\t \"L\" | \"F\": 0.3;" << std::endl;
00059       out << "\t \"F\" | \"L\": 0.3;" << std::endl;
00060       out << "\t \"L\" | \"L\": 0.7)" << std::endl;
00061       out << "\temissions = (\"1\" | \"F\": 0.166667;" << std::endl;
00062       out << "\t             \"2\" | \"F\": 0.166667;" << std::endl;
00063       out << "\t             \"3\" | \"F\": 0.166667;" << std::endl;
00064       out << "\t             \"4\" | \"F\": 0.166667;" << std::endl;
00065       out << "\t             \"5\" | \"F\": 0.166667;" << std::endl;
00066       out << "\t             \"6\" | \"F\": 0.166667;" << std::endl;
00067       out << "\t             \"1\" | \"L\": 0.5;" << std::endl;
00068       out << "\t             \"2\" | \"L\": 0.1;" << std::endl;
00069       out << "\t             \"3\" | \"L\": 0.1;" << std::endl;
00070       out << "\t             \"4\" | \"L\": 0.1;" << std::endl;
00071       out << "\t             \"5\" | \"L\": 0.1;" << std::endl;
00072       out << "\t             \"6\" | \"L\": 0.1)" << std::endl;
00073       out << "\tinitial_probabilities = (\"F\":  0.5;" << std::endl;
00074       out << "\t \"L\": 0.5)" << std::endl;
00075       return out.str();
00076     }
00077 
00078 
00079   };
00080   typedef boost::shared_ptr < HiddenMarkovModelCreator> HiddenMarkovModelCreatorPtr;
00081 }
00082 
00083 #endif