Package adams.ml.cntk.modelgenerator
Class RandomBrainScriptGenerator
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.ml.cntk.modelgenerator.AbstractModelGenerator
-
- adams.ml.cntk.modelgenerator.AbstractBrainScriptModelGenerator
-
- adams.ml.cntk.modelgenerator.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 Summary
Fields Modifier and Type Field Description static String
INPUT_DIM
the placeholder variable for the input dimension.protected adams.core.base.BaseText
m_DefaultDenseLayer
the default dense layer.protected adams.core.base.BaseText
m_DefaultNetwork
the default network.protected adams.core.base.BaseText
m_DefaultOutputLayer
the default output layer.protected adams.core.base.BaseDouble[]
m_DropOut
the drop out.protected boolean
m_InsertBatchNormLayers
whether to insert batchnorm layers.protected adams.core.base.BaseDouble[]
m_L1
L1 values.protected adams.core.base.BaseDouble[]
m_L2
L2 values.protected adams.core.base.BaseDouble[]
m_LearningRate
learning rate values.protected adams.core.base.BaseDouble[]
m_LearningRateScheduleDivisors
the learning rate divisors for the learning rate schedule.protected adams.core.base.BaseInteger[]
m_LearningRateScheduleEpochs
the epochs for the learning rate schedule.protected adams.core.base.BaseInteger[]
m_NumLayers
the list of possible layers.protected int
m_NumNetworks
the number of networks to generate.protected adams.core.base.BaseInteger[]
m_NumNodes
the list of possible nodes (per layer).protected long
m_Seed
the seed value.protected adams.core.base.BaseBoolean[]
m_UseRegularization
using regularization.static String
OUTPUT_DIM
the placeholder variable for the output dimension.-
Fields inherited from class adams.ml.cntk.modelgenerator.AbstractModelGenerator
m_FlowContext
-
-
Constructor Summary
Constructors Constructor Description RandomBrainScriptGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
defaultDenseLayerTipText()
Returns the tip text for this property.String
defaultNetworkTipText()
Returns the tip text for this property.String
defaultOutputLayerTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected List<String>
doGenerate(int numInput, int numOutput)
Generates the actual models.String
dropOutTipText()
Returns the tip text for this property.adams.core.base.BaseText
getDefaultDenseLayer()
Returns the default dense layer.adams.core.base.BaseText
getDefaultNetwork()
Returns the default network.adams.core.base.BaseText
getDefaultOutputLayer()
Returns the default output layer.adams.core.base.BaseDouble[]
getDropOut()
Returns the list of drop out values to choose from.boolean
getInsertBatchNormLayers()
Returns whether to insert batchnorm layers after each layer.adams.core.base.BaseDouble[]
getL1()
Returns the list of L1 values to choose from.adams.core.base.BaseDouble[]
getL2()
Returns the list of L2 values to choose from.adams.core.base.BaseDouble[]
getLearningRate()
Returns the list of learning rate values to choose from.adams.core.base.BaseDouble[]
getLearningRateScheduleDivisors()
Returns the list of divisors to use for the learning rate schedule; not used if empty.adams.core.base.BaseInteger[]
getLearningRateScheduleEpochs()
Returns the list of epochs to use for the learning rate schedule; not used if empty.adams.core.base.BaseInteger[]
getNumLayers()
Returns the list of number of layers.int
getNumNetworks()
Returns the maximum number of networks to generate.adams.core.base.BaseInteger[]
getNumNodes()
Returns the list of node counts to choose from.long
getSeed()
Returns the seed value.adams.core.base.BaseBoolean[]
getUseRegularization()
Returns the list of regularization flags to choose from.String
globalInfo()
Returns a string describing the object.String
insertBatchNormLayersTipText()
Returns the tip text for this property.String
L1TipText()
Returns the tip text for this property.String
L2TipText()
Returns the tip text for this property.String
learningRateScheduleDivisorsTipText()
Returns the tip text for this property.String
learningRateScheduleEpochsTipText()
Returns the tip text for this property.String
learningRateTipText()
Returns the tip text for this property.String
numLayersTipText()
Returns the tip text for this property.String
numNetworksTipText()
Returns the tip text for this property.String
numNodesTipText()
Returns the tip text for this property.protected Object
pick(Random rand, Object array)
Picks an array element randomly if more than one element, otherwise just returns the single element.String
seedTipText()
Returns the tip text for this property.void
setDefaultDenseLayer(adams.core.base.BaseText value)
Sets the default dense layer.void
setDefaultNetwork(adams.core.base.BaseText value)
Sets the default network.void
setDefaultOutputLayer(adams.core.base.BaseText value)
Sets the default output layer.void
setDropOut(adams.core.base.BaseDouble[] value)
Sets the list of drop out values to choose from.void
setInsertBatchNormLayers(boolean value)
Sets whether to insert batchnorm layers after each layer.void
setL1(adams.core.base.BaseDouble[] value)
Sets the list of L1 values to choose from.void
setL2(adams.core.base.BaseDouble[] value)
Sets the list of L2 values to choose from.void
setLearningRate(adams.core.base.BaseDouble[] value)
Sets the list of learning rate values to choose from.void
setLearningRateScheduleDivisors(adams.core.base.BaseDouble[] value)
Sets the divisors to use for the learning rate schedule; not used if empty.void
setLearningRateScheduleEpochs(adams.core.base.BaseInteger[] value)
Sets the epochs to use for the learning rate schedule; not used if empty.void
setNumLayers(adams.core.base.BaseInteger[] value)
Sets the list of number of layers.void
setNumNetworks(int value)
Sets the maximum number of networks to generate.void
setNumNodes(adams.core.base.BaseInteger[] value)
Sets the list of node counts to choose from.void
setSeed(long value)
Sets the seed value.void
setUseRegularization(adams.core.base.BaseBoolean[] value)
Sets the list of regularization flags to choose from.String
useRegularizationTipText()
Returns the tip text for this property.-
Methods inherited from class adams.ml.cntk.modelgenerator.AbstractBrainScriptModelGenerator
getBrainScriptInfo
-
Methods inherited from class adams.ml.cntk.modelgenerator.AbstractModelGenerator
check, generate, getFlowContext, getQuickInfo, setFlowContext
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
INPUT_DIM
public static final String INPUT_DIM
the placeholder variable for the input dimension.- See Also:
- Constant Field Values
-
OUTPUT_DIM
public static final String OUTPUT_DIM
the placeholder variable for the output dimension.- See Also:
- Constant Field Values
-
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.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.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 interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.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 interfaceadams.core.Randomizable
- Parameters:
value
- the seed
-
getSeed
public long getSeed()
Returns the seed value.- Specified by:
getSeed
in interfaceadams.core.Randomizable
- Returns:
- the seed
-
seedTipText
public String seedTipText()
Returns the tip text for this property.- Specified by:
seedTipText
in interfaceadams.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 elementarray
- 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 classAbstractModelGenerator
- Parameters:
numInput
- the number of input nodesnumOutput
- the number of output nodes- Returns:
- the models
-
-