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. JavaScript 中的 NaN 和 isNaN

    1.NaN NaN 即 Not a Number , 不是一个数字.那么 NaN 到底是什么呢? 在 JavaScript 中,整数和浮点数都统称为 Number 类型 .除此之外,Number 类型 ...

  2. Golang之并发篇

    进程和线程 A.进程是程序在操作系统中的一次执行过程,系统进行资源分配和调度的一个独立单位. B.线程是进程的一个执行实体,是CPU调度和分派的基本单位,它是比进程更小的能独立运行的基本单位. C.一 ...

  3. makefile all

    all:udps udpc udps:udpserv.c    gcc -Wall -o udps udpserv.cudpc:udpclient.c    gcc -Wall -o udpc udp ...

  4. servlet 中 service ,doGet , doPost 关系

    web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2 ...

  5. arm家族小检阅

  6. Check time of different search methods

    https://github.com/Premiumlab/Python-for-Algorithms--Data-Structures--and-Interviews/blob/master/Moc ...

  7. Cygwin工具的简单使用

    简介 从使用角度来看:Cygwin就是一个windows软件,该软件就是在windows上仿真linux操作系统.简言之,cygwin是一个在windows平台上运行的 linux模拟环境,使用一个D ...

  8. DataGrid组件

    <?xml version="1.0" encoding="utf-8"?><s:WindowedApplication xmlns:fx=& ...

  9. python读取文件另存为

    fr = open(filename_r,encoding='cp852') w2 = open(filename_w,'a')#a代表追加 w代表重写 for line in fr: w2.writ ...

  10. linux cpu过高原因及代码定位

    1. top命令查看CPU和内存占用率 top回车,然后按1 发现进程PID 35163 CPU和内存占用率都很高 top - 06:13:47 up  5:31,  1 user,  load av ...