`
deepfuture
  • 浏览: 4432227 次
  • 性别: Icon_minigender_1
  • 来自: 湛江
博客专栏
073ec2a9-85b7-3ebf-a3bb-c6361e6c6f64
SQLite源码剖析
浏览量:80373
1591c4b8-62f1-3d3e-9551-25c77465da96
WIN32汇编语言学习应用...
浏览量:70859
F5390db6-59dd-338f-ba18-4e93943ff06a
神奇的perl
浏览量:104125
Dac44363-8a80-3836-99aa-f7b7780fa6e2
lucene等搜索引擎解析...
浏览量:287657
Ec49a563-4109-3c69-9c83-8f6d068ba113
深入lucene3.5源码...
浏览量:15151
9b99bfc2-19c2-3346-9100-7f8879c731ce
VB.NET并行与分布式编...
浏览量:68405
B1db2af3-06b3-35bb-ac08-59ff2d1324b4
silverlight 5...
浏览量:32594
4a56b548-ab3d-35af-a984-e0781d142c23
算法下午茶系列
浏览量:46295
社区版块
存档分类
最新评论

神经网络-感知机(8)[matlab]

 
阅读更多

可以使用硬限幅

>> test

e =

       10000


e =

    -1     0    -1    -1    -1


Wij =

   -1.0428   -1.5146


b =

    -1     0    -1    -1    -1


e =

     0     1     0     0     0


Wij =

   -0.0428   -0.5146


b =

    -1     1    -1    -1    -1


e =

     0     0     0     0     0


Wij =

   -0.0428   -0.5146


b =

    -1     1    -1    -1    -1


net =

   -1.5146    0.4425   -1.5146   -1.0428   -1.0428


y =

     0     1     0     0     0

%感知机的学习过程,and运算 
P=[0 1 0 1 1;1 1 1 0 0];
T=[0 1 0 0 0];
[M,N]=size(P);
[L,N]=size(T);
%权值矩阵
Wij=rand(L,M);
%阈值矩阵
b=zeros(L,1);
e=10000
while (mae(e)>0.0015)
   net=netsum(Wij*P,b);
   y=hardlim(net);
   e=T-y
   Wij=Wij+e*P'
   b=b+e 
end
net=netsum(Wij*P,b)
y=hardlim(net)

 

 

 

 

 

 help netsum
 NETSUM Sum net input function.
 
  Syntax
 
    N = netsum({Z1,Z2,...,Zn},FP)
    dN_dZj = netsum('dz',j,Z,N,FP)
    INFO = netsum(CODE)
 
  Description
 
    NETSUM is a net input function.  Net input functions calculate
    a layer's net input by combining its weighted inputs and bias.
 
    NETSUM({Z1,Z2,...,Zn},FP) takes Z1-Zn and optional function parameters,
      Zi - SxQ matrices in a row cell array.
      FP - Row cell array of function parameters (ignored).
    Returns element-wise sum of Z1 to Zn.
 
    NETSUM('dz',j,{Z1,...,Zn},N,FP) returns the derivative of N with
    respect to Zj.  If FP is not supplied the default values are used.
    if N is not supplied, or is [], it is calculated for you.
 
    NETSUM('name') returns the name of this function.
    NETSUM('type') returns the type of this function.
    NETSUM('fpnames') returns the names of the function parameters.
    NETSUM('fpdefaults') returns default function parameter values.
    NETSUM('fpcheck',FP) throws an error for illegal function parameters.
    NETSUM('fullderiv') returns 0 or 1, if the derivate is SxQ or NxSxQ.
 
  Examples
 
    Here NETSUM combines two sets of weighted input vectors and a bias.
    We must use CONCUR to make B the same dimensions as Z1 and Z2.
 
      z1 = [1 2 4; 3 4 1]
      z2 = [-1 2 2; -5 -6 1]
      b = [0; -1]
      n = netsum({z1,z2,concur(b,3)})
 
    Here we assign this net input function to layer i of a network.
 
      net.layers{i}.netFcn = 'compet';
 
    Use NEWP or NEWLIN to create a standard network that uses NETSUM.
 
 hardlim通过计算网络的输入得到该层的输出,如果网络的输入达到门限,则输出1,否则输出0,

配合netsum函数,可以构造感知机的学习过程

 help hardlim
 HARDLIM Hard limit transfer function.
  
  Syntax
 
    A = hardlim(N,FP)
    dA_dN = hardlim('dn',N,A,FP)
    INFO = hardlim(CODE)
 
  Description
 
    HARDLIM is a neural transfer function.  Transfer functions
    calculate a layer's output from its net input.
 
    HARDLIM(N,FP) takes N and optional function parameters,
      N - SxQ matrix of net input (column) vectors.
      FP - Struct of function parameters (ignored).
    and returns A, the SxQ boolean matrix with 1's where N >= 0.
  
    HARDLIM('dn',N,A,FP) returns SxQ derivative of A w-respect to N.
    If A or FP are not supplied or are set to [], FP reverts to
    the default parameters, and A is calculated from N.
 
    HARDLIM('name') returns the name of this function.
    HARDLIM('output',FP) returns the [min max] output range.
    HARDLIM('active',FP) returns the [min max] active input range.
    HARDLIM('fullderiv') returns 1 or 0, whether DA_DN is SxSxQ or SxQ.
    HARDLIM('fpnames') returns the names of the function parameters.
    HARDLIM('fpdefaults') returns the default function parameters.
  
  Examples
 
    Here is how to create a plot of the HARDLIM transfer function.
  
      n = -5:0.1:5;
      a = hardlim(n);
      plot(n,a)
 
    Here we assign this transfer function to layer i of a network.
 
      net.layers{i}.transferFcn = 'hardlim';
 
  Algorithm
 
      hardlim(n) = 1, if n >= 0
                   0, otherwise

 

 

>> help hardlims
 HARDLIMS Symmetric hard limit transfer function.
  
  Syntax
 
    A = hardlims(N,FP)
    dA_dN = hardlims('dn',N,A,FP)
    INFO = hardlims(CODE)
 
  Description
  
    HARDLIMS is a neural transfer function.  Transfer functions
    calculate a layer's output from its net input.
 
    HARDLIMS(N,FP) takes N and optional function parameters,
      N - SxQ matrix of net input (column) vectors.
      FP - Struct of function parameters (ignored).
    and returns A, the SxQ +1/-1 matrix with +1's where N >= 0.
  
    HARDLIMS('dn',N,A,FP) returns SxQ derivative of A w-respect to N.
    If A or FP are not supplied or are set to [], FP reverts to
    the default parameters, and A is calculated from N.
 
    HARDLIMS('name') returns the name of this function.
    HARDLIMS('output',FP) returns the [min max] output range.
    HARDLIMS('active',FP) returns the [min max] active input range.
    HARDLIMS('fullderiv') returns 1 or 0, whether DA_DN is SxSxQ or SxQ.
    HARDLIMS('fpnames') returns the names of the function parameters.
    HARDLIMS('fpdefaults') returns the default function parameters.
  
  Examples
 
    Here is how to create a plot of the HARDLIMS transfer function.
  
      n = -5:0.1:5;
      a = hardlims(n);
      plot(n,a)
 
    Here we assign this transfer function to layer i of a network.
 
      net.layers{i}.transferFcn = 'hardlims';
 
  Algorithm
 
      hardlims(n) = 1, if n >= 0
                   -1, otherwise

 

hardlims达到门限输出为1,否则输出-1

>> a=[-5:0.5:5]

a =

  Columns 1 through 6

   -5.0000   -4.5000   -4.0000   -3.5000   -3.0000   -2.5000

  Columns 7 through 12

   -2.0000   -1.5000   -1.0000   -0.5000         0    0.5000

  Columns 13 through 18

    1.0000    1.5000    2.0000    2.5000    3.0000    3.5000

  Columns 19 through 21

    4.0000    4.5000    5.0000

>> c=hardlim(a)

c =

  Columns 1 through 11

     0     0     0     0     0     0     0     0     0     0     1

  Columns 12 through 21

     1     1     1     1     1     1     1     1     1     1

>> d=hardlims(a)

d =

  Columns 1 through 11

    -1    -1    -1    -1    -1    -1    -1    -1    -1    -1     1

  Columns 12 through 21

     1     1     1     1     1     1     1     1     1     1

>>

分享到:
评论

相关推荐

    NJUST机器学习课后作业python实现-朴素贝叶斯-神经网络-感知机-softmax回归-逻辑回归+源代码+文档说明

    1、资源内容:NJUST机器学习课后作业python实现-朴素贝叶斯-神经网络-感知机-softmax回归-逻辑回归+源代码+文档说明 2、代码特点:内含运行结果,不会运行可私信,参数化编程、参数可方便更改、代码编程思路清晰、...

    MATLAB神经网络-线性神经网络

    除了基础的线性神经网络,MATLAB神经网络工具箱还支持更复杂的模型,如多层感知机(MLP)、径向基函数网络(RBF)、自组织映射(SOM)等。线性网络虽然在处理非线性问题时表现有限,但在某些特定场景,如数据线性可...

    神经网络模型及其MATLAB仿真程序设计.zip_matlab神经网络_神经网络 matlab_神经网络模型_神经网络模型及其M

    8. **神经网络的应用**:神经网络模型广泛应用于图像识别、自然语言处理、机器翻译、推荐系统、金融市场预测等多个领域。MATLAB的神经网络工具箱使得这些复杂模型的实现变得相对简单。 9. **案例研究**:通过具体的...

    MATLAB神经网络.zip_BP神经网络_matlab 感知机xor_matlab神经网络_单层BP神经_单层感知器

    本资料包“MATLAB神经网络.zip”包含了多个关于神经网络的学习资源,特别是BP神经网络、MATLAB中的感知机解决XOR问题以及单层神经网络的相关实现。 **BP神经网络**(Backpropagation Neural Network)是模拟人脑...

    BP神经网络的人脸识别matlab代码

    此外,多层感知机(MLP)是BP神经网络的一种实现,也可以考虑使用其他类型的神经网络,如卷积神经网络(CNN)或循环神经网络(RNN),它们在处理图像数据时通常能取得更好的性能。 总之,本项目展示了如何在MATLAB...

    Matlab神经网络课件-神经网络入门教程.rar

    【Matlab神经网络课件-神经网络入门教程】 在当今的科技领域,神经网络作为一种强大的机器学习工具,被广泛应用于各种复杂问题的解决,如图像识别、自然语言处理、预测模型构建等。Matlab作为一款强大的数值计算...

    perception_感知机_matlab_perception_

    感知机虽然简单,但它为理解更复杂的神经网络模型奠定了基础,例如多层感知机(MLP)和深度学习模型。同时,感知机在处理线性可分问题时效率高,易于理解和实现,对于初学者来说是一个很好的入门选择。 总之,通过...

    Matlab实现反向传播学习的多层感知器 (MLP) 神经网络算法

    **Matlab实现反向传播学习的多层感知器(MLP)神经网络算法** 多层感知器(Multilayer Perceptron, MLP)是一种广泛应用的人工神经网络模型,尤其在模式识别、函数拟合和分类任务中表现出色。在Matlab环境中,我们...

    人工神经网络模型matlab源码-合集

    除了以上两个案例,这个源码合集可能还包含了其他类型的神经网络模型,如RBF(Radial Basis Function,径向基函数网络)用于非线性映射,SVM(Support Vector Machine,支持向量机)用于高维空间的分类或回归,或者...

    Matlab与神经网络工具箱.pdf

    课程中提到了几种经典的神经网络模型,如感知机(Perceptron)、线性神经网络(Adaline)和后向传播网络(Backpropagation)。感知机是一种简单的二分类模型,能解决线性可分问题;Adaline网络通过在线学习调整权重,能够...

    matlab神经网络基础

    2.2 感知器神经网络模型与学习算法 2.2.1 单层感知器 2.2.2 单层感知器的学习算法 2.2.3 单层感知器的MATLAB实现 2.2.4 多层感知器 2.3 线性神经网络模型与学习算法 2.3.1 线性神经元网络模型 2.3.2 线性神经网络的...

    MATLAB实现MLP多层感知机时间序列预测(完整源码和数据)

    标题中的“MATLAB实现MLP多层感知机时间序列预测”指的是使用MATLAB编程语言,通过多层感知机(Multilayer Perceptron, MLP)神经网络模型对时间序列数据进行预测的一种方法。多层感知机是一种前馈神经网络,具有...

    神经网络理论与MATLAB7实现.part2(PDF)

    神经网络理论与MATLAB7实现.part1的下载地址: http://download.csdn.net/source/663471 第1章 概述 1.1 MATLAB语言简介 1.1.1 MATLAB概述 1.1.2 MATLAB语言特点 1.1.3 MATLAB 7的安装 1.1.4 MATLAB 7的新特点 ...

    13.MATLAB神经网络43个案例分析 并行运算与神经网络-基于CPUGPU的并行神经网络运算.zip

    1. **MATLAB神经网络工具箱**:MATLAB神经网络工具箱提供了丰富的函数和类,包括前馈网络(如多层感知机、径向基函数网络等)、自适应滤波器、联想记忆、模糊逻辑系统、遗传算法等,便于用户快速搭建神经网络模型。...

    MATLAB神经网络原理与实例精解pdf

    本书首先会介绍神经网络的基本概念,包括感知机、多层前馈网络和反向传播算法。然后,将详细讲解如何在MATLAB中搭建这些网络,包括网络结构的设计、权重初始化、激活函数的选择以及损失函数的设定。接下来,将深入...

    感知机(单层感知机)可视化 matlab实现

    感知机是一种早期的人工神经网络模型,主要用于二分类问题,是机器学习中的基础算法之一。在本项目中,我们将探讨如何使用MATLAB实现单层感知机,并进行可视化展示。 单层感知机是一种线性分类器,其核心思想是通过...

    MATLAB神经网络30个案例分析-全文PDF及源程序,matlab神经网络43个案例分析,matlab源码.zip

    本资料包包含“MATLAB神经网络30个案例分析-全文PDF及源程序”和“matlab神经网络43个案例分析,matlab源码”,是学习和实践MATLAB神经网络的宝贵资源。 首先,从“MATLAB神经网络30个案例分析-全文PDF”中,我们...

    41.MATLAB神经网络43个案例分析 遗传算法优化BP神经网络-非线性函数拟合.zip

    2. **BP神经网络的构建**:理解多层感知机的工作原理,包括前向传播和反向传播过程。这包括输入层、隐藏层和输出层的概念,以及激活函数(如sigmoid或tanh)的选择。 3. **遗传算法的实现**:了解遗传算法的基本...

    神经网络理论与MATLAB7实现

    第1章 概述 1.1 MATLAB语言简介 1.1.1 MATLAB概述 1.1.2 MATLAB语言特点 1.1.3 MATLAB 7的安装 ...第8章 基于神经网络的故障诊断 第9章 基于神经网络的预测 第10章 基于神经网络的模糊控制 参考文献

    单层感知器MATLAB代码

    感知器(Perceptron),是神经网络中的一个概念,在1950s由Frank Rosenblatt第一次引入。 单层感知器(Single Layer Perceptron)是最简单的神经网络。它包含输入层和输出层,而输入层和输出层是直接相连的。 与最早...

Global site tag (gtag.js) - Google Analytics