|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfer.Infer
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. |
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. |
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 infer.Infer |
---|
db, 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(MCSAT _mcsat)
Initialize weight according to the log odd of training data. |
abstract void |
loadingTrainingData(MCSAT _mcsat)
Reading from training data and fill it into MRF.atoms . |
void |
run(CommandOptions opt)
run the learner |
abstract boolean |
updateWeight(MCSAT 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 infer.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 java.util.HashMap<java.lang.String,java.lang.Double> _oldWeight
public int backtrackCount_
public boolean backtracked
public static java.util.HashMap<java.lang.String,java.lang.Double> currentWeight
public static java.util.HashMap<java.lang.String,java.lang.Double> finalWeight
public static java.util.HashMap<java.lang.String,java.lang.Boolean> isHardMappings
public double odds
public static java.util.HashMap<java.lang.String,java.lang.Double> oriWeight
public java.util.HashMap<java.lang.String,java.lang.Long> trainingSatisification
public java.util.HashMap<java.lang.String,java.lang.Long> trainingViolation
Constructor Detail |
---|
public Learner()
Method Detail |
---|
public void calcCurrentTrainingViolation()
trainingViolation
and trainingSatisification
.
public void dumpAnswers(java.lang.String fout)
CommandOptions.fout
.
The format of this file is consistent with inference part.
public void fillInCurrentWeight(MCSAT _mcsat)
_mcsat
- MCSAT instance containing the vio/sat
informaiton.public abstract void loadingTrainingData(MCSAT _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 run(CommandOptions opt) throws java.sql.SQLException
opt
- Command line Options
java.sql.SQLException
public abstract boolean updateWeight(MCSAT 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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |