Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

你好,我用您原程序加到4层后,Mnist数据分类几乎错误。 #14

Open
shaomeiyang opened this issue Apr 23, 2019 · 15 comments

Comments

@shaomeiyang
Copy link

你好,我用您原程序加到4层后,Mnist数据分类几乎错误,把所有类别都分为2了。如果低于4层就没这个问题。请问您试过把隐含层数加到4层吗?是否存在这个问题啊,什么原因呢

@zhuofupan
Copy link
Owner

这么奇怪吗?设的网络结构是什么。

@shaomeiyang
Copy link
Author

这么奇怪吗?设的网络结构是什么。

我设置了这个struct=[x_dim,300,200,100,50,y_dim],

@shaomeiyang
Copy link
Author

这么奇怪吗?设的网络结构是什么。
其余参数是这样的
classifier = DBN(
hidden_act_func='sigmoid',
output_act_func='softmax',
loss_func='mse', # gauss 激活函数会自动转换为 mse 损失函数
struct=[x_dim,300,200,100,50,y_dim],
lr=1e-3,
momentum=0,
use_for='classification',
bp_algorithm='adam',
epochs=10,
batch_size=187,
dropout=0,
units_type=['gauss','bin'],
rbm_lr=0.3,
rbm_epochs=2,
cd_k=1)

@zhuofupan
Copy link
Owner

设这么大,跑着会卡吧,这个数据集挺大 -。- 我等下试试。

@shaomeiyang
Copy link
Author

设这么大,跑着会卡吧,这个数据集挺大 -。- 我等下试试。

好的哈哈 谢谢您!
我用自己的数据集没这个大,原来用matlab程序跑的这种结构,用您的程序做的时候也设成了这个结构,发现微调的时候损失不会下降,准确率也不提升。然后换了mnist数据发现还是这样。

@zhuofupan
Copy link
Owner

我还在挂机跑别的程序~~~

@zhuofupan
Copy link
Owner

没有发现啥问题:
struct=[x_dim, 400, 200, 100, 50, y_dim]

Start Pre-training...
Train RBM-1:
epoch = 3/3 | 「Train」: loss = 0.1116
Train RBM-2:
epoch = 3/3 | 「Train」: loss = 0.2839
Train RBM-3:
epoch = 3/3 | 「Train」: loss = 0.4127
Train RBM-4:
epoch = 3/3 | 「Train」: loss = 0.4805
Pre-training expend time = 76.27
Start Fine-tuning...
epoch = 10/10 | 「Train」: loss = 0.07526 , accuracy = 97.83% , expend time = 42.46 | 「Test」: accuracy = 97.93%
Show Testing result...
Class 1:
[Accuracy]: 99.08%
Class 2:
[Accuracy]: 98.77%
Class 3:
[Accuracy]: 98.16%
Class 4:
[Accuracy]: 98.12%
Class 5:
[Accuracy]: 97.66%
Class 6:
[Accuracy]: 97.65%
Class 7:
[Accuracy]: 97.7%
Class 8:
[Accuracy]: 97.96%
Class 9:
[Accuracy]: 96.61%
Class 10:
[Accuracy]: 97.42%
[Average accuracy]: 97.93%

@shaomeiyang
Copy link
Author

谢谢您及时回复,感动。我刚刚又试了一下,设为四层以后把参数换成您原来的,结果确实是正确的,问题可能出在我的参数rbm_lr=0.8这里了,我改为rbm_lr=1e-3又好了。可是在低于四层时,rbm_lr=0.8是没有问题的。奇怪,不太懂。。这个您知道为什么吗?

@zhuofupan
Copy link
Owner

zhuofupan commented Apr 23, 2019 via email

@zhuofupan
Copy link
Owner

0.8也太大了吧。

@shaomeiyang
Copy link
Author

好滴吧,我之前居然一直用这么大的。。那您用这个程序的时候rbm学习率一般在哪个范围呢,我们老师让我研究一下学习率的影响。

@zhuofupan
Copy link
Owner

10-3~10-4

@shaomeiyang
Copy link
Author

好的 谢谢您啦!

@aszhanghuali
Copy link

@shaomeiyang
您好,我想问您一下,您的DBN参数是怎样调试的呢?能不能给个思路?
谢谢!

@shaomeiyang
Copy link
Author

@shaomeiyang
您好,我想问您一下,您的DBN参数是怎样调试的呢?能不能给个思路?
谢谢!

我就只是在一个范围内,从小到大调试,看哪个效果最好用哪个,最后就按照作者说的1e-3附近这个范围做的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants