在Matlab中解释神经网络的输出 [英] Interpret the output of neural network in matlab

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

问题描述

我建立了一个带有3个类的神经网络模型.我知道分类过程的最佳输出是一个类的布尔值1和其他类的布尔零值,例如某个类的最佳分类结果,其中classifire的输出导致此数据量是多少属于此类的向量中的第一个元素是[1、0、0].但是测试数据的输出将不是这样,而是像[2.4,-1,.6]这样的有理数,那么如何解释这个结果呢?如何确定测试数据属于哪一类?

我试图取绝对值并将最大元素设置为1,将另一个元素设置为零,这是正确的吗?

解决方案

学习者.

看来您的神经网络设计不正确.

无论您的结构是-input-hidden-output-layers的数量是多少,当您进行多分类问题时,都必须确保每个输出神经元都在评估一个单独的类,即,它们每个都有一个有界输出,在这种情况下,介于0和1之间.请使用输出层上几乎所有已定义的函数来执行此操作.

雀巢,为了使神经网络正常工作,您必须牢记,每个神经元回路-从输入到输出-均作为分类器起作用,也就是说,它们在您的区域中定义了一个区域将要分类的输入空间.

在此框架下,每个神经元在NN定义的非线性扩展上具有直接的可解释意义,尤其是在隐藏层很少的情况下.神经网络的一般表达可以确保这一点:

Y_out=F_n(Y_n-1*w_n-t_n) ... Y_1=F_0(Y_in-1*w_0-t_0)

例如,具有径向基础神经元- F_n=sqrt(sum(Yni-Rni)^2)w_n=1(身份):

Yn+1=sqrt(sum(Yni-Rni)^2)

dn-昏暗的球形-dn n-1层的尺寸-聚类分类是从第一层开始的.类似地,诱发椭圆簇.当在球形/椭圆形簇的结构下添加两个<径向>神经元层时,会引起球形/椭圆形簇的并集和交集,三层是前者的并集和交集,依此类推. /p>

使用线性神经元时- F_n=(.)(同一性),归纳出线性分类器,即输入空间除以dn -dim超平面,当相加两层时,归纳出超平面的并集和交点,三层分别是超平面的并集和交点.上一个,依此类推.

因此,您可以意识到每层神经元的数量是每个类别的分类器的数量.因此,如果空间的几何形状实际上是用图形表示的,则将A类的两个簇,B类的一个簇和C类的三个簇,每层至少需要六个神经元.因此,假设您可以期望得到任何结果,您可以将其视为非常粗略的近似值,即每层每类n个神经元,即每层每类n个神经元到n^2个最小神经元.可以根据分类的拓扑来增加或减少此数目.

最后,最好的建议是对n个输出(类),r个输入:

  1. 在第一层具有径向或线性的r个良好的分类器神经元,可根据您的期望分割空间,
  2. 每层具有nn^2个神经元,或者根据您所遇到的问题而不同,
  3. 具有2-3层,只有在获得清晰结果后才增加此数字,
  4. 在最后一层(只有一层)具有n阈值网络,作为从0到1的连续函数(使代码清晰)

干杯...

I have build a neural network model, with 3 classes. I understand that the best output for a classification process is the boolean 1 for a class and boolean zeros for the other classes , for example the best classification result for a certain class, where the output of a classifire that lead on how much this data are belong to this class is the first element in a vector is [1 , 0 , 0]. But the output of the testing data will not be like that,instead it will be a rational numbers like [2.4 ,-1 , .6] ,So how to interpret this result? How to decide to which class the testing data belong?

I have tried to take the absolute value and turn the maximum element to 1 and the other to zeros, so is this correct?

解决方案

Learner.

It appears your neural network is bad designed.

Regardless your structure is -number of input-hidden-output- layers, when you are doing a multiple classification problem, you must ensure each of your output neurones are evaluating an individual class, that is, each them has a bounded output, in this case, between 0 and 1. Use almost any of the defined function on the output layer for performing this.

Nevertheles, for the Neural Network to work properly, you must strongly remember, that every single neuron loop -from input to output- operates as a classificator, this is, they define a region on your input space which is going to be classified.

Under this framework, every single neuron has a direct interpretable sense on the non-linear expansion the NN is defining, particularly when there are few hidden layers. This is ensured by the general expression of Neural Networks:

Y_out=F_n(Y_n-1*w_n-t_n) ... Y_1=F_0(Y_in-1*w_0-t_0)

For example, with radial basis neurons -i.e. F_n=sqrt(sum(Yni-Rni)^2) and w_n=1 (identity):

Yn+1=sqrt(sum(Yni-Rni)^2)

a dn-dim spherical -being dn the dimension of the n-1 layer- clusters classification is induced from the first layer. Similarly, elliptical clusters are induced. When two radial basis neuron layers are added under that structure of spherical/elliptical clusters, unions and intersections of spherical/elliptical clusters are induced, three layers are unions and intersections of the previous, and so on.

When using linear neurons -i.e. F_n=(.) (identity), linear classificators are induced, that is, the input space is divided by dn-dim hyperplanes, and when adding two layers, union and intersections of hyperplanes are induced, three layers are unions and intersections of the previous, and so on.

Hence, you can realize the number of neurons per layer is the number of classificators per each class. So if the geometry of the space is -lets put this really graphically- two clusters for the class A, one cluster for the class B and three clusters for the class C, you will need at least six neurons per layer. Thus, assuming you could expect anything, you can consider as a very rough approximate, about n neurons per class per layer, that is, n neurons to n^2 minumum neurons per class per layer. This number can be increased or decreased according the topology of the classification.

Finally, the best advice here is for n outputs (classes), r inputs:

  1. Have r good classificator neurons on the first layers, radial or linear, for segmenting the space according your expectations,
  2. Have n to n^2 neurons per layer, or as per the dificulty of your problem,
  3. Have 2-3 layers, only increase this number after getting clear results,
  4. Have n thresholding networks on the last layer, only one layer, as a continuous function from 0 to 1 (make the crisp on the code)

Cheers...

这篇关于在Matlab中解释神经网络的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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