Macros & Scripts

Macros & Scripts

Macros.

 

Macros are recorded while EasyNN-plus is being used.   Recording is started with Record on the Macro menu or Ctrl + F2.   Recording is stopped using Stop recording on the Macro menu or Ctrl + F3. EasyNN-plus macros are text files with the .ens extension.   Functions are fully recorded when possible but some are only partially recorded or they are nested within other functions.   The right click, grid pre-processing functions are not recorded.

 

Script Commands can be added to macros using Commands on the macro menu.   Recording can be continued after adding script commands or recording can be stopped and the commands can be played immediately.   Multiple script commands are separated with a ; character.   For example, if the line f; stl; fps(0,0,1,100) is entered it will be split into three separate script commands in the macro.   If the macro is then played back the commands will cause the currently open network to forget learning, start learning and then stop learning after 100 cycles.   Alternatively recording can be stopped and the commands played by adding three colon characters.   The example would become f; stl; fps(0,0,1,100); ::: .

 

Whole scripts can be added to macros using Add Expanded Script on the Macro menu.   The selected script file will be expanded into its original format and then each command will be added to the macro.   Recording can be continued after adding an expanded script file.

 

A script file can be added at the end of a macro using Add Script File on the macro menu.   This will put a RunScriptFile(script file); command into the macro.   When the macro is played back it will play the recorded functions and script commands.   It will then run the script file and terminate the macro.

 

Playback is started using Play on the Macro menu, Ctrl + F4 or using Run Script File on the File menu.   Macro files can also be passed to EasyNN-plus as a parameter in the same way as script files.

 

A macro called specscr.ens is included in the Samples folder that creates a network similar to the Species.tvq sample.

 

Scripts.

 

EasyNN-plus scripts are text files with .ens or .txt extensions and can be edited with any text editor.   Script files can be loaded and run from within EasyNN-plus using Run Script File on the File menu.   They can also be passed to EasyNN-plus as a parameter.

 

Scripts can contain commands to import the data, build the neural network, control learning, validating and querying.

 

Warning:         Script commands call low level functions.   The command parameters are validated but some error checking has to be disabled so that the scripts will run.   All scripts should be designed and tested very carefully.   Script commands that will overwrite existing files should only be used when backup files are available.

 

Script files based on the currently loaded network can be produced using Generate Script File on the File menu.   The generated files will contain commands to create the grid columns and set the network controls.   Commands to create the grid rows, import the data and build the neural network can then be added.

 

Scripts can be tested by stepping through them one line at a time.   Start the script with an ess command to enable single step mode.

 

The pause command can be used to temporarily stop and exit from a script.   When the script is restarted it will run from the line after the pause.

 

The commands and error messages that are produced while running the script can be directed to a log file by including the lsc command in the script.   The script will stop if the lsc command fails to open the log file.

 

The name of a script file can be passed as an EasyNN-plus parameter in the command line.

 

This test line shows how to call EasyNN-plus from Start > Run.

 

"C:\Program Files\EasyNN-plus\EasyNN.exe"   "C:\Program Files\EasyNN-plus\Samples\ascript.txt"

 

The script imports atest.txt and uses it to create a network.   The files ascript.txt and atest.txt are included in the Samples folder.

 

 

Macro and Script Commands.

 

Comments: Lines starting with any non alpha character can be used for comments.

 

Parameters:

 

String parameters are checked to be valid strings.

Integer and double parameters are checked to be within the valid range.

Bit parameters are checked to be 0 (false) or above 0 (true).

Macro parameters are produced while recording.

 

Macro functions can be included in Scripts but they must be tested very carefully.   Script command names are shown in black, macro function names are shown in red.   When a macro function has exactly the same parameters as a script command it is listed below the command.   All macro functions are case sensitive.   Script commands in full or as short names can be in any case.

 

 

AddCol                                       Adds a column

 

                  bit                   Ask (ignored)

                  bit                   Output

                  bit                   New column

 

 

AddRow                                       Adds a row        

       

                  bit                   Ask (ignored)

                  int                   Type

                  bit                   Head

                  bit                   Modified

 

 

autosave                                       Set AutoSave        

as

 

                  string           File base name

                  int                   Cycles per save

                  bit                   Save if lower error

                  bit                   Save if validating results improve

 

 

autosaveassociationsfile

asas

AutoSaveAssociationsFile

 

                  string         File name

 

 

autosaveclustersfile

ascl

AutoSaveClustersFile

 

                  string         File name

 

 

backto                                       Go back to label

bt                                      

 

                  string           Label

                  int                   Repeats

 

        Warning:         Only one backto or bt command is allowed in a script.

 

 

createcolumns                             Creates columns        

cc

 

                  int                   Number of columns

 

 

