164     void write(std::ostream & out) 
const;
 
Hidden Markov Model State class for the Hidden Markov Model.
Definition: HiddenMarkovModel.h:54
 
void deletePredecessorState(HMMState *state)
deletes the given predecessor state from the list
 
std::set< HMMState * > succ_states_
Definition: HiddenMarkovModel.h:122
 
void addPredecessorState(HMMState *state)
adds the given predecessor state to the list
 
HMMState & operator=(const HMMState &)
 
HMMState(const HMMState &state)
copy constructor
 
bool isHidden() const
returns true if the state is hidden
 
String name_
Definition: HiddenMarkovModel.h:116
 
void setName(const String &name)
sets the name of the state
 
const std::set< HMMState * > & getPredecessorStates() const
returns the predecessor states of the state
 
std::set< HMMState * > pre_states_
Definition: HiddenMarkovModel.h:119
 
HMMState()
default constructor
 
HMMState(const String &name, bool hidden=true)
constructor with name and visibility option
 
void addSuccessorState(HMMState *state)
add the given successor state to the list
 
const String & getName() const
returns the name of the state
 
const std::set< HMMState * > & getSuccessorStates() const
return the successor states of the state
 
void setHidden(bool hidden)
sets the hidden property to the state
 
bool hidden_
Definition: HiddenMarkovModel.h:113
 
void deleteSuccessorState(HMMState *state)
deletes the given successor state from the list
 
virtual ~HMMState()
destructor
 
Hidden Markov Model implementation of PILIS.
Definition: HiddenMarkovModel.h:134
 
void clearInitialTransitionProbabilities()
clears the initial probabilities
 
void setTransitionProbability(const String &s1, const String &s2, double prob)
sets the transition probability of the given state names to prob
 
void setTransitionProbability_(HMMState *s1, HMMState *s2, double prob)
sets the transition probability of the given states to prob
 
void enableTransition(const String &s1, const String &s2)
enables a transition; adds s1 to the predecessor list of s2 and s2 to the successor list of s1
 
void estimateUntrainedTransitions()
builds a synonyms structure, needed when synonyms are used
 
Map< HMMState *, Map< HMMState *, double > > count_trans_
Definition: HiddenMarkovModel.h:280
 
HiddenMarkovModel & operator=(const HiddenMarkovModel &)
assignment operator
 
StringList var_modifications_
Definition: HiddenMarkovModel.h:326
 
void disableTransitions()
disables all transitions
 
void addNewState(HMMState *state)
registers a new state to the HMM
 
void clearTrainingEmissionProbabilities()
clear the emission probabilities
 
void setPseudoCounts(double pseudo_counts)
sets the pseudo count that are added instead of zero
 
void disableTransition(const String &s1, const String &s2)
disables the transition; deletes the nodes from the predecessor/successor list respectively
 
std::set< std::pair< HMMState *, HMMState * > > trained_trans_
Definition: HiddenMarkovModel.h:309
 
void disableTransition_(HMMState *s1, HMMState *s2)
disables the transition; deletes the nodes from the predecessor/successor list respectively
 
void train()
trains the HMM; initial probabilities and emission probabilities of the emitting states should be set
 
virtual ~HiddenMarkovModel()
destructor
 
Map< HMMState *, Map< HMMState *, double > > trans_
Definition: HiddenMarkovModel.h:277
 
void evaluate()
evaluate the HMM, estimates the transition probabilities from the training
 
Map< HMMState *, double > train_emission_prob_
Definition: HiddenMarkovModel.h:300
 
double getBackwardVariable_(HMMState *)
returns the backward variable
 
void write(std::ostream &out) const
writes the HMM into an outstream
 
Map< HMMState *, Map< HMMState *, std::pair< HMMState *, HMMState * > > > synonym_trans_
Definition: HiddenMarkovModel.h:315
 
void addNewState(const String &name)
registers a new state to the HMM
 
Map< HMMState *, Map< HMMState *, std::vector< double > > > train_count_trans_all_
Definition: HiddenMarkovModel.h:285
 
void copy_(const HiddenMarkovModel &source)
 
double getTransitionProbability(const String &s1, const String &s2) const
returns the transition probability of the given state names
 
Map< HMMState *, double > backward_
Definition: HiddenMarkovModel.h:294
 
void calculateForwardPart_()
performs the forward algorithm
 
double getPseudoCounts() const
returns the pseudo counts
 
Map< String, HMMState * > name_to_state_
Definition: HiddenMarkovModel.h:297
 
void enableTransition_(HMMState *s1, HMMState *s2)
enables a transition; adds s1 to the predecessor list of s2 and s2 to the successor list of s1
 
HiddenMarkovModel(const HiddenMarkovModel &hmm_new)
copy constructor
 
const HMMState * getState(const String &name) const
returns the state with the given name
 
double pseudo_counts_
Definition: HiddenMarkovModel.h:321
 
void setInitialTransitionProbability(const String &state, double prob)
sets the initial transition probability of the given state to prob
 
HMMState * getState(const String &name)
returns the state with the given name
 
Map< String, Map< String, std::pair< String, String > > > synonym_trans_names_
Definition: HiddenMarkovModel.h:312
 
HiddenMarkovModel()
default constructor
 
Map< HMMState *, Map< HMMState *, Size > > training_steps_count_
Definition: HiddenMarkovModel.h:288
 
double getTransitionProbability_(HMMState *s1, HMMState *s2) const
returns the transition probability of the given states
 
std::set< HMMState * > states_
Definition: HiddenMarkovModel.h:306
 
Map< HMMState *, Map< HMMState *, std::vector< double > > > count_trans_all_
Definition: HiddenMarkovModel.h:282
 
void clear()
clears all data
 
void addSynonymTransition(const String &name1, const String &name2, const String &synonym1, const String &synonym2)
add a new synonym transition to the given state names
 
void dump()
writes some stats to cerr
 
void forwardDump()
writes some info of the forward "matrix" to cerr
 
Map< HMMState *, std::set< HMMState * > > enabled_trans_
Definition: HiddenMarkovModel.h:318
 
Map< HMMState *, double > init_prob_
Definition: HiddenMarkovModel.h:303
 
void calculateBackwardPart_()
performs the backward algorithm
 
double getForwardVariable_(HMMState *)
returns the forward variable
 
void calculateEmissionProbabilities(Map< HMMState *, double > &emission_probs)
calculates the emission probabilities of the HMM (of course only of the non-hidden states)
 
void writeGraphMLFile(const String &filename)
writes the HMM into a file in GraphML format
 
Size getNumberOfStates() const
return the number of states
 
Map< HMMState *, double > forward_
Definition: HiddenMarkovModel.h:291
 
void setTrainingEmissionProbability(const String &state, double prob)
sets the emission probability of the given state to prob
 
void setTrainingEmissionProbability_(HMMState *state, double prob)
sets the emission probability of the given state to prob
 
void setVariableModifications(const StringList &modifications)
 
Map class based on the STL map (containing several convenience functions)
Definition: Map.h:52
 
A more convenient string class.
Definition: String.h:61
 
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
 
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
 
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47