Class RandomBrainScriptGenerator

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.QuickInfoSupporter, adams.core.Randomizable, adams.core.SizeOfHandler, adams.flow.core.FlowContextHandler, ModelGenerator, Serializable

    public class RandomBrainScriptGenerator
    extends AbstractBrainScriptModelGenerator
    implements adams.core.Randomizable
    Generates random networks, just using dense layers and a linear layer as output.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_DefaultNetwork

        protected adams.core.base.BaseText m_DefaultNetwork
        the default network.
      • m_DefaultDenseLayer

        protected adams.core.base.BaseText m_DefaultDenseLayer
        the default dense layer.
      • m_DefaultOutputLayer

        protected adams.core.base.BaseText m_DefaultOutputLayer
        the default output layer.
      • m_Seed

        protected long m_Seed
        the seed value.
      • m_NumNetworks

        protected int m_NumNetworks
        the number of networks to generate.
      • m_NumLayers

        protected adams.core.base.BaseInteger[] m_NumLayers
        the list of possible layers.
      • m_NumNodes

        protected adams.core.base.BaseInteger[] m_NumNodes
        the list of possible nodes (per layer).
      • m_LearningRate

        protected adams.core.base.BaseDouble[] m_LearningRate
        learning rate values.
      • m_UseRegularization

        protected adams.core.base.BaseBoolean[] m_UseRegularization
        using regularization.
      • m_L1

        protected adams.core.base.BaseDouble[] m_L1
        L1 values.
      • m_L2

        protected adams.core.base.BaseDouble[] m_L2
        L2 values.
      • m_DropOut

        protected adams.core.base.BaseDouble[] m_DropOut
        the drop out.
      • m_LearningRateScheduleEpochs

        protected adams.core.base.BaseInteger[] m_LearningRateScheduleEpochs
        the epochs for the learning rate schedule.
      • m_LearningRateScheduleDivisors

        protected adams.core.base.BaseDouble[] m_LearningRateScheduleDivisors
        the learning rate divisors for the learning rate schedule.
      • m_InsertBatchNormLayers

        protected boolean m_InsertBatchNormLayers
        whether to insert batchnorm layers.
    • Constructor Detail

      • RandomBrainScriptGenerator

        public RandomBrainScriptGenerator()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.core.option.AbstractOptionHandler
      • setDefaultNetwork

        public void setDefaultNetwork​(adams.core.base.BaseText value)
        Sets the default network.
        Parameters:
        value - the network
      • getDefaultNetwork

        public adams.core.base.BaseText getDefaultNetwork()
        Returns the default network.
        Returns:
        the network
      • defaultNetworkTipText

        public String defaultNetworkTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setDefaultDenseLayer

        public void setDefaultDenseLayer​(adams.core.base.BaseText value)
        Sets the default dense layer.
        Parameters:
        value - the dense layer
      • getDefaultDenseLayer

        public adams.core.base.BaseText getDefaultDenseLayer()
        Returns the default dense layer.
        Returns:
        the dense layer
      • defaultDenseLayerTipText

        public String defaultDenseLayerTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setDefaultOutputLayer

        public void setDefaultOutputLayer​(adams.core.base.BaseText value)
        Sets the default output layer.
        Parameters:
        value - the output layer
      • getDefaultOutputLayer

        public adams.core.base.BaseText getDefaultOutputLayer()
        Returns the default output layer.
        Returns:
        the output layer
      • defaultOutputLayerTipText

        public String defaultOutputLayerTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setSeed

        public void setSeed​(long value)
        Sets the seed value.
        Specified by:
        setSeed in interface adams.core.Randomizable
        Parameters:
        value - the seed
      • getSeed

        public long getSeed()
        Returns the seed value.
        Specified by:
        getSeed in interface adams.core.Randomizable
        Returns:
        the seed
      • seedTipText

        public String seedTipText()
        Returns the tip text for this property.
        Specified by:
        seedTipText in interface adams.core.Randomizable
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setNumNetworks

        public void setNumNetworks​(int value)
        Sets the maximum number of networks to generate.
        Parameters:
        value - the maximum
      • getNumNetworks

        public int getNumNetworks()
        Returns the maximum number of networks to generate.
        Returns:
        the maximum
      • numNetworksTipText

        public String numNetworksTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setNumLayers

        public void setNumLayers​(adams.core.base.BaseInteger[] value)
        Sets the list of number of layers.
        Parameters:
        value - the list
      • getNumLayers

        public adams.core.base.BaseInteger[] getNumLayers()
        Returns the list of number of layers.
        Returns:
        the list
      • numLayersTipText

        public String numLayersTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setNumNodes

        public void setNumNodes​(adams.core.base.BaseInteger[] value)
        Sets the list of node counts to choose from.
        Parameters:
        value - the list
      • getNumNodes

        public adams.core.base.BaseInteger[] getNumNodes()
        Returns the list of node counts to choose from.
        Returns:
        the list
      • numNodesTipText

        public String numNodesTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setLearningRate

        public void setLearningRate​(adams.core.base.BaseDouble[] value)
        Sets the list of learning rate values to choose from.
        Parameters:
        value - the list
      • getLearningRate

        public adams.core.base.BaseDouble[] getLearningRate()
        Returns the list of learning rate values to choose from.
        Returns:
        the list
      • learningRateTipText

        public String learningRateTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setUseRegularization

        public void setUseRegularization​(adams.core.base.BaseBoolean[] value)
        Sets the list of regularization flags to choose from.
        Parameters:
        value - the list
      • getUseRegularization

        public adams.core.base.BaseBoolean[] getUseRegularization()
        Returns the list of regularization flags to choose from.
        Returns:
        the list
      • useRegularizationTipText

        public String useRegularizationTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setL1

        public void setL1​(adams.core.base.BaseDouble[] value)
        Sets the list of L1 values to choose from.
        Parameters:
        value - the list
      • getL1

        public adams.core.base.BaseDouble[] getL1()
        Returns the list of L1 values to choose from.
        Returns:
        the list
      • L1TipText

        public String L1TipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setL2

        public void setL2​(adams.core.base.BaseDouble[] value)
        Sets the list of L2 values to choose from.
        Parameters:
        value - the list
      • getL2

        public adams.core.base.BaseDouble[] getL2()
        Returns the list of L2 values to choose from.
        Returns:
        the list
      • L2TipText

        public String L2TipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setDropOut

        public void setDropOut​(adams.core.base.BaseDouble[] value)
        Sets the list of drop out values to choose from.
        Parameters:
        value - the list
      • getDropOut

        public adams.core.base.BaseDouble[] getDropOut()
        Returns the list of drop out values to choose from.
        Returns:
        the list
      • dropOutTipText

        public String dropOutTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setLearningRateScheduleEpochs

        public void setLearningRateScheduleEpochs​(adams.core.base.BaseInteger[] value)
        Sets the epochs to use for the learning rate schedule; not used if empty.
        Parameters:
        value - the list
      • getLearningRateScheduleEpochs

        public adams.core.base.BaseInteger[] getLearningRateScheduleEpochs()
        Returns the list of epochs to use for the learning rate schedule; not used if empty.
        Returns:
        the list
      • learningRateScheduleEpochsTipText

        public String learningRateScheduleEpochsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setLearningRateScheduleDivisors

        public void setLearningRateScheduleDivisors​(adams.core.base.BaseDouble[] value)
        Sets the divisors to use for the learning rate schedule; not used if empty.
        Parameters:
        value - the list
      • getLearningRateScheduleDivisors

        public adams.core.base.BaseDouble[] getLearningRateScheduleDivisors()
        Returns the list of divisors to use for the learning rate schedule; not used if empty.
        Returns:
        the list
      • learningRateScheduleDivisorsTipText

        public String learningRateScheduleDivisorsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setInsertBatchNormLayers

        public void setInsertBatchNormLayers​(boolean value)
        Sets whether to insert batchnorm layers after each layer.
        Parameters:
        value - true if to insert
      • getInsertBatchNormLayers

        public boolean getInsertBatchNormLayers()
        Returns whether to insert batchnorm layers after each layer.
        Returns:
        true if to insert
      • insertBatchNormLayersTipText

        public String insertBatchNormLayersTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • pick

        protected Object pick​(Random rand,
                              Object array)
        Picks an array element randomly if more than one element, otherwise just returns the single element.
        Parameters:
        rand - the random number generator to use for picking the element
        array - the array to pick the element from
        Returns:
        the chosen element
      • doGenerate

        protected List<String> doGenerate​(int numInput,
                                          int numOutput)
        Generates the actual models.
        Specified by:
        doGenerate in class AbstractModelGenerator
        Parameters:
        numInput - the number of input nodes
        numOutput - the number of output nodes
        Returns:
        the models