|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.models.AbstractModel
de.jstacs.models.discrete.DiscreteGraphicalModel
de.jstacs.models.discrete.inhomogeneous.InhomogeneousDGM
de.jstacs.models.discrete.inhomogeneous.DAGModel
de.jstacs.models.discrete.inhomogeneous.FSDAGModel
public class FSDAGModel
This class can be used for any discrete fixed structure DAG model (FSDAGModel).
Field Summary |
---|
Fields inherited from class de.jstacs.models.discrete.inhomogeneous.DAGModel |
---|
constraints |
Fields inherited from class de.jstacs.models.discrete.inhomogeneous.InhomogeneousDGM |
---|
DEFAULT_STREAM, sostream |
Fields inherited from class de.jstacs.models.discrete.DiscreteGraphicalModel |
---|
params, trained |
Fields inherited from class de.jstacs.models.AbstractModel |
---|
alphabets, length |
Constructor Summary | |
---|---|
FSDAGModel(FSDAGMParameterSet params)
This is the main constructor. |
|
FSDAGModel(StringBuffer xml)
This is the constructor for Storable . |
Method Summary | |
---|---|
void |
drawParameters(Sample data,
double[] weights,
int[][] graph)
This method draws the parameters of the model from the a posteriori density. |
String |
getInstanceName()
Should return a short instance name such as iMM(0), BN(2), ... |
byte |
getMaximalMarkovOrder()
This method returns the maximal used markov order if possible. |
String |
getStructure()
Returns a string representation of the graph. |
protected String |
getXMLTag()
|
protected void |
set(DGMParameterSet params,
boolean trained)
Sets the parameters as internal parameters and does some essential computations. |
static void |
train(Model[] models,
int[][] graph,
double[][] weights,
Sample... data)
Computes the models with structure graph |
void |
train(Sample data,
double[] weights)
Trains the Model object given the data as Sample using the specified weights. |
void |
train(Sample data,
double[] weights,
int[][] graph)
Computes the model with structure graph |
Methods inherited from class de.jstacs.models.discrete.inhomogeneous.DAGModel |
---|
checkAcyclic, clone, createConstraints, drawParameters, emitSample, estimateParameters, getFurtherModelInfos, getLogPriorTerm, getLogProbFor, getNumericalCharacteristics, getProbFor, setFurtherModelInfos, toString |
Methods inherited from class de.jstacs.models.discrete.inhomogeneous.InhomogeneousDGM |
---|
check, setOutputStream |
Methods inherited from class de.jstacs.models.discrete.DiscreteGraphicalModel |
---|
fromXML, getCurrentParameterSet, getDescription, getESS, isTrained, toXML |
Methods inherited from class de.jstacs.models.AbstractModel |
---|
getAlphabetContainer, getCharacteristics, getLength, getLogProbFor, getLogProbFor, getLogProbFor, getLogProbFor, getPriorTerm, getProbFor, getProbFor, set, setNewAlphabetContainerInstance, train |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FSDAGModel(FSDAGMParameterSet params) throws CloneNotSupportedException, IllegalArgumentException, NonParsableException
params
- the parameter set
CloneNotSupportedException
- if the parameter set could not be cloned
IllegalArgumentException
- if the parameter set is not instantiated
NonParsableException
- if the parameter set is not parsablepublic FSDAGModel(StringBuffer xml) throws NonParsableException
Storable
.
xml
- the xml representation
NonParsableException
- if the representation could not be parsed.Method Detail |
---|
public String getInstanceName()
Model
public byte getMaximalMarkovOrder()
Model
getMaximalMarkovOrder
in interface Model
getMaximalMarkovOrder
in class AbstractModel
protected String getXMLTag()
getXMLTag
in class DiscreteGraphicalModel
DiscreteGraphicalModel.fromXML(StringBuffer)
,
DiscreteGraphicalModel.toXML()
public void train(Sample data, double[] weights) throws Exception
Model
Sample
using the specified weights. The weight
at position i belongs to the element at position i. So the array weight
should have the number of
sequences in the sample as dimension. (Optionally it is possible to use weight == null
if all
weights have the value one.)
data
- the given sequencesweights
- the weights of the elements, each weight should be non-negative
Exception
- an Exception should be thrown if the training did not succeed (e.g. the weights dimension of weights
and number of samples does not match).Sample.getElementAt(int)
,
Sample.ElementEnumerator
public void train(Sample data, double[] weights, int[][] graph) throws Exception
graph
data
- the sampleweights
- the weights for the sequences in the samplegraph
- the graph
Exception
- if something went wrongpublic void drawParameters(Sample data, double[] weights, int[][] graph) throws Exception
null
. Furthermore this method enables you to specify a
new graph structure.
data
- a sample or null
weights
- the (positive) weights for each sequence of the sample or null
graph
- the graph or null
for the current graph
Exception
public static void train(Model[] models, int[][] graph, double[][] weights, Sample... data) throws Exception
graph
models
- an array of AbstractModels containing only instances of FSDAGModeldata
- the sampleweights
- the weights for the sequences in the samplegraph
- the graph
Exception
- if something went wrongprotected void set(DGMParameterSet params, boolean trained) throws CloneNotSupportedException, NonParsableException
DiscreteGraphicalModel
set
in class InhomogeneousDGM
params
- the new ParameterSettrained
- the indicator for the model
CloneNotSupportedException
- if the parmeterSet could not be cloned
NonParsableException
- if the parameters of the model could not be parsedpublic String getStructure()
InhomogeneousDGM
getStructure
in class DAGModel
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |