public class ParsimoniousElement
extends java.lang.Object
implements java.lang.Cloneable, de.jstacs.Storable
Modifier and Type | Class and Description |
---|---|
static class |
ParsimoniousElement.LearningMethod |
static class |
ParsimoniousElement.ModelType |
static class |
ParsimoniousElement.ParameterEstimate |
static class |
ParsimoniousElement.StructureScore |
Modifier and Type | Field and Description |
---|---|
protected de.jstacs.data.DataSet |
data
the data set used for training
|
ParsimoniousElement.ModelType |
mt |
de.jstacs.sequenceScores.statisticalModels.trainable.variableStructure.parsimonious.dataStructures.ParsimoniousElement.ContextTreeNode |
root
the root of the context tree
|
Constructor and Description |
---|
ParsimoniousElement(de.jstacs.data.AlphabetContainer con,
byte maximalDepth,
double ESS,
double treePriorConstant)
Main constructor
|
ParsimoniousElement(java.lang.StringBuffer xml)
Loading a ParsimoniousElement (with or without drawn parameters) from a StringBuffer.
|
Modifier and Type | Method and Description |
---|---|
void |
addSequenceToMarkovCounts(de.jstacs.data.sequences.Sequence seq)
Computes Markov counts (e.g. conditional nucleotide frequencies) from data
|
ParsimoniousElement |
clone() |
java.lang.String |
getGraphviz()
returns the graphViz representation of this context tree
|
double |
getLogProbFor(de.jstacs.data.sequences.Sequence seq,
int position) |
double |
getLogProbForCurrentMarkovCounts()
Computes the probability of data (represented by Markov counts) given the context tree
|
byte |
getMaximalDepth() |
int |
getNumberOfLeaves() |
double |
getScore() |
java.lang.String |
getSparseParameterRepresentation() |
java.lang.String |
getTreeStructure()
A node is represented by its label, surrounded by [ ] brackets, followed by the representation of all children in ( ) brackets.
|
void |
loadParametersFromSparseRepresentation(java.lang.String str) |
void |
maximizeStructureAndParameters(de.jstacs.data.DataSet data,
double[] weights,
ParsimoniousElement.StructureScore structureScore,
ParsimoniousElement.ParameterEstimate parameterEstimate) |
void |
printMarkovCounts() |
void |
removeSequenceFromMarkovCounts(de.jstacs.data.sequences.Sequence seq) |
double |
sampleStructure(de.jstacs.data.DataSet data,
double[] weights) |
double |
sampleStructureAndParameters(de.jstacs.data.DataSet data,
double[] weights)
Samples a new context tree structure and corresponding probability parameters given (weighted) input data
|
void |
setElementNumber(int n) |
java.lang.StringBuffer |
toXML() |
public de.jstacs.sequenceScores.statisticalModels.trainable.variableStructure.parsimonious.dataStructures.ParsimoniousElement.ContextTreeNode root
protected de.jstacs.data.DataSet data
public ParsimoniousElement.ModelType mt
public ParsimoniousElement(de.jstacs.data.AlphabetContainer con, byte maximalDepth, double ESS, double treePriorConstant) throws java.lang.Exception
con
- The alphabet containermaximalDepth
- The maximal depth of the context treeESS
- the equivalent sample sizetreePriorConstant
- the constant of the structure priorjava.lang.Exception
- if something went wrongpublic ParsimoniousElement(java.lang.StringBuffer xml) throws java.lang.Exception
xml
- the XML-representationjava.lang.Exception
- if something went wrongpublic double getScore()
public ParsimoniousElement clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public void setElementNumber(int n)
public double sampleStructureAndParameters(de.jstacs.data.DataSet data, double[] weights) throws java.lang.Exception
data
- weights
- contextPositions
- java.lang.Exception
public double sampleStructure(de.jstacs.data.DataSet data, double[] weights) throws java.lang.Exception
java.lang.Exception
public void maximizeStructureAndParameters(de.jstacs.data.DataSet data, double[] weights, ParsimoniousElement.StructureScore structureScore, ParsimoniousElement.ParameterEstimate parameterEstimate) throws java.lang.Exception
java.lang.Exception
public void addSequenceToMarkovCounts(de.jstacs.data.sequences.Sequence seq)
data
- weights
- de.jstacs.data.WrongAlphabetException
de.jstacs.data.WrongLengthException
public void removeSequenceFromMarkovCounts(de.jstacs.data.sequences.Sequence seq)
public double getLogProbForCurrentMarkovCounts()
counts
- public int getNumberOfLeaves()
public double getLogProbFor(de.jstacs.data.sequences.Sequence seq, int position) throws de.jstacs.NotTrainedException
seq
- An arbitrary discrete sequenceposition
- the position of the symbol whose probability is to be computedde.jstacs.NotTrainedException
public java.lang.String getTreeStructure()
public java.lang.String getSparseParameterRepresentation()
public java.lang.String getGraphviz()
public void loadParametersFromSparseRepresentation(java.lang.String str)
str
- sparse parameter representationpublic java.lang.StringBuffer toXML()
toXML
in interface de.jstacs.Storable
public byte getMaximalDepth()
public void printMarkovCounts()