xor.bp

来自「bp神经网络,反向传播神经网络!感觉还不错的」· BP 代码 · 共 32 行

BP
32
字号
* This is the classic xor problem z = xor(x,y).  X and y are input and
* z needs to be computed or maybe its more accurate to say the network
* needs to memorize the output z for each x and y.
*
* The learning times vary depending on the initial random weights, the
* algorithm chosen and all the parameter settings.  The results can also
* depend ever so slightly on the floating point hardware being used and
* whether or not the compiler is optimizing.  The file xor.ini contains
* one set of random weights and the file xorrbp.cpy shows the results
* for these weights using the rbp program with the standard smooth
* sigmoid.  The file xorbp.cpy shows the results for these weights using
* the bp program and the standard smooth sigmoid.
*
* The parameter and algorithm settings here are not particularly good so
* you may want to play around to try and find the best, which as far as
* I can tell will be around 20 iterations with a failure rate of around
* 10%.

m 2 1 1 x   * make a 2-1-1 network
s7          * seed the random number generator
ci 1        * giving the network a "kick" sets new random weights
a as        * standard smooth sigmoid

rt {        * there are four patterns following
1 0 1
0 0 0
0 1 1
1 1 0 }

e 0.5       * set the learning rate, eta to 0.5
a 0.9       * set the momentum, alpha to 0.9

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?