Kernel File Interface
The ASCII Network File Format
The ASCII representation of a network consists of the following parts:
-
a header, which contains information about the net
-
the definition of the teaching function
-
the definition of the sites
-
the definition of cell types
-
the definition of the default values for cells
-
the enumeration of the cells with all their characteristics
-
the list of connections
-
a list of subnet numbers
-
a list of layer numbers
All parts, except the header and the enumeration of the cells, may be omitted. Each part may also be empty. It then consists only of the part title, the header line and the boarder marks (e.g.: ----|---|------).
Entries in the site definition section do not contain any empty columns. The only empty column in the type definition section may be the sites column, in which case the cells of this type do not have sites.
Entries in the unit definition section have at least the columns no. (cell number) and position filled. The entries (rows) are sorted by increasing cell number. If column typeName is filled, the columns act func, out func, and sites remain empty.
Entries in the connection definition section have all columns filled. The respective cell does not have a site, if the column site is empty. The entries are sorted by increasing number of the target cell (column target). Each entry may have multiple entries in the column sources. In this case, the entries (number of the source cell and the connection strength) are separated by a comma and a blank, or by a comma and a newline (see example in the Appendix B).
The file may contain comment lines. Each line beginning with # is skipped by the SNNS-kernel.
Form of the Network File Eries
Columns are separated by the string " " (without ") . A row never exceeds 250 characters.
Strings may have arbitrary length. The compiler determines the length of each row containing strings (maximum string length + 2). Within the columns, the strings are stored left adjusted. Strings may not contain blanks, but all special characters except |. The first character of a string has to be a letter.
Integers may have an arbitrary number of digits. Cell numbers arealways positive and not zero. Position coordinates may be positive or negative. The compiler determines the length of each row containing integers (maximum digit number + 2). Within the columns, the numbers are stored right adjusted.
Floats are always stored in fixed length with the format Vx.yyyyy, where V is the sign (+, - or blank), x is 0 or 1 and y is the rational part (5 digits behind the decimal point).
Rows containing floats are therefore always 10 characters long (8 + 1 blank on each side).
If a row contains several sites in the type or unit definition section, they are wri ten below each other. They are separated in the following way: Directly after the first site fo lows a comma and a newline \n. The next line starts with an arbitrary number of blanks or tabs in front of the next site.
The source of a connection is described by a pair, the cell number and the strength of the connection. It always has the format nnn:Vx.yyyyy with the following meaning:
-
nnn Number of the source
-
Vx.yyyyy Strength of the connection as a float value (format as discribed above)
The compiler determines the width of the column nnn by the highest cell number present. The cell numbers are written into the column right adjusted (according to the rules for integers). The column Vx.yyyyy has fixed width. Several source pairs in an entry to the connection definition section/ are separated by a comma and a blank. If the list of source pairs exceeds the length of one line, the line has to be parted after the following rule:
-
Separation is always between pairs, never within them.
-
The comma between pairs is always directly behind the last pair,i.e. remains in the old line.
After a newline (\n) an arbitrary number of blanks or tabs may precede the next pair.
Grammar of the Network Files
Lexical Elements of the Grammar
The lexical elements of the grammar which defines network files are listed as regular expresions. The first column lists the name of the symbol, the second the regular expresion defining it. The third column may contain comments.
-
All terminals (characters) are put between ". . .".
-
Elements of sets are put between square brackets. Within the brackets, the characters represent themselves (even without ", and - defines a range of values. The class of digits is defined, e.g. as ["0"-"9"].
-
Characters can be combined into groups with parenteses ().
-
x* means, that the character or group x can occur zero or more times.
-
x+ means, that the character or group x must occur at least once, but may occur several times.
-
x? means, that x can be omitted.
-
x{n} means, that x has to occur exactly n times.
-
x|y means, that either x or y has to occur.
-
*, + and {} bind
-
strongest, ? is second, | binds weakest.
-
Groups or classes of characters are treated like a single character with respect to priority.
Definition of the Grammar
The Grammar defining the interface is listed in a special form of EBNF.
-
Parts between square brackets [] are facultative.
-
| separates alternatives (like with terminal symbols).
-
{x} means, that x may occur zero or more times.
-
CSTRING is everything that is recognized as string by the C programming language.
Terminal Symbols
WHITESPACE {" "|"\n"|"\t"} /* whitespaces */
BLANKS_TABS {" "|"\t"} /* only blanks or tabs */
W_COL_SEP (" "|"\n"|"\t") {" "|"\n"|"\t"} "|" {" "|"\n"|"\t"}
/* at least one blank and the column separation */
COL_SEP {" "|"\n"|"\t"} "|" {" "|"\n"|"\t"} /* column separation */
COMMA {" "|"\n"|"\t"} "," {" "|"\n"|"\t"} /* at least the comma */
EOL {" "|"\n"|"\t"} "\n" {" "|"\n"|"\t"} /* at least "\n" */
CUT {" "|"\n"|"\t"} (" "|"\n"|"\t") {" "|"\n"|"\t"}
/* at least a blank, "\t", or "\n" */
COLON ":"
/* separation lines for different tables */
TWO_COLUMN_LINE "-"+"|""-"+
THREE_COLUMN_LINE "-"+"|""-"+"|""-"+
FOUR_COLUMN_LINE "-"+"|""-"+"|""-"+"|""-"+
SIX_COLUMN_LINE "-"+"|""-"+"|""-"+"|""-"+"|""-"+"|""-"+
SEVEN_COLUMN_LINE "-"+"|""-"+"|""-"+"|""-"+"|""-"+"|""-"+"|""-"+
TEN_COLUMN_LINE "-"+"|""-"+"|""-"+"|""-"+"|""-"+"|""-"+"|""-"+
"|""-"+"|""-"+"|""-"+
COMMENT {{" "|"\n"|"\t"} "#" CSTRING "\n" {" "|"\n"|"\t"}}
VERSION "V1.4-3D" | "V2.1" | "V3.0" /* version of SNNS */
SNNS "SNNS network definition file" /* output file header */
/* eleven different headers */
GENERATED_AT "generated at"
NETWORK_NAME "network name :"
SOURCE_FILES "source files"
NO.OF_UNITES "no. of unites :"
NO.OF_CONNECTIONS "no. of connections :"
NO.OF_UNIT_TYPES "no. of unit types :"
NO.OF_SITE_TYPES "no. of site types :"
LEARNING_FUNCTION "learning function :"
PRUNING_FUNCTION "pruning function :"
FF_LEARNING_FUNCTION "subordinate learning function :"
UPDATE_FUNCTION "update function :"
/* titles of the different sections */
UNIT_SECTION_TITLE "unit definition section"
DEFAULT_SECTION_TITLE "unit default section"
SITE_SECTION_TITLE "site definition section"
TYPE_SECTION_TITLE "type definition section"
CONNECTION_SECTION_TITLE "connection definition section"
LAYER_SECTION_TITLE "layer definition section"
SUBNET_SECTION_TITLE "subnet definition section"
TRANSLATION_SECTION_TITLE "3D translation section"
TIME_DELAY_SECTION_TITLE "time delay section"
/* column-titles of the different tables */
NO "no."
TYPE_NAME "type name"
UNIT_NAME "unit name"
ACT "act"
BIAS "bias"
ST "st"
POSITION "position"
SUBNET "subnet"
LAYER "layer"
ACT_FUNC "act func"
OUT_FUNC "out func"
SITES "sites"
SITE_NAME "site name"
SITE_FUNCTION "site function"
NAME "name"
TARGET "target"
SITE "site"
SOURCE:WEIGHT "source:weight"
UNIT_NO "unitNo."
DELTA_X "delta x"
DELTA_Y "delta y"
Z "z"
LLN "LLN"
LUN "LUN"
TROFF "Troff"
SOFF "Soff"
CTYPE "Ctype"
INTEGER ["0"-"9"]+ /*integer */
SFLOAT ["+" | " " | "-"] ["1" | "0"] "." ["0"-"9"]{5} /*signed float*/
STRING ("A"-"Z" | "a"-"z" | "|")+ /*string */
Grammar:
out_file ::= file_header sections
file_header := WHITESPACE COMMENT h_snns EOL COMMENT h_generated_at EOL
COMMENT h_network_name EOL COMMENT h_source_files EOL
COMMENT h_no.of_unites EOL COMMENT h_no.of_connections EOL
COMMENT h_no.of_unit_types EOL COMMENT h_no.of_site_types EOL
COMMENT h_learning_function EOL COMMENT h_update_function EOL
COMMENT h_pruning_function EOL
COMMENT ff_learning_function EOL
/* parts of the file-header */
h_snns ::= SNNS BLANKS_TABS VERSION
h_generated_at ::= GENERATED_AT BLANKS_TABS CSTRING
h_network_name ::= NETWORK_NAME BLANKS_TABS STRING
h_source_files ::= SOURCE_FILES [BLANKS_TABS COLON BLANKS_TABS CSTRING]
h_no.of_unites ::= NO.OF_UNITES BLANKS_TABS INTEGER
h_no.of_connections ::= NO.OF_CONNECTIONS BLANKS_TABS INTEGER
h_no.of_unit_types ::= NO.OF_UNIT_TYPES BLANKS_TABS INTEGER
h_no.of_site_types ::= NO.OF_SITE_TYPES BLANKS_TABS INTEGER
h_learning_function ::= LEARNING_FUNCTION BLANKS_TABS STRING
h_pruning_function ::= PRUNING_FUNCTION BLANKS_TABS STRING
h_ff_learning_function ::= FF_LEARNING_FUNCTION BLANKS_TABS STRING
h_update_function ::= UPDATE_FUNCTION BLANKS_TABS STRING
sections ::= COMMENT unit_section [COMMENT default_section]
[COMMENT site_section] [COMMENT type_section]
[COMMENT subnet_section] [COMMENT conn_section]
[COMMENT layer_section] [COMMENT trans_section]
[COMMENT time_delay_section] COMMENT
/* unit default section */
default_section ::= DEFAULT_SECTION_TITLE CUT COMMENT WHITESPACE
default_block
default_block ::= default_header SEVEN_COLUMN_LINE EOL
{COMMENT default_def} SEVEN_COLUMN_LINE EOL
default_header ::= ACT COL_SEP BIAS COL_SEP ST COL_SEP SUBNET COL_SEP
LAYER COL_SEP ACT_FUNC COL_SEP OUT_FUNC CUT
default_def ::= SFLOAT W_COL_SEP SFLOAT W_COL_SEP STRING W_COL_SEP
INTEGER W_COL_SEP INTEGER W_COL_SEP STRING W_COL_SEP
STRING CUT
/* site definition section */
site_section ::= SITE_SECTION_TITLE CUT COMMENT WHITESPACE site_block
site_block ::= site_header TWO_COLUMN_LINE EOL {COMMENT site_def}
TWO_COLUMN_LINE EOL
site_header ::= SITE_NAME SITE_FUNCTION CUT
site_def ::= STRING W_COL_SEP STRING CUT
/* type definition section */
type_section ::= TYPE_SECTION_TITLE CUT COMMENT WHITESPACE type_block
type_block ::= type_header FOUR_COLUMN_LINE EOL {COMMENT type_def}
FOUR_COLUMN_LINE EOL
type_header ::= NAME COL_SEP ACT_FUNC COL_SEP OUT_FUNC COL_SEP SITES
CUT
type_def ::= STRING W_COL_SEP STRING W_COL_SEP STRING W_COL_SEP
[{STRING COMMA} STRING] CUT
/* subnet definition section */
subnet_section ::= SUBNET_SECTION_TITLE CUT COMMENT WHITESPACE
subnet_block
subnet_block ::= subnet_header TWO_COLUMN_LINE EOL {COMMENT subnet_def}
TWO_COLUMN_LINE EOL
subnet_header ::= SUBNET COL_SEP UNIT_NO CUT
subnet_def ::= INTEGER W_COL_SEP {INTEGER COMMA} INTEGER CUT
/* unit definition section /*
unit_section ::= UNIT_SECTION_TITLE CUT COMMENT WHITESPACE unit_block
unit_block ::= unit_header TEN_COLUMN_LINE EOL {COMMENT unit_def}
TEN_COLUMN_LINE EOL
unit_header ::= NO COL_SEP TYPE_NAME COL_SEP UNIT_NAME COL_SEP
ACT COL_SEP BIAS COL_SEP ST COL_SEP POSITION COL_SEP
ACT_FUNC COL_SEP OUT_FUNC COL_SEP SITES CUT
unit_def ::= INTEGER W_COL_SEP ((STRING W_COL_SEP) | COL_SEP)
((STRING W_COL_SEP) | COL_SEP) ((SFLOAT W_COL_SEP) | COL_SEP)
((SFLOAT W_COL_SEP) | COL_SEP) ((STRING W_COL_SEP) | COL_SEP)
INTEGER COMMENT INTEGER COMMENT INTEGER W_COL_SEP
((STRING W_COL_SEP) | COL_SEP) ((STRING W_COL_SEP) | COL_SEP)
[{STRING COMMA} STRING]
/* connection definition section */
connection_section ::= CONNECTION_SECTION_TITLE CUT
COMMENT WHITESPACE connection_block
connection_block ::= connection_header THREE_COLUMN_LINE EOL
{COMMENT connection_def} THREE_COLUMN_LINE EOL
connection_header ::= TARGET COL_SEP SITE COL_SEP SOURCE:WEIGHT CUT
connection_def ::= ((INTEGER W_COL_SEP) | COL_SEP) STRING W_COL_SEP
{INTEGER WHITESPACE COLON WHITESPACE SFLOAT COMMA}
INTEGER WHITESPACE COLON WHITESPACE SFLOAT CUT
/* layer definition section */
layer_section ::= LAYER_SECTION_TITLE CUT COMMENT WHITESPACE layer_block
layer_block ::= layer_header TWO_COLUMN_LINE EOL {COMMENT layer_def}
TWO_COLUMN_LINE EOL
layer_header ::= LAYER COL_SEP UNIT_NO CUT
layer_def ::= INTEGER W_COL_SEP {INTEGER COMMENT} INTEGER CUT
/* 3D translation section */
translation_section ::= TRANSLATION_SECTION_TITLE CUT
COMMENT WHITESPACE translation_block
translation_block ::= translation_header THREE_COLUMN_LINE EOL
{COMMENT translation_def} THREE_COLUMN_LINE EOL
translation_header ::= DELTA_X COL_SEP DELTA_Y COL_SEP Z CUT
translation_def ::= INTEGER W_COL_SEP INTEGER W_COL_SEP INTEGER
/* time delay section */
td_section ::= TIME_DELAY_SECTION_TITLE CUT COMMENT WHITESPACE
td_block
td_block ::= td_header SIX_COLUMN_LINE EOL {COMMENT td_def}
SIX_COLUMN_LINE EOL
td_header ::= NO COL_SEP LLN COL_SEP LUN COL_SEP
TROFF COL_SEP SOFF COL_SEP CTYPE CUT
td_def ::= INTEGER W_COL_SEP INTEGER W_COL_SEP INTEGER W_COL_SEP
INTEGER W_COL_SEP INTEGER W_COL_SEP INTEGER W_COL_SEP
Grammar of the Pattern Files
The typographic conventions used for the pattern file grammar are the same as for the network file grammar (see section A.3.1.1).
Terminal Symbols
WHITE {" " | "\t"}
FREE {^"\n"} /* anything up to EOL */
COMMENT "#" FREE "\n"
L_BRACKET "["
R_BRACKET "]"
INT ["0"-"9"]
V_NUMBER [Vv]{INT}+"."{INT}+ /* version number */
NUMBER [-+]?{{INT}+ | {INT}+{EXP} |{INT}+"."{INT}*({EXP})? |
{INT}*"."{INT}+({EXP})?}
EXP [Ee][-+]?{INT}+
VERSION_HEADER "SNNS pattern definition file"
GENERATED_AT "generated at" {FREE}* "\n"
NO_OF_PATTERN "No. of patterns" {WHITE}* ":"
NO_OF_INPUT "No. of input units" {WHITE}* ":"
NO_OF_OUTPUT "No. of output units" {WHITE}* ":"
NO_OF_VAR_IDIM "No. of variable input dimensions" {WHITE}* ":"
NO_OF_VAR_ODIM "No. of variable output dimensions" {WHITE}* ":"
MAXIMUM_IDIM "Maximum input dimensions" {WHITE}* ":"
MAXIMUM_ODIM "Maximum output dimensions" {WHITE}* ":"
NO_OF_CLASSES "No. of classes" {WHITE}* ":"
CLASS_REDISTRIB "Class redistribution" {WHITE}* ":"
REMAPFUNCTION "Remap function" {WHITE}* ":"
REMAP_PARAM "Remap parameters" {WHITE}* ":"
Grammar
pattern_file ::= header pattern_list
header ::= VERSION_HEADER V_NUMBER GENERATED_AT NO_OF_PATTERN
NUMBER
i_head [o_head] [vi_head] [vo_head] [cl_head] [rm_head]
i_head ::= NO_OF_INPUT NUMBER
o_head ::= NO_OF_OUTPUT NUMBER
vi_head ::= NO_OF_VAR_IDIM NUMBER MAXIMUM_IDIM actual_dim
vo_head ::= NO_OF_VAR_ODIM NUMBER MAXIMUM_ODIM actual_dim
cl_head ::= NO_OF_CLASSES NUMBER [cl_distrib]
rm_head ::= REMAPFUNCTION NAME [rm_params]
actual_dim ::= L_BRACKET actual_dim_rest R_BRACKET |
L_BRACKET R_BRACKET
actual_dim_rest ::= NUMBER | actual_dim_rest NUMBER
cl_distrib ::= CLASS_REDISTRIB L_BRACKET paramlist R_BRACKET
rm_params ::= REMAP_PARAM L_BRACKET paramlist R_BRACKET
paramlis ::= NUMBER | paramlist NUMBER
pattern_list ::= pattern | pattern_list pattern
pattern ::= pattern_start pattern_body pattern_class
pattern_start ::= [actual_dim]
pattern_body ::= NUMBER | pattern_body NUMBER
pattern_class ::= NUMBER | NAME
Last change:
Igor Fischer, Thu May 16 14:13:36 2002 GMT Page 11: JavaNNS-manual-10.html © 2001-2002 Universität Tübingen
|