home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / AIE9003.ZIP / NET.ARI < prev    next >
Encoding:
Text File  |  1989-12-12  |  3.5 KB  |  153 lines

  1. :- module net.
  2.  
  3. :- public main / 0,
  4.           restart / 0.
  5.  
  6. :- extrn main_hlpr / 0.
  7.  
  8.  
  9. /*
  10. 1 1 : 0
  11. 1 0 : 1
  12. 0 1 : 1
  13. 0 0 : 0
  14.  
  15.  
  16. formula : A or B
  17.  
  18. Formulas attachted to nodes :
  19.       Input to node = input from node formula
  20.       Input from formula =
  21.           if formula is a node output then that output
  22.           else if formula = not formula1 then
  23.  
  24. Activation of an NOT node
  25.                Result := ( 1 - INPUT )
  26.  
  27. Activation of an OR node
  28.                begin
  29.                Result := 0;
  30.                for i ranging over all inputs to this node do
  31.                      Result := Result +
  32.                                ( 1 - Result ) * OUTPUT(i) * EDGE_FROM_i
  33.                end.
  34.  
  35. Activation of an AND node
  36.                begin
  37.                Result := 1;
  38.                for i ranging over all inputs to this node do
  39.                      Result := Result *  OUTPUT(i) * EDGE_FROM_i
  40.                end.
  41.  
  42.  
  43.  
  44.  
  45.  
  46. ARCHITECTURE OF NETWORK
  47.  
  48. 1.  Given input nodes and their NOTs
  49. 2.  1st hidden layer : some number of AND nodes
  50. 3:  output layer : a problem-specific number of OR nodes
  51.  
  52. LEARNING ALGORITHM
  53.  
  54. Starting at the output and working toward the input, do
  55.       repeat,
  56.          Compute desired change of a neuron.
  57.          Compute desired changes of edges leading to it.
  58.          Move 1 layer toward input
  59.  
  60. Desired change of a neuron :
  61.      Output Neuron :       ( DESIRED - ACTUAL )
  62.      Hidden neuron:
  63.         Let wij be an edge to neuron j in the next layer
  64.         SUM  wij * CHANGE(J)
  65.         edges to next layer
  66.  
  67. Desired change of an edge :
  68.         Let  wij be an edge from neuron i to neuron j in the
  69.                 next layer.
  70.         CHANGE( wij ) = ACTIVATION( i ) * change( j )
  71.  
  72. NEW EDGE WEIGHT GIVEN CHANGE
  73.         if change > 0 then
  74.             new := current + ( 1 - current ) * change
  75.         if change < 0 then
  76.             new := current + current * change
  77.  
  78.  
  79. INITIALIZATION
  80.  
  81. Edges based on intuition
  82.  
  83. When you don't know, make it a 1.
  84.  
  85. Hidden layer generation
  86.  
  87. Given : list of input neurons
  88.  
  89.       I1,    I2,    I3,    I4,
  90.  
  91.     Hidden layer 1 :  attached formulas on edges
  92.  
  93. E1_1        I1  &  I2  &  I3  &  I4
  94. E1_2        I1  &  I2  &  I3  & -I4
  95. E1_3        I1  &  I2  & -I3  &  I4
  96. E1_4        I1  &  I2  & -I3  & -I4
  97. E1_5        I1  & -I2  &  I3  &  I4
  98. E1_6        I1  & -I2  &  I3  & -I4
  99. E1_7        I1  & -I2  & -I3  &  I4
  100. E1_8        I1  & -I2  & -I3  & -I4
  101. E1_9       -I1  &  I2  &  I3  &  I4
  102. E1_10      -I1  &  I2  &  I3  & -I4
  103. E1_11      -I1  &  I2  & -I3  &  I4
  104. E1_12      -I1  &  I2  & -I3  & -I4
  105. E1_13      -I1  & -I2  &  I3  &  I4
  106. E1_14      -I1  & -I2  &  I3  & -I4
  107. E1_15      -I1  & -I2  & -I3  &  I4
  108. E1_16      -I1  & -I2  & -I3  & -I4
  109.  
  110.  
  111.     Hidden layer 2 :
  112.  
  113.  
  114. neuron(   LAYER , NUMBER, FORMULA ).
  115.        LAYER = input, not( NUMBER), and, or
  116.  
  117.        OUTPUT_LAYER,
  118.        INPUT_NEURON,
  119.        OUTPUT_NEURON,
  120.        TIME,
  121.        ACTIVATION).
  122.  
  123. input(  KEY, NEURON_NUMBER, ACTIVATION).
  124. output(  KEY, NEURON_NUMBER, ACTIVATION).
  125.  
  126. state( neuron,
  127.        LAYER,
  128.        NUMBER,
  129.        TIME,
  130.        ACTIVATION).
  131. state( edge  ,
  132.        OUTPUT_LAYER,
  133.        INPUT_NEURON,
  134.        OUTPUT_NEURON,
  135.        TIME,
  136.        ACTIVATION).
  137.  
  138. input(  KEY, NEURON_NUMBER, ACTIVATION).
  139. output(  KEY, NEURON_NUMBER, ACTIVATION).
  140.  
  141. */
  142.  
  143.  
  144. %%%%%%%%%%%%%%% main program %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  145.  
  146. main :-
  147.    main_hlpr.
  148.  
  149.  
  150. restart :- halt.
  151.  
  152. %%%%%%%%%%%%%%%%%% eof %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
  153.