inst4.0		!01-Jun-89  (hamming.ins) Hamming Network Builder
!****************************************************************
!*								*
!*	Hamming Network Generator				* 
!*								*
!****************************************************************

!	*** check that input / output PE count is non-zero

?&In	1
>bge	CheckOut
@Err	"Hamming Network MUST have at least one input PE"
:CheckOut
?&Out	1
>bge	OutOK
@Err	"Hamming Network MUST have at least one output PE"
:OutOK

!	*** Load the Control Strategy and LRS if needed

@LdCS	"hamming"		!control strategy
@LdLR	"hamming"		!L/R schedule

=netn	"InstaNet (tm) Hamming Network version 2.00 01-Jun-89"
=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	"Signum"		! input -1's and 1's
=x	100			!place to put layer on screen
=y	60
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd				!add the input layer

!	*** Build the Category layer - use lateral inhibition ***

@LLdf				!start with default layer again
=LDln	"Category"		!layer name
=Lpes	&Out			!copy # of output PEs from menu
=Ltrn	"Perceptron"		!for iterative inhibition
=Llrn	"Widrow-Hoff"		!Widrow-Hoff - really Hebbian
=LInL	0.0			!low initialization limit
=LInH	0.0			!high initialization limit
+y	100			!up higher on display
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd

!	*** Connect Category Layer to Input Layer and bias ***

=SPEl	LayN			!current layer
@SlPE				!select it as destination
=NPEl	0			!input layer
@NrPE
=cnwt	0.0			!connection weight
=cnty	WVar			!variable weights
=cnsc	WAbs			!absolute
@LCFl				!fully connect to input layer
=NPEl	-1			! bias
@NrPE
=cnwt	&In			! Start calculating bias weights
/cnwt	2.0
=cnty	WFix			!fixed weights
@LCFl				!fully connect to bias
=n0	LayN			!save current layer for later


!	*** Connect Category Layer to itself (lateral inhibition) ***

=NPEl	LayN			!current layer
@NrPE
=cnwt	-0.99			! Calculate
/cnwt	&Out			! inhibition weights
=cnty	WSet			!Fixed weights
@LCFl				!fully connect to itself
=cnwt	1.0
@LCCr				!Excitatory connections

!	*** Build the output layer ***

@LLdf				!start with default layer again
=LDln	"Output"		!layer name
=Lpes	&Out			!copy # of output PEs from menu
=Ltrn	"StepFunction"		! Output 0's and 1's
=Llrn	"--None--"		!no learning
+y	100			!up higher on display
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd
=n7	LayN			!save for stdprobe

!	*** Connect Category layer to output layer ***

=SPEl	LayN			!current layer
@SlPE				!select it as destination
=NPEl	n0			!Category layer
@NrPE
=cnty	WFix			!fixed weights
=cnwt	1.0			!connection weight
@LCCr				!correspondingly connect

!	*** Select Control Strategy & L/R Schedule ***

@LLsl				!load super layer
=Lctl	"hamming"		!control strategy
=Llrs	"hamming"		!L/R Schedule
=Llnn	"hamming"		!name of learn input
=Lrcn	"hamming"		!name of recall output
=Lscl	-1			!input  low-value
=Loff	 1			!input  high-value
=Llow	 0			!output low-value
=Lhgh	 1			!output high-value
@SVsl				!save it back
!
=n5	0.0
=n6	1.0
=n4	&Out
#Incl	"stdprobe.iif"		!Standard probe include file
!
@EOF
