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 NetworkGeneratorm_GeneratorObjectthe loaded script object.protected adams.core.scripting.GroovyScriptm_InlineScriptthe 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 booleancanSetUpScript()Method for checking whether we can setUp the script.protected StringcheckScriptObject()Checks the script object.voiddefineOptions()Adds options to the internal list of options.voiddestroy()Frees up memory in a "destructive" non-reversible way.protected ai.djl.nn.BlockdoGenerate(ai.djl.basicdataset.tabular.TabularDataset dataset)Generates the network using the supplied dataset.protected adams.core.scripting.GroovyScriptgetDefaultInlineScript()Returns the default inline script.adams.core.scripting.GroovyScriptgetInlineScript()Gets the inline script to use instead of the external script file.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.StringglobalInfo()Returns a string describing the object.protected StringinitScriptObject()Tries to initialize the scripts object, sets its options and performs some checks.StringinlineScriptTipText()Returns the tip text for this property.protected StringloadScriptObject()Loads the scripts object and sets its options.booleanrequiresFlowContext()Returns whether flow context is required.StringscriptOptionsTipText()Returns the tip text for this property.voidsetInlineScript(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:
globalInfoin interfaceadams.core.GlobalInfoSupporter- Specified by:
globalInfoin 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:
defineOptionsin interfaceadams.core.option.OptionHandler- Overrides:
defineOptionsin classAbstractScriptedNetworkGenerator
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceadams.core.QuickInfoSupporter- Overrides:
getQuickInfoin classAbstractScriptedNetworkGenerator- Returns:
- null if no info available, otherwise short string
-
scriptOptionsTipText
public String scriptOptionsTipText()
Returns the tip text for this property.- Specified by:
scriptOptionsTipTextin interfaceadams.core.scripting.FileBasedScriptingWithOptions- Overrides:
scriptOptionsTipTextin 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:
loadScriptObjectin classAbstractScriptedNetworkGenerator- Returns:
- null if OK, otherwise the error message
-
checkScriptObject
protected String checkScriptObject()
Checks the script object.- Specified by:
checkScriptObjectin classAbstractScriptedNetworkGenerator- Returns:
- null if OK, otherwise the error message
-
canSetUpScript
protected boolean canSetUpScript()
Method for checking whether we can setUp the script.- Overrides:
canSetUpScriptin 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:
initScriptObjectin classAbstractScriptedNetworkGenerator- Returns:
- null if OK, otherwise the error message
-
requiresFlowContext
public boolean requiresFlowContext()
Returns whether flow context is required.- Specified by:
requiresFlowContextin interfaceNetworkGenerator- Overrides:
requiresFlowContextin 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:
doGeneratein 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:
destroyin interfaceadams.core.Destroyable- Overrides:
destroyin classAbstractScriptedNetworkGenerator
-
-