ChangeNetwork                             Increase nodes        

 

                  int                   Number of nodes to add to hidden layer

                  int                   Hidden layer number 1, 2 or 3

 

 

ChangeRows                                       Change rows

 

                  int                   Change to; 0 Training, 1 Validating, 2 Querying, 3 Excluded

                  int                   First row to change

                  int                   Number of rows to change

 

clipcolumn                                       Clip column

clc

 

                  int                   Column number

                  bit                   Cut clipped column

 

 

cliprow                                       Clip row

clr

 

                  int                   Row number

                  bit                   Cut clipped row

 

 

Close                                                 Closes the application                    

 

 

CloseDocument                             Closes the document

 

 

columntypeandmode                     Set columns type and mode

ctm

SetColumnsTypeAndMode                  

 

                  int                   First column to set

                  int                   Number of columns to set

                  int                   Type; 0 Input, 1 Output, 2 Exclude, 3 Serial

                  int                   Mode; 0 Real, 1 Integer, 2 Bool, 3 Text, 4 Image

 

 

CompleteEditGrid                             Complete edit grid cell        

 

                  int                   Column

                  int                   Row

                  double         Value

                  string           String value

                  int                   Mode

                  int                   Type

 

 

createnetwork                             Creates a network from the Grid

cn

 

                  int                   Nodes in hidden layer 1

                  int                   Nodes in hidden layer 2

                  int                   Nodes in hidden layer 3

                  bit                   Optimize hidden layer 1

                  bit                   Optimize hidden layer 2

                  bit                   Optimize hidden layer 3

 

 

createrows                                       Creates rows

cr

 

                  int                   Number of rows

 

 

DeleteCol                                       Deletes a column

 

                  int                   Column

                  bit                   Ask (ignored)

 

 

DeleteRow                                       Deletes a row        

 

                  int                   Row

                  bit                   Ask (ignored)

                  bit                   Modified

                  bit                   Duplicate

                  bit                   Scale

 

 

disableresults                             Disable results columns

dr

 

                  int                   First column

                  int                   Number of columns

 

 

disablesinglestep                             Disable single step

dss

 

 

EditCopy                                       Copy selection to clipboard

 

                  int                   Column

                  int                   Row

 

 

EditCut                                       Cut selection to clipboard        

 

                  int                   Column

                  int                   Row

 

 

EditGrid                                       Edit grid cell

 

                  int                   Column

                  int                   Row

                  int                   Type

                  string           Column name

                  string           Row name

 

 

EditPaste                                       Paste from clipboard        

 

                  bit                   Column clipped

                  int                   Column

                  bit                   Row clipped

                  int                   Row

 

 

endofscript                                       End of script

eos

 

 

enableresults                             Enable results columns

er

 

                  int                   First column

                  int                   Number of columns

 

 

enablesinglestep                             Enable single step

ess

 

 

exit                                                 Exit        

x

 

                  bit                   Prompt to save

 

 

extendrange                             Extend the training range                                                          

exr

ExtendRange                            

 

                  int                   Column

                  double         Value

 

 

forget                                                 Forget

f

 

                  bit                   Restart random number sequence

 

 

ForgetLearning                             Forget        

 

                  bit                   Ask

                  bit                   Restart

                  bit                   Reset errors

                  bit                   ReSeed

                  double         Range

 

 

fixedperiodstops                             Set fixed period stops

fps

SetFixedStops

 

                  bit                   Stop after seconds

                  double         Seconds

                  bit                   Stop after cycles

                  int                   Cycles

 

 

importbinaryfile                             Import binary file

ibf

SetImportBinaryFile                            

 

                  string           File name

                  int                   Initial bytes to skip

                  int                   Bytes per column

                  int                   Columns per row

 

 

ignoreerrors                                       Ignore errors

ie

 

                  bit                   Cancel

 

importimagefiles                             Import bitmap image files

iif

ImportImageFiles

 

                  string         Path to folder

                  string         File name

                  int                   First column

                  int                   First row

                  bit                   Import all bitmaps in folder

                  string         Prefix                            

 

 

importtextfile                             Import text file                                                          

itf

ImportTextFile

 

                  string           File to import

                  bit                   Use first line as column names

                  bit                   Use first word(s) on line for row names

                  bit                   Tab delimiters

                  bit                   Comma delimiters

                  bit                   Space delimiters

                  bit                   Stop (period) delimiters

                  bit                   Colon delimiters

                  bit                   Semicolon delimiters

                  bit                   Initialize Grid for text and image modes

 

 

importxlsfile                                       Import XLS file

ixf

ImportXLSFile                            

 

                  string           File to import

                  string           Sheet name

                  bit                   Set column names from first row

                  bit                   Set row names from first column