cc.mallet.grmm.learning
Class ACRF

java.lang.Object
  extended by cc.mallet.grmm.learning.ACRF
All Implemented Interfaces:
java.io.Serializable

public class ACRF
extends java.lang.Object
implements java.io.Serializable

Class for Arbitrary CRFs. These are CRFs with completely arbitrary graphical structure. The user passes in a list of instances of ACRF.CliqueFactory, which get to look at the sequence and decide what

Version:
$Id: ACRF.java,v 1.1 2007/10/22 21:37:43 mccallum Exp $
Author:
Charles Sutton
See Also:
Serialized Form

Nested Class Summary
static class ACRF.BigramTemplate
          A template that adds edges between adjacent nodes in a label sequence for one factor.
static class ACRF.FixedFactorTemplate
           
static interface ACRF.GraphPostProcessor
          Interface for making global transformations to an unrolled graph after it has been generated.
 class ACRF.MaximizableACRF
           
static class ACRF.PairwiseFactorTemplate
          A template that adds edges between cotemporal nodes of a given pair of factors.
static class ACRF.SequenceTemplate
          Abstract class for Templates that expect a (FeatureVectorSequence, LabelsSequence) for their instances.
static class ACRF.Template
          A type of clique in the model.
static class ACRF.UnigramTemplate
          A template that adds node potentials for a given factor.
static class ACRF.UnrolledGraph
           
static class ACRF.UnrolledVarSet
          A clique in the unrolled graphical model (an instantiation of some Template).
 
Constructor Summary
ACRF(Pipe inputPipe, ACRF.Template[] tmpls)
          Create a ACRF for a 1-d sequence.
 
Method Summary
 void addFixedPotential(ACRF.Template tmpl)
           
 void addFixedPotentials(ACRF.Template[] tmpls)
           
 Assignment bestAssignment(Instance inst)
           
 java.util.List bestAssignment(InstanceList lst)
           
 void dumpUnrolledGraphs(InstanceList lst)
           
 LabelsSequence getBestLabels(Instance inst)
           
 java.util.List getBestLabels(InstanceList lst)
           
 int getDefaultFeatureIndex()
           
 ACRF.Template[] getFixedTemplates()
           
 double getGaussianPriorVariance()
           
 Inferencer getInferencer()
           
 Alphabet getInputAlphabet()
           
 Pipe getInputPipe()
           
 Optimizable.ByGradientValue getMaximizable(InstanceList ilst)
           
 ACRF.Template[] getTemplates()
           
 Inferencer getViterbiInferencer()
           
 boolean isCacheUnrolledGraphs()
           
 boolean isDoSizeScale()
           
static ACRF makeFactorial(Pipe p, int numLevels)
           
 void print(java.io.OutputStream os)
           
 void readWeightsFromText(java.io.Reader reader)
           
 void setCacheUnrolledGraphs(boolean cacheUnrolledGraphs)
           
 void setDoSizeScale(boolean doSizeScale)
           
 void setFixedPotentials(ACRF.Template[] fixed)
           
 void setGaussianPriorVariance(double gaussianPriorVariance)
           
 void setGraphProcessor(ACRF.GraphPostProcessor graphProcessor)
           
 void setInferencer(Inferencer inf)
           
 void setSupportedOnly(boolean b)
          Sets all templates of this ACRF to use supported features only.
 void setVerboseOutputDirectory(java.io.File dir)
           
 void setViterbiInferencer(Inferencer inf)
           
 ACRF.UnrolledGraph unroll(Instance inst)
           
 ACRF.UnrolledGraph unrollStructureOnly(Instance inst)
           
 void writeWeightsText(java.io.Writer writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ACRF

public ACRF(Pipe inputPipe,
            ACRF.Template[] tmpls)
     throws java.lang.IllegalArgumentException
Create a ACRF for a 1-d sequence. Needs an array of Templates.

Throws:
java.lang.IllegalArgumentException
Method Detail

getInputAlphabet

public Alphabet getInputAlphabet()

getDefaultFeatureIndex

public int getDefaultFeatureIndex()

getInferencer

public Inferencer getInferencer()

setInferencer

public void setInferencer(Inferencer inf)

getViterbiInferencer

public Inferencer getViterbiInferencer()

setViterbiInferencer

public void setViterbiInferencer(Inferencer inf)

isDoSizeScale

public boolean isDoSizeScale()

setDoSizeScale

public void setDoSizeScale(boolean doSizeScale)

setSupportedOnly

public void setSupportedOnly(boolean b)
Sets all templates of this ACRF to use supported features only.

Parameters:
b - If true, all templates will use supported features only. Otherwise, all unsupported features will be used.

isCacheUnrolledGraphs

public boolean isCacheUnrolledGraphs()

setCacheUnrolledGraphs

public void setCacheUnrolledGraphs(boolean cacheUnrolledGraphs)

setFixedPotentials

public void setFixedPotentials(ACRF.Template[] fixed)

addFixedPotentials

public void addFixedPotentials(ACRF.Template[] tmpls)

getTemplates

public ACRF.Template[] getTemplates()

getInputPipe

public Pipe getInputPipe()

getFixedTemplates

public ACRF.Template[] getFixedTemplates()

addFixedPotential

public void addFixedPotential(ACRF.Template tmpl)

getGaussianPriorVariance

public double getGaussianPriorVariance()

setGaussianPriorVariance

public void setGaussianPriorVariance(double gaussianPriorVariance)

setGraphProcessor

public void setGraphProcessor(ACRF.GraphPostProcessor graphProcessor)

getMaximizable

public Optimizable.ByGradientValue getMaximizable(InstanceList ilst)

bestAssignment

public java.util.List bestAssignment(InstanceList lst)

bestAssignment

public Assignment bestAssignment(Instance inst)

getBestLabels

public java.util.List getBestLabels(InstanceList lst)

getBestLabels

public LabelsSequence getBestLabels(Instance inst)

unroll

public ACRF.UnrolledGraph unroll(Instance inst)

unrollStructureOnly

public ACRF.UnrolledGraph unrollStructureOnly(Instance inst)

print

public void print(java.io.OutputStream os)

dumpUnrolledGraphs

public void dumpUnrolledGraphs(InstanceList lst)

readWeightsFromText

public void readWeightsFromText(java.io.Reader reader)
                         throws java.io.IOException
Throws:
java.io.IOException

writeWeightsText

public void writeWeightsText(java.io.Writer writer)

makeFactorial

public static ACRF makeFactorial(Pipe p,
                                 int numLevels)

setVerboseOutputDirectory

public void setVerboseOutputDirectory(java.io.File dir)