public abstract class VotedPerceptron extends WeightLearningApplication
computeExpectedIncompatibility()
.
Reasonable initial implementations are provided for all methods.
Child classes should be able to pick and chose which to override.
Voted perceptron methods must use an InferenceApplication with a ground rules store,
i.e. VotedPerceptron cannot stream.Modifier and Type | Field and Description |
---|---|
protected boolean |
averageSteps |
protected double |
baseStepSize |
protected boolean |
clipNegativeWeights |
protected boolean |
cutObjective |
protected double[] |
expectedIncompatibility |
protected double |
inertia |
protected double |
l1Regularization |
protected double |
l2Regularization |
protected int |
maxNumSteps |
protected int |
numSteps |
protected double[] |
observedIncompatibility |
protected boolean |
scaleGradient |
protected boolean |
scaleStepSize |
protected boolean |
zeroInitialWeights |
allRules, evaluator, inference, inMPEState, mutableRules, observedDB, rvDB, trainingMap
Constructor and Description |
---|
VotedPerceptron(List<Rule> rules,
Database rvDB,
Database observedDB) |
Modifier and Type | Method and Description |
---|---|
protected void |
computeExpectedIncompatibility()
Compute the incompatibility in the model.
|
protected double |
computeLoss()
Internal method for computing the loss at the current point before taking a step.
|
protected void |
computeObservedIncompatibility()
Compute the incompatibility in the model using the labels (truth values) from the observed (truth) database.
|
protected double |
computeRegularizer() |
protected double[] |
computeScalingFactor()
Computes the amount to scale gradient for each rule.
|
protected void |
doLearn()
Do the actual learning procedure.
|
double |
getLoss() |
protected void |
postInitGroundModel()
A convenient place for children to do additional ground model initialization.
|
void |
setBudget(double budget)
Set a budget (give as a proportion of the max budget).
|
protected void |
setDefaultRandomVariables()
Set all RandomVariableAtoms we know of to their default values.
|
protected void |
setLabeledRandomVariables()
Set RandomVariableAtoms with training labels to their observed values.
|
close, computeMPEState, getInferenceApplication, getWLA, initGroundModel, initGroundModel, learn
protected double[] observedIncompatibility
protected double[] expectedIncompatibility
protected final double l2Regularization
protected final double l1Regularization
protected final boolean scaleGradient
protected double baseStepSize
protected boolean scaleStepSize
protected boolean averageSteps
protected boolean zeroInitialWeights
protected boolean clipNegativeWeights
protected boolean cutObjective
protected double inertia
protected final int maxNumSteps
protected int numSteps
protected void postInitGroundModel()
WeightLearningApplication
postInitGroundModel
in class WeightLearningApplication
protected void doLearn()
WeightLearningApplication
doLearn
in class WeightLearningApplication
protected double computeLoss()
protected double computeRegularizer()
public double getLoss()
protected double[] computeScalingFactor()
protected void computeObservedIncompatibility()
protected void computeExpectedIncompatibility()
protected void setLabeledRandomVariables()
protected void setDefaultRandomVariables()
public void setBudget(double budget)
WeightLearningApplication
setBudget
in class WeightLearningApplication
Copyright © 2020 University of California, Santa Cruz. All rights reserved.