Skip to content

Commit

Permalink
0126readme
Browse files Browse the repository at this point in the history
  • Loading branch information
wuziheng committed Jan 27, 2018
1 parent c4a01af commit dde25aa
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 64 deletions.
88 changes: 36 additions & 52 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
* 完成Conv2D类的设计,对比上一版本进行测试通过。


~



**2018.01.25**
Expand All @@ -48,6 +50,8 @@
* 完成其他基本组件的Operator改写。新版本支持隐式构建graph,调用converge(汇) Variable.eval()自动完成前向传播计算;调用对应的source(源)Variable.diff_eval()自动完成反向传播与导数计算;对于learnable的Variable,手动调用Variable.apply_gradient()完成梯度下降。(未来目标把上述操作封转到显示的graph 或者session类中)


~



**2018.01.26**
Expand All @@ -57,9 +61,7 @@
* 给train_epoch读入图片添加了shuffle
* 完成了不同的激活函数relu,leaky-relu,sigmoid,tanh,elu, prelu
* 完成了对激活函数的grad_check,实际上sigmoid确实容易出现gradient-vanish,所以一开始用1e-5学习率基本收敛的特别慢,所以实际测试里面调整到了1e-3
* 初始化默认为init='MSRA', 实际上没有做仔细的调整,最终的结果上比较性并不是特别强,但是我们可以明显发现sigmoid和tanh的计算速度要慢一些,同时我们将给出前100个iteration的loss曲线,我们可以发现,收敛速度上的差别。即使sigmoid,tanh使用了较大的learning_rate,依然收敛的慢一些。

<center>
* 初始化默认为init='MSRA', method和lr上没有做仔细的调整,最终的结果上比较性并不是特别强,但是我们可以明显发现sigmoid和tanh的计算速度要慢一些.relu系:50个batch的耗时1min13s左右。sigmoid系:1min30s左右,详细可以参考log,里面有准确的时间记录,都是同时在服务器上跑的。应该不存在资源上太大的区别。

| version | validation_acc | train_acc | learning_rate | epoch(max=20) |
| :------------------------- | :------------: | :-------: | :-----------: | :-----------: |
Expand All @@ -70,10 +72,21 @@
| **SGD_TANH** | 96.41% | 91.12% | 1e-3~1e-4 | 2 |
| **SGD_ELU** | 97.74% | 97.26% | 1e-5 | 13 |

</center>
~



**2018.01.26**

------

由于我们没有精调参数,所以这里就不分析比较准确率曲线,我们就分析不同激活函数的收敛速度:

1. 左图可以看到tanh,sigmoid即使采用了更大的学习率,在收敛速度上依然比relu要慢不少
2. 右图我们可以看到,这么多种relu,在收敛速度上,没有质的区别,即使是不同alpha的leak-relu,区别也不大。但是我们还是可以勉强认为leaky-relu稍微比relu强一些。

<center>

<img src="fig/activation-loss1.jpg" style="zoom:20%"/> <img src="fig/activation-loss2.jpg" style="zoom:20%"/>
<img src="fig/activation-loss1.jpg" style="zoom:100%"/> <img src="fig/activation-loss2.jpg" style="zoom:100%"/>

</center>
15 changes: 8 additions & 7 deletions plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def plot(collection, title, moving_alpha = 0.9):
print filelist
moving_alpha = 0.8

plt.figure()
plt.figure(figsize=(4,3))


for file in filelist:
name = file.split('/')[-1].split('.')[0]
Expand All @@ -50,13 +51,13 @@ def plot(collection, title, moving_alpha = 0.9):
acc = acc[0:50]
acc = [acc[i] * moving_alpha + acc[i + 1] * (1 - moving_alpha) for i in
range(len(acc) - 1)]
x = range(0,len(acc))
plt.plot(x,acc,label=name)
x = range(0,len(loss))
plt.plot(x,loss,label=name)

plt.xlabel('iteration(50batch)')
plt.ylabel('acc')
plt.ylabel('loss')
plt.ylim(0,1)
plt.title('acc-iteration curve (moving_alpha=%.2f)'%moving_alpha)
plt.legend(loc='lower right')
plt.savefig('fig/activation-acc2.jpg')
plt.title('loss-iteration curve')
plt.legend(loc='upper right')
plt.savefig('fig/activation-loss1.jpg',dpi=100)
plt.show()

0 comments on commit dde25aa

Please sign in to comment.