neurolab模块相当于Matlab的神经网络工具箱(NNT)

neurolab模块支持的网络类型:

  • 单层感知机(single layer perceptron)
  • 多层前馈感知机(Multilayer feed forward perceptron)
  • 竞争层(Kohonen Layer)
  • 学习向量量化(Learning Vector Quantization)
  • Elman循环网络(Elman recurrent network)
  • Hopfield循环网络(Hopfield recurrent network)
  • 卷边循环网络(Hemming recurrent network)

这里以多层前馈网络为例:neurolab.net.newff(minmaxsizetransf=None)

Parameters:
minmax: list of list, the outer list is the number of input neurons,

inner lists must contain 2 elements: min and max

Range of input value

size: the length of list equal to the number of layers except input layer,

the element of the list is the neuron number for corresponding layer

Contains the number of neurons for each layer

transf: list (default TanSig)

List of activation function for each layer

minmax:列表的列表,外层列表表示输入层的神经元个数,内层列表必须包含两个元素:max和min

size:列表的长度等于出去输入层的网络的层数,列表的元素对应于各层的神经元个数

transf:激活函数,默认为TanSig。

举例2:

perceptron = nl.net.newp([[0, 2],[0, 2]], 1)
第一个参数列表的长度表示输出的节点的个数,列表中得每一个元素包含两个值:最大值和最小值。
第二个参数:The value “1” indicates that there is a single neuron in this network.
error = perceptron.train(input_data, output, epochs=50, show=15, lr=0.01)
epochs:表示迭代训练的次数,show:表示终端输出的频率,lr:表示学习率

举例3:

import numpy as np
import neurolab as nl input = np.random.uniform(0, 0.1, (1000, 225))
output = input[:,:10] + input[:,10:20]
# 2 layers with 225 inputs 50 neurons in hidden\input layer and 10 in output
# for 3 layers use some thet: nl.net.newff([[0, .1]]*225, [50, 40, 10])
net = nl.net.newff([[0, .1]]*225, [50, 10])
net.trainf = nl.train.train_bfgs e = net.train(input, output, show=1, epochs=100, goal=0.0001)

举例4:

import neurolab as nl
import numpy as np
# Create train samples
x = np.linspace(-7, 7, 20)
y = np.sin(x) * 0.5 size = len(x) inp = x.reshape(size,1)
tar = y.reshape(size,1) # Create network with 2 layers and random initialized
net = nl.net.newff([[-7, 7]],[5, 1]) # Train network
error = net.train(inp, tar, epochs=500, show=100, goal=0.02) # Simulate network
out = net.sim(inp) # Plot result
import pylab as pl
pl.subplot(211)
pl.plot(error)
pl.xlabel('Epoch number')
pl.ylabel('error (default SSE)') x2 = np.linspace(-6.0,6.0,150)
y2 = net.sim(x2.reshape(x2.size,1)).reshape(x2.size)
print(len(y2))
y3 = out.reshape(size)
pl.subplot(212)
pl.plot(x2, y2, '-',x , y, '.', x, y3, 'p')
pl.legend(['train target', 'net output'])
pl.show()

资料还有很多,以后继续补充

重点参考:官网
资料

