StochHMM
v0.34
Flexible Hidden Markov Model C++ Library and Application
|
weight class contains scaling factors for external scores More...
#include <weight.h>
Public Member Functions | |
weight () | |
~weight () | |
bool | isAbsolute () |
double | getAbsolute () |
std::string & | getName () |
double | getWeightedScore (double) |
size_t | size () |
Given a score (x) it will map the score to F(x) | |
void | print () |
std::string | stringify () |
void | setAbsolute (double val) |
void | setWeights (std::vector< double > &, std::vector< double > &, std::pair< double, double > *, std::pair< double, double > *) |
void | setWeights (std::vector< double > &, std::vector< double > &) |
void | setMaxWeight (double &, double &) |
void | setMinWeight (double &, double &) |
void | setName (std::string &nm) |
bool | parse (const std::string &) |
Parse weight from string. |
Private Attributes | |
bool | absolute |
double | absoluteValue |
Stores whether Weight is a constant value. | |
std::string | name |
Stores the constant value. | |
std::pair< double, double > * | maxValue |
std::pair< double, double > * | minValue |
Stores the MAX value of x and the corresponding F(x) | |
std::vector< std::pair< double, double > > * | vals |
Stores the MIN value of x and the corresponding F(x) |
weight class contains scaling factors for external scores
weight class contains either an *1. Absolute scaling value: meaning the returned value multiplied by constant *2. Score Mapping: x and y values describing the transformation from x=returned score to y the scaled score. If the returned value isn't equal to a specific y the score is interpolated or extrapolated. If the return score x<MIN then="" y="scaled" min="" if="" the="" return="" score="" x>="">MAX then y=scaled MAX Scores provided to weight should be log(Prob) It will return a log(Prob) scaled score
StochHMM::weight::weight | ( | ) |
Definition at line 32 of file weight.cpp.
References absolute, absoluteValue, maxValue, minValue, and vals.
StochHMM::weight::~weight | ( | ) |
|
inline |
Definition at line 69 of file weight.h.
References absoluteValue.
Referenced by StochHMM::transitionFuncParam::stringify(), and StochHMM::emissionFuncParam::stringify().
|
inline |
Definition at line 71 of file weight.h.
References name.
Referenced by StochHMM::weights::addWeight(), StochHMM::transitionFuncParam::stringify(), and StochHMM::emissionFuncParam::stringify().
double StochHMM::weight::getWeightedScore | ( | double | score | ) |
Returns F(x) given some score x
score | The value returned by some function |
Definition at line 127 of file weight.cpp.
References absolute, absoluteValue, StochHMM::compXval(), StochHMM::extrapolate(), StochHMM::interpolate(), maxValue, minValue, and vals.
Referenced by StochHMM::emissionFuncParam::evaluate().
|
inline |
Checks to see if weight is defined as a constant
Definition at line 67 of file weight.h.
References absolute.
Referenced by StochHMM::transitionFuncParam::stringify(), and StochHMM::emissionFuncParam::stringify().
bool StochHMM::weight::parse | ( | const std::string & | txt | ) |
Parse weight from string.
Definition at line 201 of file weight.cpp.
References StochHMM::clear_whitespace(), StochHMM::max(), StochHMM::min(), name, StochHMM::stringList::push_back(), setAbsolute(), setMaxWeight(), setMinWeight(), setWeights(), StochHMM::stringList::size(), StochHMM::stringList::splitString(), and StochHMM::stringToDouble().
Referenced by StochHMM::model::_parseScaling().
|
inline |
Prints out the weight type to text. Includes the x and F(x) vectors and MIN and MAX
Definition at line 89 of file weight.h.
References stringify().
|
inline |
Sets the scaling factor to a constant value
val | double that is returned x->Constant |
Definition at line 103 of file weight.h.
References absolute, and absoluteValue.
Referenced by StochHMM::transitionFuncParam::parse(), StochHMM::emissionFuncParam::parse(), and parse().
void StochHMM::weight::setMaxWeight | ( | double & | x, |
double & | y | ||
) |
Sets the MAX value for x to MAX F(MAX(x));
x | The MAX x value to allow |
y | The value to return for x>=MAX |
Definition at line 50 of file weight.cpp.
References maxValue.
Referenced by parse().
void StochHMM::weight::setMinWeight | ( | double & | x, |
double & | y | ||
) |
Sets the MIN value for x to F(MIN(x))
x | The MIN x value to allow |
y | The value to return for x<=MIN |
Definition at line 65 of file weight.cpp.
References minValue.
Referenced by parse().
|
inline |
void StochHMM::weight::setWeights | ( | std::vector< double > & | xVals, |
std::vector< double > & | yVals, | ||
std::pair< double, double > * | xMin, | ||
std::pair< double, double > * | xMax | ||
) |
Setup the score mapping from x->F(x) 2 vectors of equal length
xVals | vector of doubles that contains the scores for x |
yVals | vector of doubles that contains the corresponding scores F(x) |
xMIN | pair of doubles defines MIN x->F(x) |
xMAX | pair of doubles defines MAX x->F(x) |
Definition at line 96 of file weight.cpp.
References vals.
Referenced by parse(), and setWeights().
void StochHMM::weight::setWeights | ( | std::vector< double > & | xVals, |
std::vector< double > & | yVals | ||
) |
Setup the score mapping from x->F(x) 2 vectors of equal length
xVals | vector of doubles that contains the scores for x |
yVals | vector of doubles that contains the corresponding scores F(x) |
Definition at line 80 of file weight.cpp.
References maxValue, minValue, and setWeights().
|
inline |
std::string StochHMM::weight::stringify | ( | ) |
Converts weights to string
Definition at line 166 of file weight.cpp.
References StochHMM::double_to_string(), maxValue, minValue, and vals.
Referenced by print().
|
private |
Definition at line 146 of file weight.h.
Referenced by getWeightedScore(), isAbsolute(), setAbsolute(), and weight().
|
private |
Stores whether Weight is a constant value.
Definition at line 147 of file weight.h.
Referenced by getAbsolute(), getWeightedScore(), setAbsolute(), and weight().
|
private |
Definition at line 150 of file weight.h.
Referenced by getWeightedScore(), setMaxWeight(), setWeights(), stringify(), weight(), and ~weight().
|
private |
Stores the MAX value of x and the corresponding F(x)
Definition at line 151 of file weight.h.
Referenced by getWeightedScore(), setMinWeight(), setWeights(), stringify(), weight(), and ~weight().
|
private |
|
private |
Stores the MIN value of x and the corresponding F(x)
Definition at line 153 of file weight.h.
Referenced by getWeightedScore(), setWeights(), size(), stringify(), weight(), and ~weight().