public abstract class VotedPerceptron extends WeightLearningApplication
WeightLearningApplication.computeExpectedIncompatibility()
.
Reasonable initial implementations are provided for all methods.
Child classes should be able to pick and chose which to override.Modifier and Type | Field and Description |
---|---|
static boolean |
AVERAGE_STEPS_DEFAULT |
static String |
AVERAGE_STEPS_KEY
Key for Boolean property that indicates whether to average all visited
weights together for final output.
|
protected boolean |
averageSteps |
protected double |
baseStepSize |
static boolean |
CLIP_NEGATIVE_WEIGHTS_DEFAULT |
static String |
CLIP_NEGATIVE_WEIGHTS_KEY
If true, then weight will not be allowed to go negative (clipped at zero).
|
protected boolean |
clipNegativeWeights |
static String |
CONFIG_PREFIX
Prefix of property keys used by this class.
|
static boolean |
CUT_OBJECTIVE_DEFAULT |
static String |
CUT_OBJECTIVE_KEY
If true, then cut the step size in half whenever the objective increases.
|
protected boolean |
cutObjective |
protected double |
inertia |
static double |
INERTIA_DEFAULT |
static String |
INERTIA_KEY
The inertia that is used for adaptive step sizes.
|
static double |
L1_REGULARIZATION_DEFAULT |
static String |
L1_REGULARIZATION_KEY
Key for positive double property scaling the L1 regularization
\gamma * |w|
|
protected double |
l1Regularization |
static double |
L2_REGULARIZATION_DEFAULT |
static String |
L2_REGULARIZATION_KEY
Key for positive double property scaling the L2 regularization
(\lambda / 2) * ||w||^2
|
protected double |
l2Regularization |
protected int |
maxNumSteps |
static int |
NUM_STEPS_DEFAULT |
static String |
NUM_STEPS_KEY
Key for positive integer property.
|
protected int |
numSteps |
static boolean |
SCALE_GRADIENT_DEFAULT |
static String |
SCALE_GRADIENT_KEY
Key for Boolean property that indicates whether to scale gradient by
number of groundings
|
static boolean |
SCALE_STEP_SIZE_DEFAULT |
static String |
SCALE_STEP_SIZE_KEY
If true, then scale the step size down by the iteration.
|
protected boolean |
scaleGradient |
protected boolean |
scaleStepSize |
static double |
STEP_SIZE_DEFAULT |
static String |
STEP_SIZE_KEY
Key for positive double property which will be multiplied with the
objective gradient to compute a step.
|
static boolean |
ZERO_INITIAL_WEIGHTS_DEFAULT |
static String |
ZERO_INITIAL_WEIGHTS_KEY
If true, then start all weights at zero for learning.
|
protected boolean |
zeroInitialWeights |
allRules, atomManager, evaluator, EVALUATOR_DEFAULT, EVALUATOR_KEY, expectedIncompatibility, GROUND_RULE_STORE_DEFAULT, GROUND_RULE_STORE_KEY, groundRuleStore, inLatentMPEState, inMPEState, latentGroundRuleStore, latentTermStore, MAX_RANDOM_WEIGHT, MIN_ADMM_STEPS, mutableRules, observedDB, observedIncompatibility, RANDOM_WEIGHTS_DEFAULT, RANDOM_WEIGHTS_KEY, reasoner, REASONER_DEFAULT, REASONER_KEY, rvDB, supportsLatentVariables, TERM_GENERATOR_DEFAULT, TERM_GENERATOR_KEY, TERM_STORE_DEFAULT, TERM_STORE_KEY, termGenerator, termStore, trainingMap
Constructor and Description |
---|
VotedPerceptron(List<Rule> rules,
Database rvDB,
Database observedDB,
boolean supportsLatentVariables) |
Modifier and Type | Method and Description |
---|---|
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() |
void |
setBudget(double budget)
Set a budget (give as a proportion of the max budget).
|
close, computeExpectedIncompatibility, computeLatentMPEState, computeLoss, computeMPEState, computeObservedIncompatibility, createAtomManager, getWLA, initGroundModel, initGroundModel, initGroundModel, initLatentGroundModel, learn, postInitGroundModel, setDefaultRandomVariables, setLabeledRandomVariables
public static final String CONFIG_PREFIX
public static final String L2_REGULARIZATION_KEY
public static final double L2_REGULARIZATION_DEFAULT
public static final String L1_REGULARIZATION_KEY
public static final double L1_REGULARIZATION_DEFAULT
public static final String STEP_SIZE_KEY
public static final double STEP_SIZE_DEFAULT
public static final String INERTIA_KEY
public static final double INERTIA_DEFAULT
public static final String SCALE_GRADIENT_KEY
public static final boolean SCALE_GRADIENT_DEFAULT
public static final String AVERAGE_STEPS_KEY
public static final boolean AVERAGE_STEPS_DEFAULT
public static final String NUM_STEPS_KEY
public static final int NUM_STEPS_DEFAULT
public static final String CLIP_NEGATIVE_WEIGHTS_KEY
public static final boolean CLIP_NEGATIVE_WEIGHTS_DEFAULT
public static final String CUT_OBJECTIVE_KEY
public static final boolean CUT_OBJECTIVE_DEFAULT
public static final String SCALE_STEP_SIZE_KEY
public static final boolean SCALE_STEP_SIZE_DEFAULT
public static final String ZERO_INITIAL_WEIGHTS_KEY
public static final boolean ZERO_INITIAL_WEIGHTS_DEFAULT
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 doLearn()
WeightLearningApplication
doLearn
in class WeightLearningApplication
protected double computeRegularizer()
public double getLoss()
protected double[] computeScalingFactor()
public void setBudget(double budget)
WeightLearningApplication
setBudget
in class WeightLearningApplication
Copyright © 2018 University of California, Santa Cruz. All rights reserved.