Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
回复
 
主题工具 显示模式
旧 2019-12-10, 20:48   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
帖子 使用MATLAB的神经网络

我有一个训练集,它以这种方式输入和输出:

Input: 0.832 64.643 0.818 78.843 1.776 45.049 0.597 88.302 1.412 63.458 1.468 49.535 1.985 33.387 2.073 30.279 1.431 55.231 1.116 68.521 1.617 44.362 2.159 66.512 Output: 0 0 1 0 0 1 0 1 0 0 0 1 0 0 1 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 0 0 1 0 0 1 0 我需要实现一个线性层神经网络,它可以代表MATLAB中最好的数据集。在MATLAB中执行该算法的算法是什么?

目标输出对于相应输入所属的特定类别为“ 1”,对于其余2个输出为“ 0”。



回答:

考虑这个训练一个隐藏层(具有3个节点)的前馈ANN的示例。由于您的数据似乎具有比输入更多的输出点,因此我使用的是演示数据集,但想法是相同的:

%# load sample data laod simpleclass_dataset input = simpleclassInputs; %# 2x1000, 2-dimensional points output = simpleclassTargets; %# 4x1000, 4 classes %# split data into training/testing sets trainInd = 1:500; testInd = 501:1000; %# create ANN and initialize network weights net = newpr(input, output, 3); net = init(net); net.trainParam.epochs = 25; %# max number of iterations %# learn net weights from training data net = train(net, input(:,trainInd), output(:,trainInd)); %# predict output of net on testing data pred = sim(net, input(:,testInd)); %# classification confusion matrix [err,cm] = confusion(output(:,testInd), pred); 输出为:

err = 0.075075 cm = 81 0 0 0 0 82 0 0 9 0 52 16 0 0 0 93 显然,您需要访问神经网络工具箱。



更多&回答...
poster 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 01:20


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.