Documentation of 'org.encog.ml.prg.extension.FunctionFactory' Java class
FunctionFactory
org.encog.ml.prg.extension

Class FunctionFactory

  • All Implemented Interfaces:
    java.io.Serializable


    public class FunctionFactory
    extends java.lang.Object
    implements java.io.Serializable
    A function factory maps the opcodes contained in the EncogOpcodeRegistry into an EncogProgram. You rarely want to train with every available opcode. For example, if you are only looking to produce an equation, you should not make use of the if-statement and logical operators.
    See Also:
    Serialized Form
    • Constructor Detail

      • FunctionFactory

        public FunctionFactory()
        Default constructor.
    • Method Detail

      • addExtension

        public void addExtension(ProgramExtensionTemplate ext)
        Add an opcode to the function factory. The opcode must exist in the opcode registry.
        Parameters:
        ext - The opcode to add.
      • addExtension

        public void addExtension(java.lang.String name,
                                 int args)
        Add an opcode to the function factory from the opcode registry.
        Parameters:
        name - The name of the opcode.
        args - The number of arguments.
      • factorProgramNode

        public ProgramNode factorProgramNode(ProgramExtensionTemplate temp,
                                             EncogProgram program,
                                             ProgramNode[] args)
        Factor a new program node, based in a template object.
        Parameters:
        temp - The opcode.
        program - The program.
        args - The arguments for this node.
        Returns:
        The newly created ProgramNode.
      • factorProgramNode

        public ProgramNode factorProgramNode(java.lang.String name,
                                             EncogProgram program,
                                             ProgramNode[] args)
        Factor a new program node, based on an opcode name and arguments.
        Parameters:
        name - The name of the opcode.
        program - The program to factor for.
        args - The arguements.
        Returns:
        The newly created ProgramNode.
      • findFunction

        public ProgramExtensionTemplate findFunction(java.lang.String name)
        Find a function with the specified name.
        Parameters:
        name - The name of the function.
        Returns:
        The function opcode.
      • findOpcodes

        public java.util.List<ProgramExtensionTemplate> findOpcodes(java.util.List<ValueType> types,
                                                                    EncogProgramContext context,
                                                                    boolean includeTerminal,
                                                                    boolean includeFunction)
        Find all opcodes that match the search criteria.
        Parameters:
        types - The return types to consider.
        context - The program context.
        includeTerminal - True, to include the terminals.
        includeFunction - True, to include the functions.
        Returns:
        The opcodes found.
      • findOperator

        public ProgramExtensionTemplate findOperator(char ch1,
                                                     char ch2)
        This method is used when parsing an expression. Consider x≥2. The parser first sees the > symbol. But it must also consider the =. So we first look for a 2-char operator, in this case there is one.
        Parameters:
        ch1 - The first character of the potential operator.
        ch2 - The second character of the potential operator. Zero if none.
        Returns:
        The expression template for the operator found.
      • getOpCode

        public ProgramExtensionTemplate getOpCode(int theOpCode)
        Get the specified opcode.
        Parameters:
        theOpCode - The opcode index.
        Returns:
        The opcode.
      • getTemplateMap

        public java.util.Map<java.lang.String,ProgramExtensionTemplate> getTemplateMap()
        Returns:
        the templateMap
      • isDefined

        public boolean isDefined(java.lang.String name,
                                 int l)
        Determine if an opcode is in the function factory.
        Parameters:
        name - The name of the opcode.
        l - The argument count for the opcode.
        Returns:
        True if the opcode exists.
      • size

        public int size()
        Returns:
        The number of opcodes.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.