设计一个感知器来判断奇偶性,例如 1 2 3 4
设计一个感知器,实现一个判断奇偶校验 1 2 3 4 ....使用 matlab 我已经训练了一个神经网络,但它有很大的方差。
我想问样品如何快递?
如果我直接用1 2 3 4 5...作为样本,方差就非常大了。换句话说,神经网络不是用来分类的。
我想问是否可以使用其他函数来转换样本?
这是程序:
P= [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14]; % Question if I can use another form to express the sample
T= [1 0 1 0 1 0 1 0 1 0 1 0 1 0 1];
net=newp([-1 10],1);
net.trainParam.epochs = 40;
net=train(net,P,T);
Y=sim(net,P)
E1=mae(Y-T)
plotpv(P,Y);
plotpc(net.iw{1},net.b{1})
Devise a perceptron, achieve a function that judges parity of 1 2 3 4 ....using matlab I have train a neural network, but it has very large variance.
I want to ask how to express sample?
If I directly use 1 2 3 4 5...as sample, the variance is very large. In the other words, the neural network is not used to classfiy.
I want to ask if the other functions can be used to transform the sample?
This is the program:
P= [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14]; % Question if I can use another form to express the sample
T= [1 0 1 0 1 0 1 0 1 0 1 0 1 0 1];
net=newp([-1 10],1);
net.trainParam.epochs = 40;
net=train(net,P,T);
Y=sim(net,P)
E1=mae(Y-T)
plotpv(P,Y);
plotpc(net.iw{1},net.b{1})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我完全理解你的问题......但是,我认为值得一提的是(单层)感知器(众所周知)无法计算异或 (XOR)。二进制逻辑异或函数相当于计算两位的奇偶校验。因此,虽然我不熟悉特定的 Matlab 软件包,但我希望您需要一个多层感知器……也许层数比输入字符串中的位数还要多。如果您要使用层数太少的感知器模型 - 我希望您无法训练它来计算奇偶校验位。
计算奇偶校验并不是感知器最适合的任务。 :)
I'm not sure I fully understand your question... but, I thought it worth mentioning that the (single layer) perceptron is (famously) unable to compute exclusive-or (XOR). The binary logic XOR function is equivalent to calculating parity for two bits. For this reason, while I'm not familiar with that specific Matlab package, I expect you to need a multi-layer perceptron... perhaps one with more layers than bits in the input string. If you were to use a perceptron model with too few layers - I'd expect you to fail to train it to calculate parity bits.
Calculating parity is not a task to which the perceptron is ideally suited. :)