|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ailab.hmm.Model
Markov model with symbol-generation probabilities. The class Hmm is built on top of this class. Please refer to Rabiner 1989.
Constructor Summary | |
Model()
Construct Model with a minimum size (number of states: 1, number of symbols: 1). |
|
Model(boolean bRandomize)
Construct Model with a minimum size (number of states: 1, number of symbols: 1). |
|
Model(int nstates,
int nsymbols)
Construct Model by specifying dimensions. |
|
Model(int nstates,
int nsymbols,
boolean bRandomize)
Construct Model by specifying dimensions. |
|
Model(int nstates,
int nsymbols,
int llb,
int urb)
Construct Model by specifying dimensions. |
|
Model(int nstates,
int nsymbols,
int llb,
int urb,
boolean bRandomize)
Construct Model by specifying dimensions. |
|
Model(java.lang.String file)
Construct Model by loading model parameters from a file. |
Method Summary | |
double[][] |
getA()
|
double[] |
getA(int i)
|
double |
getA(int i,
int j)
|
double[][] |
getB()
|
double[] |
getB(int i)
|
double |
getB(int i,
int k)
|
int |
getLLimit(int i)
|
static int |
getMaxNumStates()
|
static int |
getMaxNumSymbols()
|
static double |
getMinProb()
|
int |
getNumStates()
|
int |
getNumSymbols()
|
double[] |
getPi()
|
double |
getPi(int j)
|
double |
getPi(int t,
int j)
|
int |
getRLimit(int i)
|
void |
loadModel(java.lang.String file)
Load model parameters from a file. |
static void |
main(java.lang.String[] args)
|
void |
saveModel(java.lang.String file)
Save model parameters to a given file. |
void |
setA()
Initialize the state-transition matrix A with random values. |
void |
setA(boolean bRandomize)
Initialize the state-transition matrix A. |
void |
setA(double[][] p)
|
boolean |
setA(double[][] p,
boolean bNormalize)
|
void |
setA(int i,
double[] p)
|
boolean |
setA(int i,
double[] p,
boolean bNormalize)
|
void |
setA(int i,
int j,
double p)
|
boolean |
setA(int i,
int j,
double p,
boolean bCheck)
|
void |
setB()
Initialize the symbol-generation matrix B with random values. |
void |
setB(boolean bRandomize)
Initialize the symbol-generation matrix B. |
void |
setB(double[][] p)
|
boolean |
setB(double[][] p,
boolean bNormalize)
|
void |
setB(int i,
double[] p)
|
boolean |
setB(int i,
double[] p,
boolean bNormalize)
|
void |
setB(int i,
int k,
double p)
|
boolean |
setB(int i,
int k,
double p,
boolean bCheck)
|
static double |
setMinProb(double p)
|
void |
setPi()
Initialize the initial-state row vector Pi with random values. |
void |
setPi(boolean bRandomize)
Initialize the initial-state row vector Pi. |
void |
setPi(double[] p)
|
boolean |
setPi(double[] p,
boolean bNormalize)
|
void |
setPi(int j,
double p)
|
boolean |
setPi(int j,
double p,
boolean bCheck)
|
void |
setProbability()
Intialize probability matrices, A, B, and Pi, with random values. |
void |
setProbability(boolean bRandomize)
Intialize probability matrices, A, B, and Pi. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Model()
public Model(boolean bRandomize)
bRandomize
- If true, the elements of the matrices are initialized by random valuespublic Model(int nstates, int nsymbols)
nstates
- Number of states of a Markov modelnsymbols
- Number of symbols generated by the modelpublic Model(int nstates, int nsymbols, boolean bRandomize)
nstates
- Number of states of a Markov modelnsymbols
- Number of symbols generated by the modelbRandomize
- If true, the elements of the matrices are initialized by random valuespublic Model(int nstates, int nsymbols, int llb, int urb)
nstates
- Number of states of a Markov modelnsymbols
- Number of symbols generated by the modelllb
- Lower-left bound of the non-zero band of the transition matrix (diagonal: 0)urb
- Upper-right bound of the non-zero band of the transition matrix (diagonal: 0)public Model(int nstates, int nsymbols, int llb, int urb, boolean bRandomize)
nstates
- Number of states of a Markov modelnsymbols
- Number of symbols generated by the modelllb
- Lower-left bound of the non-zero band of the transition matrix (diagonal: 0)urb
- Upper-right bound of the non-zero band of the transition matrix (diagonal: 0)bRandomize
- If true, the elements of the matrices are initialized by random valuespublic Model(java.lang.String file)
file
- Name of input fileMethod Detail |
public static int getMaxNumStates()
public static int getMaxNumSymbols()
public static double getMinProb()
public static double setMinProb(double p)
public int getNumStates()
public int getNumSymbols()
public int getLLimit(int i)
i
- Row number of the state-transition matrix Apublic int getRLimit(int i)
i
- Row number of the state-transition matrix Apublic void setA()
public void setA(boolean bRandomize)
bRandomize
- If true, initialize A with random valuespublic void setA(int i, int j, double p)
i
- Row number of the state-transition matrix Aj
- Column number of state-transition matrix Ap
- Probability valuepublic boolean setA(int i, int j, double p, boolean bCheck)
i
- Row number of the state-transition matrix Aj
- Column number of state-transition matrix Ap
- Probability valuebCheck
- If true, check the index bounds and the range of ppublic void setA(int i, double[] p)
i
- Row number of the state-transition matrix Ap
- Row vector of probability valuespublic boolean setA(int i, double[] p, boolean bNormalize)
i
- Row number of the state-transition matrix Ap
- Row vector of probability valuesbNormalize
- If true, renormalize the row in case p is not normalizedpublic void setA(double[][] p)
p
- Matrix of probability valuespublic boolean setA(double[][] p, boolean bNormalize)
p
- Matrix of probability valuesbNormalize
- If true, renormalize each row in case p is not normalizedpublic void setB()
public void setB(boolean bRandomize)
bRandomize
- If true, initialize B with random valuespublic void setB(int i, int k, double p)
i
- Row number of the symbol-generation matrix Bk
- Column number of symbol-generation matrix Bp
- Probability valuepublic boolean setB(int i, int k, double p, boolean bCheck)
i
- Row number of the symbol-generation matrix Bk
- Column number of symbol-generation matrix Bp
- Probability valuebCheck
- If true, check the index bounds and the range of ppublic void setB(int i, double[] p)
i
- Row number of the symbol-generation matrix Bp
- Row vector of probability valuespublic boolean setB(int i, double[] p, boolean bNormalize)
i
- Row number of the symbol-generation matrix Bp
- Row vector of probability valuesbNormalize
- If true, renormalize the row in case p is not normalizedpublic void setB(double[][] p)
p
- Matrix of probability valuespublic boolean setB(double[][] p, boolean bNormalize)
p
- Matrix of probability valuesbNormalize
- If true, renormalize each row in case p is not normalizedpublic void setPi()
public void setPi(boolean bRandomize)
bRandomize
- If true, initialize Pi with random valuespublic void setPi(int j, double p)
j
- Column number of initial-state row vector Pip
- Probability valuepublic boolean setPi(int j, double p, boolean bCheck)
j
- Column number of initial-state row vector Pip
- Probability valuebCheck
- If true, check the index bounds and the range of ppublic void setPi(double[] p)
public boolean setPi(double[] p, boolean bNormalize)
p
- Row vector of probability valuesbNormalize
- If true, renormalize Pi in case p is not normalizedpublic double getA(int i, int j)
i
- Row number of the state-transition matrix Aj
- Column number of state-transition matrix Apublic double[] getA(int i)
i
- Row number of the state-transition matrix Apublic double[][] getA()
public double getB(int i, int k)
i
- Row number of the symbol-generation matrix Bk
- Column number of symbol-generation matrix Bpublic double[] getB(int i)
i
- Row number of the symbol-generation matrix Bpublic double[][] getB()
public double getPi(int j)
j
- Column number of inital-state row vector Pipublic double[] getPi()
public double getPi(int t, int j)
t
- Index of observation sequencej
- Column number of state vector Pi[t][] at time tpublic void setProbability()
public void setProbability(boolean bRandomize)
bRandomize
- If true, initialize probability matrices with random valuespublic void loadModel(java.lang.String file)
file
- Name of input filepublic void saveModel(java.lang.String file)
file
- Name of output filepublic static void main(java.lang.String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |