inst4.0		! 1-Jun-89  (pnn.ins)  PNN Network
!****************************************************************
!*								*
!*	Probabilistic Neural  Network Builder			*
!*								*
!****************************************************************

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

?&In	1
>bge	CheckOut
@Err	"Probabilistic Neural Network MUST have at least one input PE"
:CheckOut
?&Out	1
>bge	OutOK
@Err	"Probabilistic Neural Network MUST have at least one output PE"
:OutOK
?&Hd1	1
>bge	HidOK
@Err	"Probabilistic Neural Network MUST have at least one Hidden 1 PE"
:HidOK
?&Hd1	&Out
>bge	HidOK2
@Err	"PNN MUST have more Hidden 1 PEs than Output PEs"
:HidOK2

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

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

=netn	"InstaNet (tm) Probabilistic Neural Network version 1.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
=x	100			!place to put layer on screen
=y	 60
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd				!add the input layer

!	*** Build the normalization Layer ***

@LLdf				!load default layer
=Lpes	&In			!input PEs + 1
+Lpes	1
=LDln	"Norm"			!layer name
=Lsum	"NormPolar"		!normalize / scale
+y	70
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd

!	*** Connect it up to input layer ***

=SPEl	LayN			!normalization layer
@SlPE
=NPEl	0			!input layer
@NrPE
=cnsc	WRel
=cnty	WFix
=cnwt	1.0
@LCCr				!connect corresponding PEs together
=n0	LayN			!normalization layer

!	*** Build the pattern Layer ***

@LLdf				!load default layer
=Lpes	&Hd1			!hidden layer PEs
=LDln	"pattern"		!layer name
=Ltrn	"PNN"			!transfer function
=Lcmp	"PNN"			!direct output, set up PE for learning
=Llrn	"User Kohonen"		!update winning PE
=Llrs	"pnn"			!L/R Schedule
=LInL	0.0			!low initialization limit
=LInH	0.0			!high initialization limit
+y	70
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd

!	*** Connect it to the normalization layer ***

=SPEl	LayN			!current layer
@SlPE
=NPEl	n0			!previous layer
@NrPE
=cnwt	0.0			!
=cnty	WVar			!variable
=cnsc	WAbs			!absolute
@LCFl				!fully connect
=n0	LayN			!pattern layer

!	*** Build the summation layer ***

@LLdf				!load default layer to mi_layer structure
=LDln	"Summation"		!layer name
=Lpes	&Out			!copy # of input PEs from menu
=Llrn	"PNN"
=LInL	1.0			!low initialization limit
=LInH	1.0			!high initialization limit
+y	70
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd				!add the summation layer
=n1	LayN			!summation layer

!	*** Connect the pattern layer to the summation layer: Setup ***

=SPEl	LayN			!summation layer
=SPEn	0
=NPEl	n0			!pattern layer
=NPEn	0
=cnwt	1.0			!set weight to 1.0
=cnty	WVar			!variable weights
=cnsc	WRel			!relative connections

!	*** Connect the pattern layer to the summation layer

:OutCn
@SlPE				!select next PE in output layer
@NrPE				!select next PE in pattern layer
@PCon				!connect two PEs together
+SPEn	1			!next PE in output layer
?SPEn	&Out			!past the end?
>blt	OutPEOK
=SPEn	0			!back to start of output layer
:OutPEOK
+NPEn	1			!next PE in the competitive layer
?NPEn	&Hd1			!done with layer?
>blt	OutCn			!no, keep going

!	*** Build the output layer ***

@LLdf				!load default layer to mi_layer structure
=LDln	"Out"			!layer name
=Lpes	&Out			!copy # of input PEs from menu
=Lcmp	"One-Active-Highest"
=LInL	1.0			!low initialization limit
=LInH	1.0			!high initialization limit
+y	70
#Incl	"stdnwgtf.iif"		!standard # weight fields
@LAdd				!add the output layer
=n7	LayN			!save for stdprobe

!	*** Connect the summation layer to the output layer ***

=SPEl	LayN			!output layer
@SlPE
=NPEl	n1			!summation layer
=NPEn	0
@NrPE
=cnty	WFix			!variable weights
=cnsc	WRel			!relative connections
=cnwt	1.0			!set weight to 1.0
@LCCr				!connect correspondingly

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

@LLsl				!load super layer
=Lctl	"pnn"			!category learning network control strategy
=Llnn	"pnn"			!name of learn input
=Lrcn	"pnn"			!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
!
=jogl	-.1			!lower limit for jog
=jogh	+.1			!upper limit for jog
=seed	257			!starting seed number
@seed				!set the seed
@Nini				!initialize the network
@EOF
