Package adams.data.djl.networkgenerator
Class GroovyGenerator
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.djl.networkgenerator.AbstractNetworkGenerator
-
- adams.data.djl.networkgenerator.AbstractScriptedNetworkGenerator
-
- adams.data.djl.networkgenerator.GroovyGenerator
-
- 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.scripting.FileBasedScripting
,adams.core.scripting.FileBasedScriptingWithOptions
,adams.core.SizeOfHandler
,NetworkGenerator
,adams.flow.core.FlowContextHandler
,Serializable
public class GroovyGenerator extends AbstractScriptedNetworkGenerator
Uses Groovy to generate the network.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected NetworkGenerator
m_GeneratorObject
the loaded script object.protected adams.core.scripting.GroovyScript
m_InlineScript
the inline script.-
Fields inherited from class adams.data.djl.networkgenerator.AbstractScriptedNetworkGenerator
m_ScriptFile, m_ScriptObject, m_ScriptOptions
-
Fields inherited from class adams.data.djl.networkgenerator.AbstractNetworkGenerator
m_FlowContext
-
-
Constructor Summary
Constructors Constructor Description GroovyGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canSetUpScript()
Method for checking whether we can setUp the script.protected String
checkScriptObject()
Checks the script object.void
defineOptions()
Adds options to the internal list of options.void
destroy()
Frees up memory in a "destructive" non-reversible way.protected ai.djl.nn.Block
doGenerate(ai.djl.basicdataset.tabular.TabularDataset dataset)
Generates the network using the supplied dataset.protected adams.core.scripting.GroovyScript
getDefaultInlineScript()
Returns the default inline script.adams.core.scripting.GroovyScript
getInlineScript()
Gets the inline script to use instead of the external script file.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
globalInfo()
Returns a string describing the object.protected String
initScriptObject()
Tries to initialize the scripts object, sets its options and performs some checks.String
inlineScriptTipText()
Returns the tip text for this property.protected String
loadScriptObject()
Loads the scripts object and sets its options.protected boolean
requiresFlowContext()
Returns whether flow context is required.String
scriptOptionsTipText()
Returns the tip text for this property.void
setInlineScript(adams.core.scripting.GroovyScript value)
Sets the inline script to use instead of the external script file.-
Methods inherited from class adams.data.djl.networkgenerator.AbstractScriptedNetworkGenerator
check, getScriptFile, getScriptOptions, reset, scriptFileTipText, setScriptFile, setScriptOptions
-
Methods inherited from class adams.data.djl.networkgenerator.AbstractNetworkGenerator
generate, getFlowContext, setFlowContext
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_GeneratorObject
protected transient NetworkGenerator m_GeneratorObject
the loaded script object.
-
m_InlineScript
protected adams.core.scripting.GroovyScript m_InlineScript
the inline script.
-
-
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 classAbstractScriptedNetworkGenerator
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceadams.core.QuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractScriptedNetworkGenerator
- Returns:
- null if no info available, otherwise short string
-
scriptOptionsTipText
public String scriptOptionsTipText()
Returns the tip text for this property.- Specified by:
scriptOptionsTipText
in interfaceadams.core.scripting.FileBasedScriptingWithOptions
- Overrides:
scriptOptionsTipText
in classAbstractScriptedNetworkGenerator
- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getDefaultInlineScript
protected adams.core.scripting.GroovyScript getDefaultInlineScript()
Returns the default inline script.- Returns:
- the default script
-
setInlineScript
public void setInlineScript(adams.core.scripting.GroovyScript value)
Sets the inline script to use instead of the external script file.- Parameters:
value
- the inline script
-
getInlineScript
public adams.core.scripting.GroovyScript getInlineScript()
Gets the inline script to use instead of the external script file.- Returns:
- the inline script
-
inlineScriptTipText
public String inlineScriptTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
loadScriptObject
protected String loadScriptObject()
Loads the scripts object and sets its options.- Specified by:
loadScriptObject
in classAbstractScriptedNetworkGenerator
- Returns:
- null if OK, otherwise the error message
-
checkScriptObject
protected String checkScriptObject()
Checks the script object.- Specified by:
checkScriptObject
in classAbstractScriptedNetworkGenerator
- Returns:
- null if OK, otherwise the error message
-
canSetUpScript
protected boolean canSetUpScript()
Method for checking whether we can setUp the script.- Overrides:
canSetUpScript
in classAbstractScriptedNetworkGenerator
- Returns:
- true if it can be setUp
-
initScriptObject
protected String initScriptObject()
Tries to initialize the scripts object, sets its options and performs some checks.- Overrides:
initScriptObject
in classAbstractScriptedNetworkGenerator
- Returns:
- null if OK, otherwise the error message
-
requiresFlowContext
protected boolean requiresFlowContext()
Returns whether flow context is required.- Overrides:
requiresFlowContext
in classAbstractNetworkGenerator
- Returns:
- true if required
-
doGenerate
protected ai.djl.nn.Block doGenerate(ai.djl.basicdataset.tabular.TabularDataset dataset)
Generates the network using the supplied dataset.- Specified by:
doGenerate
in classAbstractNetworkGenerator
- Parameters:
dataset
- the dataset to generate the network for- Returns:
- the network
-
destroy
public void destroy()
Frees up memory in a "destructive" non-reversible way.- Specified by:
destroy
in interfaceadams.core.Destroyable
- Overrides:
destroy
in classAbstractScriptedNetworkGenerator
-
-