python 神经网络包 NeuroLab的更多相关文章

  1. 搭建基于python +opencv+Beautifulsoup+Neurolab机器学习平台

    搭建基于python +opencv+Beautifulsoup+Neurolab机器学习平台 By 子敬叔叔 最近在学习麦好的<机器学习实践指南案例应用解析第二版>,在安装学习环境的时候 ...

  2. 【转】pybrain的使用——一个开源的python神经网络工具包

    原文地址   http://lavimo.blog.163.com/blog/static/2149411532013911115316263/ 昨天的主要活动内容是找一个神经网络的包....= =这 ...

  3. LFD,非官方的Windows二进制文件的Python扩展包

    LFD,非官方的Windows二进制文件的Python扩展包 LFD,非官方版本.32和64位.Windows.二进制文件.科学开源.Python扩展包 克里斯托夫·戈尔克(by Christoph ...

  4. python库包大全(转)

    python 库资源大全 转自: Python 资源大全中文版 环境管理 管理 Python 版本和环境的工具 p:非常简单的交互式 python 版本管理工具.官网 pyenv:简单的 Python ...

  5. TensorFlow常用Python扩展包

    TensorFlow常用Python扩展包 TensorFlow 能够实现大部分神经网络的功能.但是,这还是不够的.对于预处理任务.序列化甚至绘图任务,还需要更多的 Python 包. 下面列出了一些 ...

  6. 机器学习常用Python扩展包

    在Ubuntu下安装Python模块通常有3种方法:1)使用apt-get:2)使用pip命令(推荐);3)easy_instal 可安装方法参考:[转]linux和windows下安装python集 ...

  7. Python的包管理工具Pip (zz )

    Python的包管理工具Pip 接触了Ruby,发现它有个包管理工具RubyGem很好用,并且有很完备的文档系统http://rdoc.info 发现Python下也有同样的工具,包括easy_ins ...

  8. 简易安装python统计包

    PythonCharm简易安装python统计包及 本文介绍使用pythonCharm IDE 来安装Python统计包或一些packages的简单过程,基本无任何技术难度,顺便提一提笔者在安装过程中 ...

  9. 安装python 的 包 paramiko

    安装python 的 包 paramiko 安装 依赖 yum -y install gcc python-devel 获取安装 pycryptowget https://pypi.python.or ...

随机推荐

  1. IIS PHP Warning: Unknown: open(c:\\php\\tmp\\sess_xxx, O_RDWR) failed: Permission denied (13) in Unknown on line 0

    出现这个问题的原因是你修改了php保存session的路径,但没有给用户访问该目录的权限.   右键该目录,给users用户组读.写的权限.

  2. Spring框架的事务管理之基于AspectJ的注解方式(重点掌握,最简单的方式)

    1. 步骤一:恢复转账的开发环境(具体开发环境实现见:https://www.cnblogs.com/wyhluckdog/p/10137283.html)2. 步骤二:applicationCont ...

  3. 《Ubuntu标准教程》学习总结

    第6章 Shell Shell就是一个命令解释器,负责完成用户与内核之间的交互. 目前流行电Shell主要有:Bourne Shell( sh ).Bourne Again Shell( Bash ) ...

  4. cmake重新编译

    删除文件夹下的文件 rm CMakeCache.txt 重新编译即可 安装g++ yum install gcc-c++

  5. canvas标签的基本用法

    1.canvas和其他标签一样使用,但是IE8以下是不支持的,可以在canvas里面加一个span用来提示,例如: <canvas> <span>IE8不支持canvas< ...

  6. 8.14 右键自定义菜单 更加iframe 内容高度调整 iframe高度 js定时

    <div class="main_contain" id="z_div" style="position: relative;"> ...

  7. /etc/inittab加入自动启动格式

    R01:35:respawn:/usr/bin/exe_program 说明 R01:标识,每一行必须唯一(R01并无特殊含义,可自定义). 35:有效模式,3字符界面启动,5图形界面启动 respa ...

  8. sql中 in 、not in 、exists、not exists 用法和差别

    % 的一类. NOTIN:通过 NOTIN 关键字引入的子查询也返回一列零值或更多值. 以下查询查找没有出版过商业书籍的出版商的名称. SELECT pub_name FROM publishers ...

  9. [开源,学习,分享]UWP第三方简书客户端分享

    简介 Windows10正式版发布到现在,我利用零零碎碎的一些时间对UWP进行一些学习,也基于这门技术开发了一个第三方的简书App. 基本界面 优酷视频: http://v.youku.com/v_s ...

  10. window.load 和$(document).ready() 、window.load和body onload区别

    1.执行时间 window.onload必须等到页面内包括图片的所有元素加载完毕后才能执行. $(document).ready()是DOM结构绘制完毕后就执行,不必等到加载完毕.2.编写个数不同 w ...