制作两个矩阵A和D
用神经网络分类A和D,让x和y都是(0,1)之间的小数,则A与D的第三点A:x[2]=0,D:x[2]=a(x-y)的距离为
所以如果变化a对分类A和D有什么影响?
实验过程
制作一个4*4*2的网络分别向两边输入矩阵A和D。并让4*4*2部分的权重共享,前面大量实验表明这种效果相当于将两个弹性系数为k1,k2的弹簧并联成一个弹性系数为k的弹簧,并且让k1=k2=k/2的过程。
将这个网络简写成
d2(A,D)-4-4-2-(2*k),k∈{0,1}
具体进样顺序 | |||
进样顺序 | 迭代次数 | ||
δ=0.5 | |||
A | 1 | 判断是否达到收敛 | |
D | 2 | 判断是否达到收敛 | |
梯度下降 | |||
A | 3 | 判断是否达到收敛 | |
D | 4 | 判断是否达到收敛 | |
梯度下降 | |||
…… | |||
达到收敛标准测量准确率,记录迭代次数n,将这个过程重复199次 | |||
δ=0.4 | |||
… | |||
δ=1e-6 |
这个网络的收敛标准是
if (Math.abs(f2[0]-y[0])< δ && Math.abs(f2[1]-y[1])< δ )
因为对应每个收敛标准δ都有一个特征的迭代次数n与之对应因此可以用迭代次数曲线n(δ)来评价网络性能。
当网络小于收敛标准δ记录迭代次数n
矩阵A和矩阵D的构造方式
矩阵A是吸引子
Random rand1 =new Random();
int ti1=rand1.nextInt(99)+1;
x[0]=sigmoid((double)ti1/100);
Random rand2 =new Random();
int ti2=rand2.nextInt(99)+1;
x[3]=sigmoid((double)ti2/100);
x[1]=0;
x[2]=0;
D的输入
x[0]=sigmoid((double)ti1/100);
x[1]=0;
x[2]=sigmoid(sigmoid((double)ti1/100)- sigmoid((double)ti2/100) );
x[3]=sigmoid((double)ti2/100);
本文测量了a从0.5到1e-6共34组值观察a对分类性能的影响
δ | 1.00E-03 | 1.00E-02 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6 | 1.7 | 1.8 | 1.9 | 2 | 2.1 | 2.2 | 2.3 | 2.5 | 3 | 5 |
0.5 | 128.4623116 | 129.2160804 | 129.86935 | 127.9196 | 130.46231 | 130.0603 | 131.67839 | 132.0201 | 132.71357 | 129.49749 | 131.4472362 | 130.2915 | 132.7337 | 132.3216 | 128.4523 | 129.5879 | 132.3216 | 131.9698 | 134.5327 | 130.9548 | 130.4121 | 132.3719 | 129.7588 | 131.9899 | 130.1407 | 131.4673 | 129.5176 |
0.4 | 1211.788945 | 1198.422111 | 1223.5126 | 1212.3417 | 1220.6281 | 1229.7286 | 1200.3518 | 1239.0754 | 1162.794 | 1241.4372 | 1210.733668 | 1208.231 | 1196.141 | 1219.884 | 1202.814 | 1186.121 | 1211.779 | 1169.879 | 1201.879 | 1205.337 | 1195.598 | 1162.704 | 1157.849 | 1155.709 | 1160.332 | 1159.889 | 1128.683 |
0.3 | 1522.201005 | 1511.165829 | 1492.3166 | 1488.0653 | 1509.6633 | 1483.593 | 1532.0905 | 1498.5729 | 1488.0101 | 1508.2864 | 1517.060302 | 1482.704 | 1500.402 | 1494.412 | 1493.397 | 1464.874 | 1469.357 | 1477.854 | 1488.432 | 1466.281 | 1470.322 | 1439.759 | 1451.296 | 1400 | 1441.95 | 1404.06 | 1407.628 |
0.2 | 1764.175879 | 1765.226131 | 1746.3719 | 1761.8844 | 1801.9397 | 1741.3266 | 1742 | 1765.5025 | 1762.3065 | 1764.5025 | 1736.81407 | 1718.623 | 1745.327 | 1737.487 | 1752.271 | 1747.457 | 1727.528 | 1711.799 | 1688.804 | 1705.648 | 1693.518 | 1700.693 | 1660.312 | 1680.714 | 1670.844 | 1658.06 | 1598.533 |
0.1 | 2170.81407 | 2179.025126 | 2197.6181 | 2177.1759 | 2163.608 | 2175.3367 | 2185.3065 | 2215.1859 | 2160.5276 | 2145.8894 | 2173.809045 | 2137.543 | 2114.201 | 2133.975 | 2118.231 | 2108.704 | 2068.945 | 2053.729 | 2071.106 | 2021.709 | 2058.724 | 2038.603 | 2051.176 | 2017.025 | 2000.915 | 1970.492 | 1906.07 |
0.01 | 5430.522613 | 5434.246231 | 5452.8995 | 5362.9548 | 5422.3065 | 5458.6533 | 5370.3266 | 5419.0553 | 5325.8442 | 5316.7437 | 5179.552764 | 4985.98 | 4891.035 | 4869.035 | 4726.281 | 4708.874 | 4571.005 | 4547.719 | 4473.93 | 4369.065 | 4293.698 | 4206.945 | 4208.312 | 4109.487 | 4027.99 | 3830.583 | 3355.065 |
0.001 | 24738.25126 | 24839.61809 | 24559.769 | 24541.628 | 24068.583 | 24239.085 | 24575.442 | 23943.151 | 23665.08 | 23708.633 | 23321.49749 | 21804.97 | 20796.04 | 20370.24 | 19360.34 | 18595.84 | 18009.57 | 17497.97 | 16652.58 | 16766.2 | 15971.77 | 15091.03 | 14781.51 | 14551.64 | 13570.41 | 12585.38 | 8767.719 |
9.00E-04 | 26642.90452 | 26930.52261 | 26590.638 | 26465.508 | 26887.874 | 26539.447 | 26522.513 | 26502.382 | 26135.784 | 25919.829 | 25564.26131 | 23629.83 | 22386.26 | 22237.74 | 20886.27 | 20211.73 | 19409.95 | 18879.27 | 18284.55 | 17839.83 | 17258.27 | 16868.11 | 16428.08 | 15459.84 | 15074.01 | 13276.57 | 9948.221 |
8.00E-04 | 29364.40704 | 29703.26633 | 29132.452 | 29290.392 | 29735.141 | 28914.452 | 28868.935 | 29384.201 | 28551.186 | 29267.769 | 28221.34673 | 26097.72 | 25675.75 | 23912.77 | 22969.87 | 22334.02 | 21586.86 | 20445.58 | 20152.49 | 18717.98 | 18534.89 | 17508.76 | 17231.01 | 17299.2 | 16500.4 | 14173.36 | 10063.67 |
7.00E-04 | 31861.86432 | 32648.58291 | 32101.327 | 32929.698 | 32162.784 | 32281.015 | 32406.417 | 31786.05 | 32227.015 | 31906.497 | 30858.68844 | 28459.33 | 27266.76 | 26460.01 | 25735.64 | 24532.55 | 23166.4 | 23268.58 | 21573.72 | 20888.87 | 20611.61 | 20048.53 | 19159.39 | 19219.29 | 17178.8 | 15705.96 | 11450.41 |
6.00E-04 | 36693.41206 | 36409.9799 | 37046.894 | 36249.492 | 36524.276 | 35904.749 | 36202.97 | 36148.578 | 35844.643 | 36004.251 | 35515.87437 | 31952.59 | 30864.45 | 30212.48 | 28276.7 | 27592.36 | 26319.37 | 25800.18 | 24886.17 | 22961.31 | 22994.16 | 22223.64 | 21596.41 | 20504.57 | 19578.9 | 17255.83 | 11987.95 |
5.00E-04 | 41929.60302 | 42666.30151 | 41844.975 | 42295 | 42593.503 | 42051.176 | 42107.04 | 42515.94 | 41554.372 | 41531.899 | 40135.1407 | 36980.14 | 35416.02 | 34078.33 | 34266.76 | 31532.55 | 30882.48 | 29294.53 | 28915.74 | 26966.13 | 26796.87 | 25875.29 | 24484.54 | 23996.92 | 22520.47 | 19399.82 | 13751.09 |
4.00E-04 | 50075.44221 | 52496.91457 | 51649.894 | 51591.653 | 50380.101 | 51137.347 | 48885.427 | 50134.437 | 50458.387 | 49843.598 | 49125 | 45857.86 | 43013.91 | 40814.19 | 39371.25 | 38653.73 | 36465.36 | 34859.58 | 32004.82 | 31674.71 | 31793.43 | 30142.8 | 29257.31 | 28639.16 | 25722.36 | 23299.63 | 15515.53 |
3.00E-04 | 65622.76382 | 64610.66834 | 64340.859 | 64711.709 | 64427.05 | 65007.975 | 64739.698 | 63350.99 | 64549.256 | 62802.729 | 61459.51759 | 57201.58 | 54014.03 | 53236.75 | 49049.79 | 47075.13 | 46305.52 | 44722.85 | 42200.51 | 40795.64 | 38953.5 | 38256.84 | 37046.75 | 34738.03 | 33814.12 | 28378.35 | 19756.32 |
2.00E-04 | 92569.18593 | 92765.70854 | 89084.417 | 91586.317 | 91576.628 | 88964.839 | 90940.884 | 89206.623 | 91700.568 | 89190.387 | 86401.88945 | 80964.61 | 73677.25 | 72979.15 | 68488.01 | 67381.05 | 64121.69 | 61448.08 | 58004.96 | 56123.57 | 54096.58 | 52133.9 | 50391.83 | 50934.25 | 46758 | 38999.75 | 26043.12 |
1.00E-04 | 160643.8241 | 165371.8543 | 166297.55 | 165634.01 | 160929.24 | 161838.12 | 162103.39 | 162535.3 | 165745.27 | 163626.24 | 156234.0905 | 144866.1 | 145502 | 134964.8 | 126139.6 | 117150.5 | 114140.2 | 106811.3 | 106610.5 | 101497 | 95615.24 | 95267.46 | 91044.01 | 84126.96 | 79696 | 71294.61 | 42615.69 |
9.00E-05 | 186286.4623 | 184232.9146 | 180495.68 | 185461.3 | 182664.79 | 176149.11 | 179780.03 | 178448.05 | 183129.95 | 174383.59 | 172895 | 157584 | 155452.6 | 147611.6 | 140324.4 | 131875.2 | 123775.8 | 120813.2 | 113232 | 112913.1 | 107182.8 | 103395.1 | 94619.81 | 95078.86 | 85908.8 | 74179.51 | 54020.35 |
8.00E-05 | 200154.8995 | 202144.2261 | 203010.25 | 202924.11 | 200561.32 | 202181.71 | 194458.53 | 201402.91 | 195427.11 | 196630.34 | 197028.4271 | 179416.9 | 165193.7 | 158696.6 | 159417 | 149042.9 | 138704 | 135488.4 | 123261.1 | 126976.4 | 114853 | 114598.8 | 110847.4 | 104954.4 | 98976.92 | 81168.17 | 51728.38 |
7.00E-05 | 220892.9246 | 230403.402 | 223449.67 | 229844.96 | 227188.46 | 223330.78 | 219958.65 | 221808.62 | 222717.76 | 215797.87 | 215569.4724 | 202120 | 184584.8 | 184618 | 172709.1 | 168747.7 | 158308.4 | 152088.3 | 147196.8 | 137857.2 | 136608.2 | 127470 | 124260.5 | 117198.9 | 111331.7 | 91813.31 | 56356.86 |
6.00E-05 | 259019.9146 | 252816.6332 | 251246.68 | 256015.75 | 258797.01 | 264843.67 | 256515.32 | 252709.67 | 258744.22 | 257857.52 | 247695 | 228819.8 | 207249.5 | 203361.4 | 196486.3 | 188452.8 | 179651.1 | 171733.9 | 169391.7 | 162893 | 142626.2 | 140041.6 | 141043.8 | 129736.8 | 130254.7 | 105280.8 | 66726.5 |
5.00E-05 | 305939.4724 | 310143.9095 | 307924.59 | 298638.32 | 303183.49 | 298232.88 | 306459.75 | 303921.39 | 294887.71 | 294445.02 | 291326.3618 | 276902 | 254669.4 | 244408.4 | 237249 | 224955.4 | 215313.7 | 198229.6 | 198676.9 | 199729.9 | 176320.6 | 175077.5 | 169756.3 | 157093 | 145877.3 | 131440.7 | 76321.85 |
4.00E-05 | 381694.3869 | 371664.9598 | 371113.86 | 373714.59 | 367964.23 | 363150.83 | 383585.05 | 364084.41 | 364202.05 | 351471.58 | 362103.0302 | 341771.6 | 310986.9 | 293993.3 | 280626.6 | 268127.4 | 267391.7 | 245890.6 | 240082.1 | 234875.3 | 213823.5 | 196491.5 | 205850.3 | 199963.6 | 175481.9 | 150042.8 | 91308.68 |
3.00E-05 | 475350.1859 | 476796.9799 | 474007.34 | 481228.25 | 472738.95 | 474138.89 | 468082.81 | 476884.02 | 468669.11 | 451195.26 | 463830.6935 | 431640.6 | 406311.8 | 391581.9 | 360372.6 | 363322.5 | 345725.6 | 311048.3 | 297976.8 | 282152.4 | 272986.5 | 270379.9 | 260505.5 | 237141.4 | 241500.1 | 206000.8 | 130432.1 |
2.00E-05 | 690683.6533 | 708650.5226 | 715184.95 | 688840.96 | 700356.32 | 686737.82 | 675954.92 | 652367.38 | 680538.43 | 673054.95 | 661376.1658 | 629661.9 | 602247.6 | 553782.3 | 554477.2 | 505081.1 | 503119.8 | 480955.1 | 437419.4 | 445859.1 | 397096.1 | 383377.8 | 405126.3 | 357890.5 | 329485.4 | 282542 | 159564.7 |
1.00E-05 | 1319909.06 | 1304310.573 | 1280054.6 | 1281523.2 | 1282234.7 | 1279703.3 | 1316592.7 | 1317496.3 | 1290298.5 | 1246012.7 | 1240805.477 | 1155889 | 1073770 | 1057344 | 1027268 | 965041.3 | 901240.1 | 927876.4 | 825169.8 | 799342.1 | 764294.4 | 737732 | 744803.6 | 703801.3 | 629568.7 | 532123.3 | 310428.7 |
9.00E-06 | 1415643.116 | 1462645.09 | 1486968.8 | 1409226.9 | 1420476.5 | 1451016.5 | 1391674.4 | 1422415 | 1384179.1 | 1379721.7 | 1405242.91 | 1269484 | 1242273 | 1131755 | 1131837 | 1065732 | 1008012 | 909285.5 | 951330.1 | 907500.7 | 831663.4 | 846394.1 | 772981.5 | 774477.6 | 749237.7 | 578167.7 | 355695.3 |
8.00E-06 | 1560931.899 | 1623360.683 | 1583651.1 | 1571575.7 | 1567481.5 | 1580216.3 | 1582918.5 | 1555602.9 | 1574942.8 | 1559014.3 | 1495475.874 | 1419133 | 1384587 | 1306935 | 1215699 | 1218470 | 1098315 | 1077431 | 1053434 | 1025781 | 966703.6 | 915698.6 | 889028 | 878534.6 | 812715.5 | 650479.3 | 415233.8 |
7.00E-06 | 1705373.94 | 1805524.246 | 1825951.2 | 1785149.1 | 1799023.2 | 1752176.6 | 1783813.6 | 1762994.3 | 1817556.9 | 1732249.6 | 1735545.658 | 1596230 | 1510009 | 1437189 | 1389737 | 1295544 | 1279528 | 1215496 | 1150113 | 1154580 | 1103819 | 1020556 | 938728.7 | 926912.2 | 870120.1 | 757956.3 | 468636.6 |
6.00E-06 | 2054988.437 | 2147323.995 | 2089832.8 | 2026900.6 | 2008255.5 | 2065680.3 | 2063529.6 | 2012895.3 | 2018646.3 | 2019512.1 | 1997271.337 | 1882814 | 1710636 | 1695008 | 1572382 | 1598904 | 1503469 | 1482494 | 1424434 | 1308605 | 1234652 | 1152154 | 1071785 | 1100709 | 1027444 | 800914.8 | 540448.7 |
5.00E-06 | 2404500.905 | 2426074.146 | 2456192.3 | 2362463.1 | 2459894.8 | 2444007.4 | 2380623.6 | 2401251.3 | 2461559.7 | 2423819.7 | 2339349.191 | 2188884 | 2121634 | 1936639 | 1870625 | 1808831 | 1778483 | 1741619 | 1644482 | 1494393 | 1477053 | 1454789 | 1377725 | 1301081 | 1204413 | 1049618 | 666964.1 |
4.00E-06 | 3026583.497 | 3027668.02 | 3005676.5 | 2934050.4 | 3007859 | 3063148.8 | 3009375.5 | 2868062.9 | 2924405.5 | 2931314.3 | 2946858.236 | 2721951 | 2573131 | 2420087 | 2214564 | 2177407 | 2298046 | 2058596 | 1953759 | 1840770 | 1847457 | 1725486 | 1644338 | 1476870 | 1480641 | 1157032 | 858850.4 |
3.00E-06 | 3964188.784 | 3836020.995 | 3835702.9 | 4003851.2 | 3864993.8 | 3944114.5 | 3930845.1 | 3721951 | 3738882.1 | 3867369.4 | 3830464.97 | 3498057 | 3285130 | 3227860 | 3108969 | 3009554 | 2762537 | 2712967 | 2597385 | 2557251 | 2471113 | 2286074 | 2135585 | 2069868 | 2003542 | 1611491 | 1140339 |
2.00E-06 | 5658638.352 | 5780181.055 | 5928295.7 | 5644884.1 | 5544114.3 | 5678374.2 | 5509905.8 | 5583132.2 | 5496451.6 | 5608446.1 | 5400579.005 | 5150186 | 4761965 | 4679598 | 4515210 | 4243803 | 4342979 | 3870394 | 3885246 | 3480037 | 3583468 | 3282269 | 3176682 | 3160933 | 2867858 | 2300469 | 1379227 |
1.00E-06 | 1.07E+07 | 1.07E+07 | 1.10E+07 | 1.08E+07 | 1.11E+07 | 1.05E+07 | 1.05E+07 | 1.05E+07 | 1.06E+07 | 1.03E+07 | 1.05E+07 | 9875165 | 9404626 | 8896366 | 8483615 | 8262433 | 7651135 | 7394275 | 6909363 | 6434851 | 6843746 | 6618061 | 6088555 | 6143251 | 5332034 | 5114519 | 2726750 |
d2(A,D)-4-4-2-(2*k),k∈{0,1}
当a>1时,随着a的增加网络的迭代次数开始减小,完全相同的对象不能被分为两类,与之对应的迭代次数将是无限大。也就是迭代次数越大表明两个对象差别越小。因此a越大使得A和D的差异越大。
所以从表格很容易的看到a越大则越容易被分类,对这道题
这个表达式的当a>1时,a越大两个对象差异越大,a越小A和D的差异越小。
实验参数
学习率 0.1 |
权重初始化方式 |
Random rand1 =new Random(); |
int ti1=rand1.nextInt(98)+1; |
tw[a][b]=xx*((double)ti1/100); |