org.encog.ml.prg
public class EncogProgram extends BasicGenome implements MLRegression, MLError
Constructor and Description |
---|
EncogProgram()
Construct the Encog program and create a default context and variable
holder.
|
EncogProgram(EncogProgramContext theContext)
Construct the Encog program with the specified context, but create a new
variable holder.
|
EncogProgram(EncogProgramContext theContext,
EncogProgramVariables theVariables)
Construct an Encog program using the specified context and variable
holder.
|
EncogProgram(String expression)
Construct an Encog program using the specified expression, but create an
empty context and variable holder.
|
Modifier and Type | Method and Description |
---|---|
double |
calculateError(MLDataSet data)
Calculate the error of the ML method, given a dataset.
|
ProgramNode |
compileEPL(String code)
Compile the specified EPL into an actual program node structure, for
later execution.
|
ProgramNode |
compileExpression(String expression)
Compile the specified expression.
|
MLData |
compute(MLData input)
Compute the output from the input MLData.
|
void |
copy(Genome source)
Copy from the specified genome into this one.
|
String |
dumpAsCommonExpression() |
ExpressionValue |
evaluate()
Execute the program and return the result.
|
ProgramNode |
findNode(int index)
Find the specified node by index.
|
String |
generateEPL() |
EncogProgramContext |
getContext() |
Object |
getExtraData(String name)
Get extra data that might be needed by user extended opcodes.
|
FunctionFactory |
getFunctions() |
int |
getInputCount() |
int |
getOutputCount() |
ValueType |
getReturnType() |
ProgramNode |
getRootNode() |
EncogProgramVariables |
getVariables() |
static boolean |
parseBoolean(String str)
Parse the specified program, or expression, and return the result.
|
static ExpressionValue |
parseExpression(String str)
Parse the specified program, or expression, and return the result.
|
static double |
parseFloat(String str)
Parse the specified program, or expression, and return the result.
|
static String |
parseString(String str)
Parse the specified program, or expression, and return the result.
|
void |
replaceNode(ProgramNode replaceThisNode,
ProgramNode replaceWith)
Replace the specified node with another.
|
int |
selectRandomVariable(Random rnd,
List<ValueType> desiredTypes)
Select a random variable from the defined variables.
|
void |
setExtraData(String name,
Object value)
Set extra data that might be needed by extensions.
|
void |
setRootNode(ProgramNode theRootNode)
Set the root node for the program.
|
int |
size() |
String |
toString() |
getAdjustedScore, getBirthGeneration, getPopulation, getScore, getSpecies, setAdjustedScore, setBirthGeneration, setPopulation, setScore, setSpecies
public EncogProgram()
public EncogProgram(EncogProgramContext theContext)
theContext
- The context.public EncogProgram(EncogProgramContext theContext, EncogProgramVariables theVariables)
theContext
- The context.theVariables
- The variable holder.public EncogProgram(String expression)
expression
- The expression.public static boolean parseBoolean(String str)
str
- The program expression.public static ExpressionValue parseExpression(String str)
str
- The program expression.public static double parseFloat(String str)
str
- The program expression value.public static String parseString(String str)
str
- The program expression value.public double calculateError(MLDataSet data)
calculateError
in interface MLError
data
- The dataset.public ProgramNode compileEPL(String code)
code
- The code to compile.public ProgramNode compileExpression(String expression)
expression
- The expression.public MLData compute(MLData input)
compute
in interface MLRegression
input
- The input to the program.public void copy(Genome source)
public String dumpAsCommonExpression()
public ExpressionValue evaluate()
public ProgramNode findNode(int index)
index
- The index being sought.public String generateEPL()
public EncogProgramContext getContext()
public FunctionFactory getFunctions()
public int getInputCount()
getInputCount
in interface MLInput
public int getOutputCount()
getOutputCount
in interface MLOutput
public ValueType getReturnType()
public ProgramNode getRootNode()
public EncogProgramVariables getVariables()
public void replaceNode(ProgramNode replaceThisNode, ProgramNode replaceWith)
replaceThisNode
- The node to replace.replaceWith
- The node that is replacing that node.public int selectRandomVariable(Random rnd, List<ValueType> desiredTypes)
rnd
- A random number generator.desiredTypes
- The desired types that the variable can be.public void setRootNode(ProgramNode theRootNode)
theRootNode
- The new root node.public int size()
public String toString()
toString
in class BasicGenome
public Object getExtraData(String name)
name
- The name the data was stored under.Copyright © 2014. All Rights Reserved.