BP网络 - 用2001PKU MCM B题基因检测

为了测试写的BP网络,找出了古董的测试数据, 2001年PKU数学建模竞赛的B题,详细题目数据见(http://mcm.ustc.edu.cn/wangjie/other/pku2001.htm)

刚开始一直没成功,总数不收敛,换了些参数才发觉隐藏层的神经元数目需要很小,有点归约的感觉,配合输出层只有一个神经元的情况。

  n = BPNN(114, 5, 1) 


/neural_network/python$ python bpnn_test_gene.py 

绿色为正常,其它为癌症患者


第 1000 次迭代后,  总误差 =  0.00043

[开始测试]
[测试 - 训练集 1-40]
(1, '->', [0.0047844055220408943])
(2, '->', [0.0081434439164398045])
(3, '->', [0.0087027116939419405])
(4, '->', [0.019041091298913893])
(5, '->', [0.016593468921213432])
(6, '->', [0.011028970836535831])
(7, '->', [0.00077165262824519291])
(8, '->', [-0.014141845789097019])
(9, '->', [-0.026888465551666834])
(10, '->', [-0.030979395916223416])
(11, '->', [-0.037046229637863436])
(12, '->', [-0.036773451846493416])
(13, '->', [0.015900338884109948])
(14, '->', [-0.037903444409508651])
(15, '->', [-0.024333946331674079])
(16, '->', [-0.010619465403882941])
(17, '->', [-0.0028634166211065648])
(18, '->', [-0.0017593107622435994])
(19, '->', [0.00068856887334329273])
(20, '->', [-0.0024506728703005839])
(21, '->', [0.99977500813690801])
(22, '->', [0.99567418038606437])
(23, '->', [0.99884968998078594])
(24, '->', [0.99901365448583612])
(25, '->', [0.99688259568180893])
(26, '->', [0.99964945975147124])
(27, '->', [0.99973711745416793])
(28, '->', [0.99734564170973528])
(29, '->', [0.99947959614334769])
(30, '->', [0.99967000992148813])
(31, '->', [0.99942366645946201])
(32, '->', [0.99679647721081921])
(33, '->', [0.99867636725123154])
(34, '->', [0.99713012676839308])
(35, '->', [0.99965506353786537])
(36, '->', [0.99760314413245554])
(37, '->', [0.99686940119004097])
(38, '->', [0.99725448503584124])
(39, '->', [0.98987313080396422])
(40, '->', [0.99196096803729983])
[测试 - 测试集41-60]
(1, '->', [0.14301130351130051])
(2, '->', [0.8790731128998559])
(3, '->', [0.0080333911179965769])
(4, '->', [0.2489119476817489])
(5, '->', [0.99902300345534079])
(6, '->', [0.23851153117747417])
(7, '->', [0.99882558049212444])
(8, '->', [0.66808158538545104])
(9, '->', [0.24984504268026864])
(10, '->', [0.7609977346437089])
(11, '->', [-0.020217302737652813])
(12, '->', [-0.054706813343991169])
(13, '->', [0.3816209683810155])
(14, '->', [-0.035897350958928896])
(15, '->', [0.13569937178115851])
(16, '->', [-0.0047938800241178444])
(17, '->', [0.99861117563586566])
(18, '->', [-0.071746141348893344])
(19, '->', [-0.96341365942697255])

(20, '->', [0.002732924243690444])


=======================================================================================================C++ 多隐含层的BP

但是目前用多层bp还是失败 不知为什么,收敛总是没有规律。

---

跑出来了

--

 int lSz[4] = {114,5,5,1}; 

这不是很扯吗,测试数据的结果和上面1个隐含层的时候的结果差距较大。 

Network Trained. Threshold value achieved in 14409 iterations.
mean square error:  9.96433e-07


训练结束
[测试 - 训练集]
Now using the trained network to make predictions on test data....


1 -> 0.0142536
2 -> 0.0344108
3 -> 0.00635911
4 -> 0.0111347
5 -> 0.0134971
6 -> 0.0134368
7 -> 0.0306509
8 -> 0.0353082
9 -> 0.0383011
10 -> 0.0014085
11 -> 0.0458609
12 -> 0.0256341
13 -> 0.0412266
14 -> 0.0981514
15 -> 0.0654196
16 -> 0.0093003
17 -> 0.166652
18 -> 0.0108277
19 -> 0.0201398
20 -> 0.19629
21 -> 0.996532
22 -> 0.99457
23 -> 0.990613
24 -> 0.998014
25 -> 0.991699
26 -> 0.993326
27 -> 0.998004
28 -> 0.974329
29 -> 0.994036
30 -> 0.998255
31 -> 0.968838
32 -> 0.991213
33 -> 0.973562
34 -> 0.97294
35 -> 0.998595
36 -> 0.96021
37 -> 0.961533
38 -> 0.950387
39 -> 0.934229
40 -> 0.89916
[测试 - 测试集]
1 -> 0.000160473
2 -> 0.000160473
3 -> 0.0176718
4 -> 0.788587
5 -> 0.788587
6 -> 0.803911
7 -> 0.788587
8 -> 0.788587
9 -> 0.000160473
10 -> 0.000160473
11 -> 6.84822e-05
12 -> 4.43852e-05
13 -> 0.788587
14 -> 4.43852e-05
15 -> 0.23045
16 -> 4.43852e-05
17 -> 0.000160473
18 -> 4.43852e-05
19 -> 0.000160473
20 -> 0.23045


该CPP只有1个隐含层的时候也比较奇怪,结果居然和上面python差距也很大。。。 莫非是由于收敛效果不好造成的!

 int lSz[4] = {114,5,1};

[测试 - 测试集]
1 -> 0.00303241
2 -> 0.00303241
3 -> 0.00807884
4 -> 0.99236
5 -> 0.998878
6 -> 0.00807884
7 -> 0.998878
8 -> 0.99236
9 -> 0.00303241
10 -> 0.00303242
11 -> 0.00807884
12 -> 0.00807884
13 -> 0.99236
14 -> 0.00807884
15 -> 0.00807884
16 -> 0.00807884
17 -> 0.00303241
18 -> 0.00118701
19 -> 0.00303241
20 -> 0.00807884 



你可能感兴趣的:(dl,bpnn,nn,mcm,DeepLearning)