public class Train extends Pass
TranslateToJava
, this pass trains any classifiers for
which training was indicated.TranslateToJava
Modifier and Type | Class and Description |
---|---|
protected class |
Train.TrainingThread
This class contains the code that trains a learning classifier.
|
Modifier and Type | Field and Description |
---|---|
protected HashMap |
learnerDependencies
The keys of this map are the names of learners; the values are
LinkedList s of
the names of the learners that the learner named by the key depends on. |
protected boolean |
newCode
Set to
true iff there existed a LearningClassifierExpression for which
new code was generated. |
protected int |
progressOutput
Progress output will be printed every
progressOutput examples. |
protected HashMap |
threadMap
A map of all the training threads indexed by the name of the learner.
|
protected Train.TrainingThread[] |
threads
An array of the training threads, which is never modified after it is constructed.
|
ast, canAddErrorsAndWarnings, fatalError, root
Constructor and Description |
---|
Train(AST ast,
int output)
Instantiates a pass that runs on an entire
AST . |
Modifier and Type | Method and Description |
---|---|
protected void |
executeReadyThreads(String name)
This method updates the
learnerDependencies
graph by removing the specified name from every dependencies list, and then starts every
thread that has no more dependencies. |
protected void |
fillLearnerDependorsDAG()
This method initializes the
learnerDependencies
graph such that the entry for each learner contains the names of all learners that depend on
it, except that cycles are broken by preferring that learners appearing earlier in the source
get trained first. |
void |
run(AST ast)
Runs this pass on all nodes of the indicated type.
|
void |
run(CodedClassifier cc)
Runs this pass on all nodes of the indicated type.
|
void |
run(ConstraintDeclaration cd)
Runs this pass on all nodes of the indicated type.
|
void |
run(InferenceDeclaration id)
Runs this pass on all nodes of the indicated type.
|
void |
run(LearningClassifierExpression lce)
Runs this pass on all nodes of the indicated type.
|
static boolean |
runJavac(String arguments)
Run the
javac compiler with the specified arguments in
addition to those specified on the command line. |
printErrorsAndWarnings, reportError, reportWarning, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, run, runOnChildren, setRoot
protected int progressOutput
progressOutput
examples.protected boolean newCode
true
iff there existed a LearningClassifierExpression
for which
new code was generated.protected Train.TrainingThread[] threads
protected HashMap threadMap
protected HashMap learnerDependencies
LinkedList
s of
the names of the learners that the learner named by the key depends on.public static boolean runJavac(String arguments)
javac
compiler with the specified arguments in
addition to those specified on the command line.arguments
- The arguments to send to javac
.true
iff errors were encountered.protected void fillLearnerDependorsDAG()
learnerDependencies
graph such that the entry for each learner contains the names of all learners that depend on
it, except that cycles are broken by preferring that learners appearing earlier in the source
get trained first.protected void executeReadyThreads(String name)
learnerDependencies
graph by removing the specified name from every dependencies list, and then starts every
thread that has no more dependencies.name
- The name of a learner whose training has completed.public void run(AST ast)
public void run(LearningClassifierExpression lce)
public void run(CodedClassifier cc)
CodedClassifier
s, so this method exists simply to stop
that from happening.public void run(ConstraintDeclaration cd)
ConstraintDeclaration
s, so this method
exists simply to stop that from happening.public void run(InferenceDeclaration id)
InferenceDeclaration
s, so this method exists simply
to stop that from happening.Copyright © 2016. All rights reserved.