home *** CD-ROM | disk | FTP | other *** search
- inst4.0 ! (LVQ.ins) Linear Vector Quantization
- !*********************************************************************
- !* *
- !* Linear Vector Quantization (LVQ) Network Builder *
- !* *
- !*********************************************************************
- !
-
- ! *** check that input / output PE count is non-zero
-
- ?&In 1
- >bge InOK
- @Err "LVQ MUST have at least 1 input PE"
- :InOK
- ?&Hd1 1
- >bge Hid1OK
- @Err "LVQ MUST have at least 1 PE per category"
- :Hid1OK
- ?&Out 2
- >bge OutOK
- @Err "LVQ MUST have at least 2 output categories"
- :OutOK
-
- ! *** Load the Control Strategy and LRS if needed
-
- @LdCS "lvq" !control strategy
- @LdLR "lvq" !L/R schedule
-
- =netn "LVQ instanet
- =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
- =x 100 !place to put layer on screen
- =y 80
- =n3 5 !PE Spacing
- *n3 &Hd1
- *n3 &Out
- /n3 &In
- ?n3 1
- >bge n3OK
- =n3 1
- :n3OK
- =LDsp n3
- #Incl "stdnwgtf.iif" !standard # weight fields
- @LAdd !add the input layer
-
- ! *** Build the Kohonen Layer ***
-
- @LLdf !start with default layer again
- =LDln "Kohonen" !Kohonen layer
- =Lsum "lvq" !Summation Function
- =Lcmp "lvq" !Output Function
- =Llrn "lvq" !Learn Function
- =Llrs "lvq" !learning recall schedule
- =Lpes &Hd1 !Number of PE's = &Hd1 * &Out
- *Lpes &Out
- +y 100 !up higher on display
- =LDsp 5 !PE Spacing
- #Incl "stdnwgtf.iif" !standard # weight fields
- @LAdd
-
- ! *** Connect Kohonen Layer to Input Layer ***
-
- =SPEl 1 !Destination = Kohonen Layer
- @SlPE
- @NrPE
- =cnwt 0.0 !connection weight = 0.0
- =cnty WVar !fixed
- =NPEl 0 !Source = Input Layer
- @NrPE
- @LCFl !fully connect to input layer
-
- ! *** Add an Output Instrument between input & Kohonen Layers ***
-
- +x 100 !to right on display
-
- =SPEl 1 !Destination = Kohonen Layer
- @SlPE
- @NrPE
- =NPEl 0 !Source = Input Layer
- @NrPE
- =PNam NPEl !Write source layer number to name
- +PNam "->"
- +PNam SPEl !Append destination layer number to name
- @PbAS !Add Probe
- @PALC !Add Layer Connection to probe
-
- @ILdD !load default instrument
- =ITit "Layer " !Instrument title
- +ITit NPEl !Append source layer number to title
- +ITit "->" !Instrument title
- +ITit SPEl !Append destination layer number to title
- =Ivmn 0.
- =Ivmx 1.
- =Ignx &In
- =Inpl &In
- *Inpl &Hd1
- *Inpl &Out
-
- ! height and width:
- =Iwdt 100 !Width of graph
- =Ihgt 175 !height of graph
-
- =IGVr "Weight"
- =IGTy "Bar"
- =ITMd 0 !No transformation
- =IRcA 0 !Not active in recall
- =ILDv 10 !Every 10 iterations
- =IPrb PNam !Point to probe
- @IAdd
-
-
- ! *** Build the output layer ***
-
- =x 100
- @LLdf !load default layer to mi_layer structure
- =LDln "Out" !layer name
- =Lpes &Out !copy # of input PEs from menu
- =Lsum "sum" !Standard Summation Function
- =Ltrn "linear" !Transfer Function
- =Lcmp "direct" !Output Function
- +y 100 !up higher on display
- =LDsp 5 !PE Spacing
- *LDsp &Hd1
- #Incl "stdnwgtf.iif" !standard # weight fields
- @LAdd !add the output layer
- =n7 LayN !save for stdprobe
-
- ! *** Connect Kohonen Layer to Output Layer ***
-
- =cnwt 1.0 !connection weight = 1.0
- =cnty WFix !fixed
- =SPEl 2 !Destination = Output Layer
- =SPEn 0 !Output Layer PE index
- =NPEl 1 !Source = Kohonen Layer
- =NPEn 0 !Kohonen Layer PE index
- :L1
- =n1 0 !&Hd1 count
- :L2
- @SlPE !select next PE in output layer
- @NrPE !select next PE in Kohonen layer
- @PCon !Connect Kohonen PE to output PE
- +n1 1 !increment &Hd1 count
- +NPEn 1 !increment Kohonen Layer PE index
- ?n1 &Hd1 !check for loop end
- >blt L2
- +SPEn 1 !increment output Layer PE count
- ?SPEn &Out
- >blt L1
-
-
- ! *** Select Control Strategy & L/R Schedule ***
-
- @LLsl !load super layer
- =LDnd 3 !Force network display
- =Lctl "lvq" !control strategy
- =Llrs "lvq" !L/R Schedule
- #Incl "stdioset.iif" !standard I/O settings
- =Lscl 0 !input low-value
- =Loff 1 !input high-value
- =Llow 0. !output low-value
- =Lhgh 1. !output high-value
- @SVsl !save the super layer back
- !
- =n5 0.0
- =n6 1.0
- =n4 &Out
- #Incl "stdprobe.iif" !Standard probe include file
- !
- =LrnN 10000 !Learn N Value
- =jogl 0.0 !lower limit for jog
- =jogh +1.0 !upper limit for jog
- =seed 253 !starting seed number
- @seed !set the seed
- @Nini !Initialize the network
- @EOF
-
-