|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tuffy.main.Infer tuffy.learn.Learner
public abstract class Learner
The abstract class of learning a weight of MLN. A runnable learner should extend this abstract class by specifying some ad-hoc functions. This class extends Infer class, because it uses inference as subroutines. NOTE: this class has static variables. Parallell running of multiple learner instances may cause problems.
Field Summary | |
---|---|
java.util.HashMap<java.lang.String,java.lang.Double> |
_oldWeight
Map from clause name to clause weight learned in last iteration. |
int |
backtrackCount_
Number of past backtracked steps. |
boolean |
backtracked
Whether current step is a backtracked step. |
static java.util.HashMap<java.lang.String,java.lang.Double> |
currentWeight
Map from clause name to current clause weight. |
static java.util.HashMap<java.lang.String,java.lang.Double> |
finalWeight
Map from clause name to final weight. |
static java.util.HashMap<java.lang.String,java.lang.Boolean> |
isHardMappings
Map from clause name to whether it is assigned to hard weight clause while learning. |
(package private) java.util.HashMap<java.lang.String,java.lang.Long> |
negativeWeightSatisfication
Map from clause name to training data satisfaction of negative weight. |
(package private) java.util.HashMap<java.lang.String,java.lang.Long> |
negativeWeightViolation
Map from clause name to training data violation of negative weight. |
double |
odds
FOR JUNIT TEST ONLY. |
static java.util.HashMap<java.lang.String,java.lang.Double> |
oriWeight
Map from clause name to the clause weight read originally from MLN program. |
(package private) java.util.HashMap<java.lang.String,java.lang.Long> |
positiveWeightSatisfication
Map from clause name to training data satisfaction of positive weight. |
(package private) java.util.HashMap<java.lang.String,java.lang.Long> |
positiveWeightViolation
Map from clause name to training data violation of positive weight. |
java.util.HashMap<java.lang.String,java.lang.Long> |
trainingSatisification
Map from clause name to current training data satisfaction. |
java.util.HashMap<java.lang.String,java.lang.Long> |
trainingViolation
Map from clause name to current training data violation. |
Fields inherited from class tuffy.main.Infer |
---|
db, dmover, grounding, mln, options |
Constructor Summary | |
---|---|
Learner()
|
Method Summary | |
---|---|
void |
calcCurrentTrainingViolation()
Calculate current training violations according to current sign of weight. |
void |
dumpAnswers(java.lang.String fout)
Dump the learning result to file CommandOptions.fout . |
void |
fillInCurrentWeight(MRF _mcsat)
Initialize weight according to the log odd of training data. |
abstract void |
loadingTrainingData(MRF _mcsat)
Reading from training data and fill it into MRF.atoms . |
void |
run(CommandOptions opt)
run the learner |
abstract boolean |
updateWeight(MRF mcsat)
Update currentWeight to new weights
according to information provided by mcsat instance, e.g.,
MCSAT#expectationOfViolation ; This is a virtual
function, each instance of Learner should materialize
an adhoc version of this function. |
Methods inherited from class tuffy.main.Infer |
---|
cleanUp, ground, loadMLN, setUp |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.util.HashMap<java.lang.String,java.lang.Double> currentWeight
public static java.util.HashMap<java.lang.String,java.lang.Double> oriWeight
public static java.util.HashMap<java.lang.String,java.lang.Boolean> isHardMappings
public java.util.HashMap<java.lang.String,java.lang.Double> _oldWeight
public static java.util.HashMap<java.lang.String,java.lang.Double> finalWeight
public double odds
public boolean backtracked
public int backtrackCount_
public java.util.HashMap<java.lang.String,java.lang.Long> trainingViolation
public java.util.HashMap<java.lang.String,java.lang.Long> trainingSatisification
java.util.HashMap<java.lang.String,java.lang.Long> positiveWeightViolation
java.util.HashMap<java.lang.String,java.lang.Long> positiveWeightSatisfication
java.util.HashMap<java.lang.String,java.lang.Long> negativeWeightViolation
java.util.HashMap<java.lang.String,java.lang.Long> negativeWeightSatisfication
Constructor Detail |
---|
public Learner()
Method Detail |
---|
public void run(CommandOptions opt) throws java.sql.SQLException
opt
- Command line Options
java.sql.SQLException
public void dumpAnswers(java.lang.String fout)
CommandOptions.fout
.
The format of this file is consistent with inference part.
public abstract boolean updateWeight(MRF mcsat)
currentWeight
to new weights
according to information provided by mcsat instance, e.g.,
MCSAT#expectationOfViolation
; This is a virtual
function, each instance of Learner
should materialize
an adhoc version of this function. This function should return
whether the learner thinks this iteration should terminate.
mcsat
- MCSAT instance after this iteration.
public abstract void loadingTrainingData(MRF _mcsat)
MRF.atoms
.
This function should be materialized by an instance
of abstract class Learner.
_mcsat
- The MCSAT object to be filled in.public void calcCurrentTrainingViolation()
trainingViolation
and trainingSatisification
.
public void fillInCurrentWeight(MRF _mcsat)
_mcsat
- MCSAT instance containing the vio/sat
informaiton.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |