home *** CD-ROM | disk | FTP | other *** search
- inst4.0 ! Oct-09-90 (backprop.ins) BackProp Builder
- !****************************************************************
- !* *
- !* General Back-Propagation Network Builder *
- !* *
- !****************************************************************
- !
- ?&In 1
- >bge CheckOut
- @Err "Back-Propagation MUST have at least one input PE"
- :CheckOut
- ?BPAa 0 !check for auto-associative
- >beq Hetero1
- =&Out &In
- >br OutOK
- :Hetero1 !hetero-associative
- ?&Out 1
- >bge OutOK
- @Err "Back-Propagation MUST have at least one output PE"
- :OutOK
-
- ! *** Load the Control Strategy and LRS if needed ***
-
- ?BPFa 0
- >bne CS1
- @LdCS "backprop" !control strategy
- >br CS2
- :CS1
- @LdCS "bkpfast" !fast control strategy
- :CS2
- @LdLR "backprop" !Load Global Schedule
-
- =netn "Untitled"
- =DLnF 0 !learn re-display off
- =DRcF 0 !recall re-display off
-
- ! *** Build the Input Layer ***
-
- @LLdf !load default layer to mi_layer structure
- =LDln "In" !layer name
- =Lpes &In !copy # of input PEs from menu
- =Ltrn "Linear" !buffer
- ?BPGN 0 !Gaussian Noise?
- >beq GN1 !No
- =Lnse "Gaussian" !Yes
- :GN1
- =x 100 !place to put layer on screen
- =y 40
- #Incl "stdnwgtf.iif" !standard # weight fields
- @LAdd !add the input layer
-
- ! *** Build the functional link Layer if requested ***
-
- =n6 LayN !Index of Last "Input" (preprocessing) layer
- ?BPFu 0 !Functional Links requested?
- >beq FLnk1 !No
-
- ! Functional Link script is in separate file due to potential
- ! patent infringements. On exit from bckpfunc.iif", n6 must
- ! be equal to the index of the last pre-processing layer.
- !
- #Incl "bckpfunc.iif"
-
- :FLnk1
-
- ! *** Build Hidden Layers ***
-
- =n3 0 !hidden layer index
-
- :LayerLp !# Main build layer loop
- ?n3 0
- >bgt NotHd1
- +n3 1
- ?&Hd1 0
- >ble NotHd1
- =n4 &Hd1
- =BBLC H1LC
- >br BldLay
- :NotHd1
- ?n3 1
- >bgt NotHd2
- +n3 1
- ?&Hd2 0
- >ble NotHd2
- =n4 &Hd2
- =BBLC H2LC
- >br BldLay
- :NotHd2
- ?n3 2
- >bgt OutLay
- +n3 1
- ?&Hd3 0
- >ble OutLay
- =n4 &Hd3
- =BBLC H3LC
- :BldLay
-
- ?n4 0 !Check #PEs in hidden
- >ble OutLay !skip to output layer
-
- @LLdf !start with default layer again
- =LDln "Hidden" !layer name
- +LDln n3 !indexed by layer number
- =Lpes n4 !Number of PEs
- =Llrn BPLf !Learning Rule
- =Ltrn BPTf !Transfer function
- ?BPGN 0 !Gaussian Noise?
- >beq GN2 !No
- =Lnse "Gaussian" !Yes
- :GN2
- ?BPTE 0 !Tolerant Error?
- >beq TE1 !No
- =Lerf "tolerant" !Yes
- :TE1
- ?BPDS 0 !Use Default Schedule?
- >bne LRS1 !Yes
- @CrSc LDln !Create New Schedule
- =Llrs LDln !Point to it
- :LRS1
- +y 60 !up higher on display
- #Incl "stdnwgtf.iif" !standard # weight fields
- @LAdd
-
- >br LayerLp
-
- ! Now build output layer
- :OutLay
- @LLdf !start with default layer again
- =LDln "Out" !layer name
- =Lpes &Out !Number of PEs
- =n4 Lpes !Save for instruments
- =Llrn BPLf !Learning Rule
- ?BPLi 0 !Linear Output?
- >bne LinOut
- =Ltrn BPTf !Transfer function
- :LinOut
- ?BPGN 0 !Gaussian Noise?
- >beq GN3 !No
- =Lnse "Gaussian" !Yes
- :GN3
- ?BPTE 0 !Tolerant Error ?
- >beq TE2 !No
- =Lerf "tolerant" !Yes
- :TE2
- ?BPDS 0 !Use Default Schedule?
- >bne LRS2 !Yes
- =BBLC OPLC !Set up Learn Coefficient
- @CrSc LDln !Create New Schedule
- =Llrs LDln !Point to it
- :LRS2
- +y 60 !up higher on display
- #Incl "stdnwgtf.iif" !standard # weight fields
- @LAdd
- =n7 LayN !Output (highest) layer index
-
-
- !Now put in the Connections
- =cnwt 1.0 !connection weight
- =cnty WVar !Variable
- =cnsc WRel !Relative
- =n1 n6 !Initialize Outer Loop counter
- +n1 1 !First target layer
- =n3 n1 !remember first target layer
-
- :OutCnLp !Outer Connection Loop
- ?n1 n7
- >bgt EndConn !Connections Completed
-
- =n0 0 !init inner loop ctr to input layer
- =n2 n1 !Upper limit is
- -n2 1 !previous layer
- ?BPCP 0
- >bne InCnLp !connect all prior layers
- ?n1 n3 !First target layer?
- >beq InCnLp !connect all prior layers (may be func links)
- =n0 n2 !init inner loop ctr to prev. layer
-
- :InCnLp !Inner Connection Loop
- ?n0 n2
- >bgt EndInLp !Break out of inner loop
- =SPEl n1 !destination layer
- @SlPE !select as destination
- =NPEl n0 !source layer
- @NrPE !select as source
- @LCFl !full connections
-
- +n0 1 !Increment source layer
- >br InCnLp
-
- :EndInLp
- ?BPBi 0 !check for bias connections
- >beq NoBias
- =NPEl -1 !bias layer as source
- @NrPE !select as source
- @LCFl !full connections
- :NoBias
- +n1 1 !Increment destination layer
- >br OutCnLp
-
-
- :EndConn
-
- ! *** Select Control Strategy & L/R Schedule ***
-
- =LnPr 0 !no pruning
- @LLsl !load super layer
- ?BPFa 0
- >bne CS3
- =Lctl "backprop" !backprop control strategy
- >br CS4
- :CS3
- =Lctl "bkpfast" !fast backprop control strategy
- :CS4
- =Llrs "backprop" !backprop L/R Schedule
- =Llnn "train" !name of learn input
- =Lrcn "test" !name of recall output
- #Incl "stdioset.iif" !standard I/O settings
- ?Lax1 0 !has Aux1 been set up?
- >bgt Aux1Done !yes
- =Lax1 16 !nominal number of accumulations
- :Aux1Done
- ?BPAa 0 !check for auto-associative
- >beq Hetero2
- +Lflg LAAs !auto-associative network
- :Hetero2
- =Lscl -1.0 !input low-value
- =Loff 1.0 !input high-value
- =Llow -0.8 !output low-value
- =Lhgh 0.8 !output high-value
- =n5 -1.0 !Save for instrument limits
- =n6 1.0 !Save for instrument limits
- ?BPTf 4 !Is this a Sigmoid?
- >bne BiPolar !No, - assume bipolar
- =Lscl 0.0 !input low-value
- =Llow 0.2 !output low-value
- =n5 0.0 !Save for instrument limits
- =n6 1.0 !Save for instrument limits
- :BiPolar
- @SVsl !save it back
- !
- #Incl "stdprobe.iif" !Standard probe include file
- !
- =jogl -.1 !lower limit for jog
- =jogh +.1 !upper limit for jog
- =seed 257 !starting seed number
- @seed !set the seed
- @Nini !randomize the network
- @EOF
-
-