使用MATLAB的神经网络 [英] Neural network using MATLAB

查看:132
本文介绍了使用MATLAB的神经网络的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a training set that has input and outputs in this way:

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中执行该算法的算法是什么?

I need to implement one linear layer neural network that can represent the data set best in MATLAB. What would be the algorithm to do it in MATLAB?

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

The target output is "1 for a particular class that the corresponding input belongs to and "0 for the remaining 2 outputs.

推荐答案

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

Consider this example of training a feed-forward ANN of one hidden layer (with 3 nodes). Since your data seems to have more output points than input, I'm using a demo dataset, but the idea is the same:

%# 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

显然,您需要访问神经网络工具箱.

Obviously you will need access to the Neural Network Toolbox.

这篇关于使用MATLAB的神经网络的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