public abstract class Inference extends Object
Modifier and Type | Field and Description |
---|---|
protected Constraint |
constraint
The constraints which must be satisfied by the inference algorithm.
|
protected Object |
head
Objects of this class are differentiated by their "head" objects.
|
protected LinkedHashMap |
variables
The values of this map are the variables we perform inference over; they are the actual
FirstOrderVariable objects found in this inference's constraints. |
Constructor and Description |
---|
Inference()
Default constructor.
|
Inference(Object h)
Initializes the head object.
|
Modifier and Type | Method and Description |
---|---|
static String |
exampleToString(Object example)
Produces a string representation of an example object.
|
Object |
getHead()
Retrieves the head object.
|
String[] |
getHeadFinderTypes()
Returns the fully qualified names of the types of objects for which head finder methods have
been defined.
|
String |
getHeadType()
Returns the fully qualified name of the type of the head object for this inference.
|
Normalizer |
getNormalizer(Learner c)
Returns the normalization function associated with the given classifier in this inference.
|
FirstOrderVariable |
getVariable(FirstOrderVariable v)
Retrieves the requested variable, creating it first if it doesn't yet exist.
|
PropositionalVariable |
getVariable(PropositionalVariable v)
Retrieves the requested variable, creating it first if it doesn't yet exist.
|
protected abstract void |
infer()
Derived classes implement this method to perform the inference, setting the values of the
variables such that they maximize the objective function while satisfying the constraints.
|
boolean |
satisfied()
Determines if the constraints are satisfied by the current variable assignments.
|
abstract String |
valueOf(Learner c,
Object o)
Retrieves the value of the specified variable as identified by the classifier and the object
that produce that variable.
|
void |
visit(AtLeastQuantifier c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(AtMostQuantifier c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(ExistentialQuantifier c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(FirstOrderConjunction c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(FirstOrderConstant c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(FirstOrderDisjunction c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(FirstOrderDoubleImplication c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(FirstOrderEqualityTwoValues c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(FirstOrderEqualityWithValue c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(FirstOrderEqualityWithVariable c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(FirstOrderImplication c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(FirstOrderNegation c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(PropositionalAtLeast c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(PropositionalConjunction c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(PropositionalConstant c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(PropositionalDisjunction c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(PropositionalDoubleImplication c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(PropositionalImplication c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(PropositionalNegation c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(PropositionalVariable c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(QuantifiedConstraintInvocation c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visit(UniversalQuantifier c)
Derived classes override this method to do some type of processing on constraints of the
parameter's type.
|
void |
visitAll(Constraint c)
The default method for visiting a constraint simply visits that constraint's children.
|
protected LinkedHashMap variables
FirstOrderVariable
objects found in this inference's constraints. The keys are
also objects of type FirstOrderVariable
, but they are not necessarily the actual
objects found in the constraints. This map is populated by the first evaluation of the
constraints.protected Constraint constraint
protected Object head
public Inference()
public Inference(Object h)
h
- The head object.public static String exampleToString(Object example)
example
- The example object, which may be an array.example
.public Object getHead()
protected abstract void infer() throws Exception
Foo
, it may be assumed that the
constraint
member field has already been filled in appropriately, since the
LBJava compiler will generate a class extending Foo
whose constructor does so.Exception
public abstract String valueOf(Learner c, Object o) throws Exception
c
- The classifier producing the variable.o
- The object from which the variable is produced.Exception
public Normalizer getNormalizer(Learner c)
IdentityNormalizer
.c
- The classifier.public String getHeadType()
"java.lang.Object"
. It should be overridden by
derived classes.public String[] getHeadFinderTypes()
Inference
is required to have at least one head
finder. Inference
classes written by the compiler automatically override this
method appropriately.public boolean satisfied()
public PropositionalVariable getVariable(PropositionalVariable v)
v
- A variable containing the same classifier, object, and prediction value as the
desired variable.public FirstOrderVariable getVariable(FirstOrderVariable v)
v
- A variable containing the same classifier and object as the desired variable.public void visitAll(Constraint c)
public void visit(FirstOrderDoubleImplication c)
c
- The constraint to process.public void visit(FirstOrderImplication c)
c
- The constraint to process.public void visit(FirstOrderConjunction c)
c
- The constraint to process.public void visit(FirstOrderDisjunction c)
c
- The constraint to process.public void visit(FirstOrderEqualityTwoValues c)
c
- The constraint to process.public void visit(FirstOrderEqualityWithValue c)
c
- The constraint to process.public void visit(FirstOrderEqualityWithVariable c)
c
- The constraint to process.public void visit(FirstOrderNegation c)
c
- The constraint to process.public void visit(FirstOrderConstant c)
c
- The constraint to process.public void visit(UniversalQuantifier c)
c
- The constraint to process.public void visit(ExistentialQuantifier c)
c
- The constraint to process.public void visit(AtLeastQuantifier c)
c
- The constraint to process.public void visit(AtMostQuantifier c)
c
- The constraint to process.public void visit(QuantifiedConstraintInvocation c)
c
- The constraint to process.public void visit(PropositionalDoubleImplication c)
c
- The constraint to process.public void visit(PropositionalImplication c)
c
- The constraint to process.public void visit(PropositionalConjunction c)
c
- The constraint to process.public void visit(PropositionalDisjunction c)
c
- The constraint to process.public void visit(PropositionalAtLeast c)
c
- The constraint to process.public void visit(PropositionalConstant c)
c
- The constraint to process.public void visit(PropositionalNegation c)
c
- The constraint to process.public void visit(PropositionalVariable c)
c
- The constraint to process.Copyright © 2016. All rights reserved.