本文设计了一个81*60*2的神经网络结构,并将学习率固定为0.1,噪音比例控制在0,批次数量200,每批迭代次数10000次,每10批进行一次测试,并逐渐的改变batchsize观察batchsize对网络性能的影响。
实验数据用的是mnist的数据集中的0,1,0有5863个,1有6677个,测试集0有980个,1有1135个。图片经过1/3的池化,由28*28变成9*9。
批次数量500个和迭代次数10000和batchsize的关系是
500*10000*batchsize,比如batchsize=100
是将这100个样本每个都计算一次然后累积求差值的平均值,更新权重然后将这个过程重复迭代10000次,这样的样本取500批。
结论是如下表格
* | 81*60*2 | 81*60*2 | 81*60*2 | 81*60*2 | 81*60*2 | 81*60*2 | 81*60*2 | 81*60*2 |
* | 全样品集 | 全样品集 | 全样品集 | 全样品集 | 全样品集 | 全样品集 | 全样品集 | 全样品集 |
* | 全测试集 | 全测试集 | 全测试集 | 全测试集 | 全测试集 | 全测试集 | 全测试集 | 全测试集 |
学习率 | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 |
batch | z=2 | z=5 | z=10 | z=20 | z=30 | z=50 | z=100 | z=200 |
迭代次数 | it=10000 | it=10000 | it=10000 | it=10000 | it=10000 | it=10000 | it=10000 | it=10000 |
平均值 | 0.660364 | 0.778482 | 0.780908 | 0.843712 | 0.822326 | 0.869144 | 0.861909 | 0.896198 |
标准差 | 0.075108 | 0.028592 | 0.053443 | 0.046167 | 0.044881 | 0.006091 | 0.0064 | 0.00622 |
最大值 | 0.745626 | 0.808511 | 0.82695 | 0.87234 | 0.871395 | 0.882742 | 0.895508 | 0.909693 |
可以看到随着batchsize的数量逐渐增大准确率平均值也在逐渐变大由0.66-0.89,整个网络的性能由标准差可见在batchsize >=50以后就相对平稳了,因为每批样本计算10000次,所以网络整体性能经过最初开始的几批就已经接近最大值,随着批次的增加性能也没有太大变化。
这个是batchsize=5时的图片
*******************************************************************************************************************
后来发现这组数据的训练集的噪音比例是0,测试集的噪音比例是10%,测试集加噪音是个巧合
下面的数字是训练集和测试集的噪音比例都是0的数据
网络结构 | 81*60*2 | 81*60*2 | 81*60*2 | 81*60*2 | 81*60*2 | 81*60*2 | 81*60*2 | 81*60*2 |
训练集 | 全样品集 | 全样品集 | 全样品集 | 全样品集 | 全样品集 | 全样品集 | 全样品集 | 全样品集 |
测试集 | 全测试集 | 全测试集 | 全测试集 | 全测试集 | 全测试集 | 全测试集 | 全测试集 | 全测试集 |
学利率 | ret=0.1 | ret=0.1 | ret=0.1 | ret=0.1 | ret=0.1 | ret=0.1 | ret=0.1 | ret=0.1 |
batchsize | z=2 | z=5 | z=10 | z=20 | z=30 | z=50 | z=100 | z=200 |
it=10000 | it=10000 | it=10000 | it=10000 | it=10000 | it=10000 | it=10000 | it=10000 | |
平均值 | 0.670057 | 0.641154 | 0.802356 | 0.860605 | 0.874305 | 0.899745 | 0.873746 | 0.806339 |
标准差 | 0.055662 | 0.095961 | 0.041987 | 0.017203 | 0.059181 | 0.04522 | 0.080284 | 0.102181 |
最大值 | 0.729423 | 0.754494 | 0.833491 | 0.877483 | 0.888363 | 0.911542 | 0.89404 | 0.906812 |
训练集噪音比例 | zx=0 | zx=0 | zx=0 | zx=0 | zx=0 | zx=0 | zx=0 | zx=0 |
测试集噪音比例 | zy=0 | zy=0 | zy=0 | zy=0 | zy=0 | zy=0 | zy=0 | zy=0 |
两组数据做对比
batchsize | z=2 | z=5 | z=10 | z=20 | z=30 | z=50 | z=100 | z=200 |
平均值0/10 | 0.660364 | 0.778482 | 0.780908 | 0.843712 | 0.822326 | 0.869144 | 0.861909 | 0.896198 |
标准差 | 0.075108 | 0.028592 | 0.053443 | 0.046167 | 0.044881 | 0.006091 | 0.0064 | 0.00622 |
最大值 | 0.745626 | 0.808511 | 0.82695 | 0.87234 | 0.871395 | 0.882742 | 0.895508 | 0.90969 |
平均值0/0 | 0.670057 | 0.641154 | 0.802356 | 0.860605 | 0.874305 | 0.899745 | 0.873746 | 0.806339 |
标准差 | 0.055662 | 0.095961 | 0.041987 | 0.017203 | 0.059181 | 0.04522 | 0.080284 | 0.102181 |
最大值 | 0.729423 | 0.754494 | 0.833491 | 0.877483 | 0.888363 | 0.911542 | 0.89404 | 0.906812 |
经过对比测试集加噪音的网络的最大值0.89小于未加噪音的0.91,但是在batchsize>50以后测试集加噪音是的网络的标准差远小于未加噪音的0.006091<0.04522,表明在batchsize>50以后测试集加噪音使网络的性能更加稳定。
z=2 | z=5 | z=10 | z=20 | z=30 | z=50 | z=100 | z=200 |
0.547045 | 0.598109 | 0.792908 | 0.733806 | 0.871395 | 0.867139 | 0.895508 | 0.900709 |
0.622222 | 0.772104 | 0.812766 | 0.864303 | 0.790544 | 0.86383 | 0.854846 | 0.897872 |
0.63357 | 0.793381 | 0.794799 | 0.868558 | 0.725768 | 0.866194 | 0.861939 | 0.883215 |
0.730496 | 0.80331 | 0.79669 | 0.764066 | 0.859102 | 0.858156 | 0.859102 | 0.892199 |
0.638298 | 0.798109 | 0.537589 | 0.868085 | 0.865721 | 0.869031 | 0.862884 | 0.88227 |
0.463357 | 0.806619 | 0.808038 | 0.653428 | 0.861939 | 0.876123 | 0.867139 | 0.901655 |
0.638771 | 0.808511 | 0.808038 | 0.830733 | 0.853901 | 0.860993 | 0.859102 | 0.900236 |
0.735697 | 0.774941 | 0.810402 | 0.87234 | 0.864303 | 0.869031 | 0.85721 | 0.898345 |
0.627896 | 0.78156 | 0.813712 | 0.652955 | 0.831206 | 0.873759 | 0.860993 | 0.892671 |
0.634988 | 0.794326 | 0.756028 | 0.862411 | 0.860993 | 0.87565 | 0.865248 | 0.899764 |
0.729551 | 0.789598 | 0.797163 | 0.833097 | 0.865721 | 0.861466 | 0.859102 | 0.892199 |
0.633097 | 0.799527 | 0.744681 | 0.870449 | 0.839716 | 0.87234 | 0.858156 | 0.88227 |
0.722931 | 0.787707 | 0.753191 | 0.868085 | 0.834988 | 0.866667 | 0.862884 | 0.895508 |
0.745626 | 0.802364 | 0.740898 | 0.865721 | 0.788652 | 0.878014 | 0.860993 | 0.889362 |
0.631678 | 0.795272 | 0.801891 | 0.867139 | 0.837825 | 0.871868 | 0.856738 | 0.886525 |
0.723877 | 0.785816 | 0.749882 | 0.868558 | 0.801418 | 0.868085 | 0.852009 | 0.900236 |
0.629314 | 0.677069 | 0.803783 | 0.863357 | 0.763593 | 0.858629 | 0.863357 | 0.9026 |
0.722931 | 0.760284 | 0.807565 | 0.859102 | 0.757447 | 0.870922 | 0.863357 | 0.903546 |
0.728605 | 0.762175 | 0.806147 | 0.832151 | 0.862884 | 0.871868 | 0.866667 | 0.900709 |
0.623168 | 0.799054 | 0.799527 | 0.866667 | 0.841608 | 0.86383 | 0.863357 | 0.900236 |
0.735697 | 0.732388 | 0.820331 | 0.861466 | 0.816076 | 0.871868 | 0.869504 | 0.899291 |
0.725768 | 0.796217 | 0.817967 | 0.825059 | 0.849645 | 0.862411 | 0.864303 | 0.9026 |
0.724823 | 0.767376 | 0.748463 | 0.834515 | 0.83026 | 0.868085 | 0.861939 | 0.903546 |
0.463357 | 0.765012 | 0.752246 | 0.870449 | 0.858156 | 0.868558 | 0.860993 | 0.898818 |
0.730024 | 0.803783 | 0.813239 | 0.855319 | 0.858156 | 0.878014 | 0.861939 | 0.909693 |
0.737589 | 0.795745 | 0.731442 | 0.863357 | 0.858629 | 0.864775 | 0.868085 | 0.898818 |
0.731442 | 0.786761 | 0.801418 | 0.867139 | 0.836407 | 0.865248 | 0.863357 | 0.899764 |
0.725768 | 0.803783 | 0.813239 | 0.862884 | 0.854846 | 0.87565 | 0.868558 | 0.8974 |
0.730024 | 0.794799 | 0.8 | 0.828842 | 0.838771 | 0.882742 | 0.859102 | 0.901182 |
0.629314 | 0.797636 | 0.816548 | 0.840189 | 0.852009 | 0.87234 | 0.855792 | 0.901182 |
0.630733 | 0.765957 | 0.791489 | 0.865721 | 0.832624 | 0.870449 | 0.866194 | 0.897872 |
0.463357 | 0.763593 | 0.807092 | 0.832624 | 0.858629 | 0.874704 | 0.85721 | 0.904019 |
0.628842 | 0.798582 | 0.741844 | 0.86052 | 0.816076 | 0.874232 | 0.862884 | 0.894563 |
0.625059 | 0.727187 | 0.74279 | 0.866667 | 0.862411 | 0.865721 | 0.858629 | 0.892199 |
0.463357 | 0.795272 | 0.795745 | 0.866667 | 0.828369 | 0.873759 | 0.857683 | 0.889835 |
0.626005 | 0.783924 | 0.817967 | 0.860993 | 0.862411 | 0.861939 | 0.867139 | 0.886998 |
0.73617 | 0.789598 | 0.543262 | 0.868558 | 0.830733 | 0.877541 | 0.862411 | 0.901182 |
0.629314 | 0.791017 | 0.816076 | 0.823641 | 0.746099 | 0.876596 | 0.860047 | 0.895035 |
0.5513 | 0.780142 | 0.739953 | 0.871395 | 0.860993 | 0.873286 | 0.852955 | 0.893617 |
0.633097 | 0.798582 | 0.654374 | 0.862884 | 0.745626 | 0.869031 | 0.854846 | 0.891726 |
0.72766 | 0.775887 | 0.754137 | 0.825532 | 0.739007 | 0.876596 | 0.864775 | 0.885579 |
0.638771 | 0.785343 | 0.800473 | 0.861939 | 0.763593 | 0.869976 | 0.855319 | 0.886525 |
0.629314 | 0.799054 | 0.817021 | 0.861939 | 0.756501 | 0.855792 | 0.861939 | 0.899764 |
0.619858 | 0.800473 | 0.819858 | 0.838298 | 0.741371 | 0.874704 | 0.858629 | 0.899764 |
0.730496 | 0.758392 | 0.806619 | 0.859574 | 0.725768 | 0.861466 | 0.857683 | 0.895508 |
0.635461 | 0.797636 | 0.813712 | 0.866667 | 0.743735 | 0.861939 | 0.866667 | 0.894563 |
0.62695 | 0.775887 | 0.73617 | 0.861466 | 0.817021 | 0.868085 | 0.860047 | 0.89409 |
0.622222 | 0.6974 | 0.73617 | 0.850591 | 0.869504 | 0.857683 | 0.862411 | 0.900236 |
0.634043 | 0.718203 | 0.798109 | 0.833097 | ||||
0.732388 | 0.795272 | 0.815603 | 0.850118 | ||||
0.536643 | 0.795272 | 0.748463 | 0.866194 | ||||
0.731442 | 0.765957 | 0.722931 | |||||
0.617494 | 0.772577 | 0.821749 | |||||
0.634988 | 0.804255 | 0.805201 | |||||
0.726714 | 0.782979 | 0.805674 | |||||
0.737116 | 0.798109 | 0.739007 | |||||
0.720567 | 0.79669 | 0.805201 | |||||
0.536643 | 0.798109 | 0.799527 | |||||
0.733333 | 0.787234 | 0.797163 | |||||
0.618913 | 0.8 | 0.799527 | |||||
0.632151 | 0.787707 | 0.807565 | |||||
0.57305 | 0.797636 | 0.821749 | |||||
0.582506 | 0.785343 | 0.806619 | |||||
0.739007 | 0.787234 | 0.796217 | |||||
0.635461 | 0.794799 | 0.728605 | |||||
0.622695 | 0.759811 | 0.793381 | |||||
0.732388 | 0.759338 | 0.78818 | |||||
0.638298 | 0.782979 | 0.813239 | |||||
0.633097 | 0.773995 | 0.817967 | |||||
0.721986 | 0.781087 | 0.735697 | |||||
0.735225 | 0.770213 | 0.786288 | |||||
0.463357 | 0.765957 | 0.791962 | |||||
0.723404 | 0.771158 | 0.79669 | |||||
0.744208 | 0.765485 | 0.799054 | |||||
0.631206 | 0.766903 | 0.787234 | |||||
0.631678 | 0.765012 | 0.791489 | |||||
0.631206 | 0.772104 | 0.799527 | |||||
0.729551 | 0.763121 | 0.821749 | |||||
0.642553 | 0.792908 | 0.729551 | |||||
0.463357 | 0.801891 | 0.816076 | |||||
0.731915 | 0.800946 | 0.808983 | |||||
0.621749 | 0.783924 | 0.802837 | |||||
0.742317 | 0.78818 | 0.809929 | |||||
0.723877 | 0.791962 | 0.821749 | |||||
0.736643 | 0.795745 | 0.809929 | |||||
0.636879 | 0.791489 | 0.795272 | |||||
0.627896 | 0.803783 | 0.801418 | |||||
0.738061 | 0.753664 | 0.80331 | |||||
0.634515 | 0.765485 | 0.808983 | |||||
0.734279 | 0.761229 | 0.800946 | |||||
0.641608 | 0.794326 | 0.788652 | |||||
0.730969 | 0.791962 | 0.815603 | |||||
0.638771 | 0.789598 | 0.820804 | |||||
0.634515 | 0.775887 | 0.550827 | |||||
0.73617 | 0.765012 | 0.82695 | |||||
0.629314 | 0.773995 | 0.797636 | |||||
0.724823 | 0.772104 | 0.660047 | |||||
0.729551 | 0.763121 | 0.742317 | |||||
0.733333 | 0.760757 | 0.792908 | |||||
0.72766 | 0.748463 | 0.759338 |
下面是训练集和测试集噪音比例都是0的数据
z=2 | z=5 | z=10 | z=20 | z=30 | z=50 | z=100 | z=200 |
0.554872 | 0.663671 | 0.833491 | 0.866131 | 0.85052 | 0.907758 | 0.89404 | 0.906812 |
0.727531 | 0.463576 | 0.796121 | 0.875118 | 0.888363 | 0.911542 | 0.885998 | 0.889309 |
0.727531 | 0.536424 | 0.831126 | 0.876064 | 0.888363 | 0.906812 | 0.886471 | 0.862819 |
0.636708 | 0.715232 | 0.820719 | 0.844844 | 0.886471 | 0.906812 | 0.893094 | 0.862346 |
0.660833 | 0.747871 | 0.788553 | 0.836329 | 0.855251 | 0.85667 | 0.886471 | 0.862819 |
0.712394 | 0.745979 | 0.831126 | 0.866604 | 0.885525 | 0.905866 | 0.885998 | 0.862346 |
0.720435 | 0.528855 | 0.788553 | 0.875591 | 0.886944 | 0.896405 | 0.892621 | 0.83018 |
0.672185 | 0.614475 | 0.778619 | 0.876537 | 0.888363 | 0.907758 | 0.890255 | 0.83018 |
0.663671 | 0.463576 | 0.806528 | 0.85052 | 0.888363 | 0.907758 | 0.889782 | 0.83018 |
0.64333 | 0.692999 | 0.832545 | 0.875118 | 0.883633 | 0.907758 | 0.888836 | 0.83018 |
0.672185 | 0.463576 | 0.788553 | 0.874172 | 0.888363 | 0.896405 | 0.491012 | 0.83018 |
0.662725 | 0.725166 | 0.831126 | 0.874645 | 0.888363 | 0.907758 | 0.87843 | 0.83018 |
0.662725 | 0.692053 | 0.820246 | 0.851939 | 0.885525 | 0.907758 | 0.886471 | 0.83018 |
0.662725 | 0.748344 | 0.833018 | 0.875118 | 0.888363 | 0.906812 | 0.891675 | 0.830653 |
0.729423 | 0.465468 | 0.788553 | 0.84579 | 0.888363 | 0.907758 | 0.888836 | 0.83018 |
0.727531 | 0.719962 | 0.788553 | 0.847209 | 0.888363 | 0.906812 | 0.891675 | 0.83018 |
0.687323 | 0.699622 | 0.558657 | 0.875591 | 0.886944 | 0.907758 | 0.891675 | 0.830653 |
0.662252 | 0.738411 | 0.792337 | 0.851466 | 0.888363 | 0.906812 | 0.889309 | 0.83018 |
0.729423 | 0.60596 | 0.742195 | 0.851466 | 0.886471 | 0.907758 | 0.891675 | 0.83018 |
0.56859 | 0.463576 | 0.833018 | 0.877483 | 0.885052 | 0.906812 | 0.886471 | 0.463576 |
0.672185 | 0.736045 | 0.833018 | 0.877483 | 0.878903 | 0.907758 | 0.885998 | 0.83018 |
0.53122 | 0.738411 | 0.793756 | 0.874172 | 0.886471 | 0.906812 | 0.885998 | 0.830653 |
0.604541 | 0.717597 | 0.820246 | 0.873699 | 0.888363 | 0.907758 | 0.892621 | 0.830653 |
0.663671 | 0.544465 | 0.833018 | 0.870388 | 0.880322 | 0.907758 | 0.892621 | 0.463576 |
0.662725 | 0.706244 | 0.833018 | 0.860927 | 0.863292 | 0.906812 | 0.892148 | 0.83018 |
0.662725 | 0.710501 | 0.807001 | 0.868969 | 0.880322 | 0.907758 | 0.891675 | 0.83018 |
0.663671 | 0.544465 | 0.820246 | 0.855724 | 0.878903 | 0.907758 | 0.891675 | 0.83018 |
0.662725 | 0.646641 | 0.833491 | 0.819773 | 0.880322 | 0.907758 | 0.892148 | 0.83018 |
0.467833 | 0.646641 | 0.833018 | 0.870861 | 0.878903 | 0.907758 | 0.892148 | 0.83018 |
0.660833 | 0.524598 | 0.833018 | 0.855724 | 0.878903 | 0.907758 | 0.892148 | 0.83018 |
0.663671 | 0.624409 | 0.806528 | 0.872753 | 0.878903 | 0.907758 | 0.891675 | 0.83018 |
0.727531 | 0.565279 | 0.833018 | 0.815043 | 0.878903 | 0.907758 | 0.891675 | 0.83018 |
0.663671 | 0.551088 | 0.833018 | 0.855724 | 0.878903 | 0.907758 | 0.892621 | 0.830653 |
0.672185 | 0.60596 | 0.80369 | 0.854305 | 0.878903 | 0.907758 | 0.891675 | 0.830653 |
0.729423 | 0.711921 | 0.805109 | 0.874172 | 0.878903 | 0.907758 | 0.892148 | 0.830653 |
0.720435 | 0.683065 | 0.748344 | 0.833964 | 0.878903 | 0.907758 | 0.892148 | 0.830653 |
0.660833 | 0.683065 | 0.787606 | 0.850993 | 0.878903 | 0.907758 | 0.893094 | 0.464049 |
0.660833 | 0.544465 | 0.805109 | 0.854305 | 0.886944 | 0.907758 | 0.891675 | 0.830653 |
0.664144 | 0.754494 | 0.789972 | 0.832545 | 0.878903 | 0.907758 | 0.892148 | 0.830653 |
0.723746 | 0.683065 | 0.768212 | 0.874172 | 0.886944 | 0.907758 | 0.892148 | 0.830653 |
0.729423 | 0.748344 | 0.803217 | 0.813623 | 0.885525 | 0.907758 | 0.892148 | 0.830653 |
0.727531 | 0.544465 | 0.748817 | 0.843425 | 0.886944 | 0.907758 | 0.892148 | 0.830653 |
0.727531 | 0.745506 | 0.805109 | 0.875118 | 0.885525 | 0.907758 | 0.886944 | 0.830653 |
0.63245 | 0.715232 | 0.805109 | 0.873699 | 0.886944 | 0.907758 | 0.891675 | 0.830653 |
0.60123 | 0.743614 | 0.805109 | 0.869915 | 0.888363 | 0.907758 | 0.886471 | 0.464049 |
0.729423 | 0.544465 | 0.80369 | 0.874172 | 0.888363 | 0.587512 | 0.891675 | 0.830653 |
0.660833 | 0.745506 | 0.80369 | 0.843898 | 0.886944 | 0.907758 | 0.886471 | 0.830653 |