Py之neurolab:Python库之neurolab的简介、安装、使用方法之详细攻略

简介: Py之neurolab:Python库之neurolab的简介、安装、使用方法之详细攻略

neurolab的简介


   neurolab是一个简单而强大的Python神经网络库。包含基于神经网络、训练算法和灵活的框架来创建和探索其他神经网络类型。NeuroLab一个具有灵活网络配置和Python学习算法的基本神经网络算法库。为了简化库的使用,接口类似于MATLAB(C)的神经网络工具箱(NNT)的包。该库基于包NUMPY(http://NoPy.SimP.org),使用一些学习算法。

neurolab


neurolab的安装


pip install neurolab

image.png


neurolab的使用方法


Support neural networks types

Single layer perceptron

create function: neurolab.net.newp()

example of use: newp

default train function: neurolab.train.train_delta()

support train functions: train_gd, train_gda, train_gdm, train_gdx, train_rprop, train_bfgs, train_cg

Multilayer feed forward perceptron

create function: neurolab.net.newff()

example of use: newff

default train function: neurolab.train.train_gdx()

support train functions: train_gd, train_gda, train_gdm, train_rprop, train_bfgs, train_cg

Competing layer (Kohonen Layer)

create function: neurolab.net.newc()

example of use: newc

default train function: neurolab.train.train_cwta()

support train functions: train_wta

Learning Vector Quantization (LVQ)

create function: neurolab.net.newlvq()

example of use: newlvq

default train function: neurolab.train.train_lvq()

Elman Recurrent network

create function: neurolab.net.newelm()

example of use: newelm

default train function: neurolab.train.train_gdx()

support train functions: train_gd, train_gda, train_gdm, train_rprop, train_bfgs, train_cg

Hopfield Recurrent network

create function: neurolab.net.newhop()

example of use: newhop

Hemming Recurrent network

create function: neurolab.net.newhem()

example of use: newhem


Features:

Pure python + numpy

API like Neural Network Toolbox (NNT) from MATLAB

Interface to use train algorithms form scipy.optimize

Flexible network configurations and learning algorithms. You may change: train, error, initialization and activation functions

Unlimited number of neural layers and number of neurons in layers

Variety of supported types of Artificial Neural Network and learning algorithms

Example:

>>> import numpy as np

>>> import neurolab as nl

>>> # Create train samples

>>> input = np.random.uniform(-0.5, 0.5, (10, 2))

>>> target = (input[:, 0] + input[:, 1]).reshape(10, 1)

>>> # Create network with 2 inputs, 5 neurons in input layer and 1 in output layer

>>> net = nl.net.newff([[-0.5, 0.5], [-0.5, 0.5]], [5, 1])

>>> # Train process

>>> err = net.train(input, target, show=15)

Epoch: 15; Error: 0.150308402918;

Epoch: 30; Error: 0.072265865089;

Epoch: 45; Error: 0.016931355131;

The goal of learning is reached

>>> # Test

>>> net.sim([[0.2, 0.1]]) # 0.2 + 0.1

array([[ 0.28757596]])


 


相关文章
|
13天前
|
存储 缓存 JavaScript
python实战篇:利用request库打造自己的翻译接口
python实战篇:利用request库打造自己的翻译接口
26 1
python实战篇:利用request库打造自己的翻译接口
|
3天前
|
JSON API 数据格式
python的request库如何拿到json的返回值
python的request库如何拿到json的返回值
7 0
|
7天前
|
开发者 Python
Python中使用`requests`库进行文件上传与下载的技术详解
【4月更文挑战第12天】在Python的网络编程中,文件上传和下载是常见的需求。`requests`库作为一个强大且易用的HTTP客户端,为我们提供了简便的文件上传和下载功能。本文将详细介绍如何在Python中使用`requests`库进行文件上传和下载。
|
7天前
|
安全 API 开发者
Python中使用`requests`库进行请求头与自定义参数设置的技术详解
【4月更文挑战第12天】在Python中,`requests`库是一个强大且灵活的HTTP客户端,用于发送所有类型的HTTP请求。在发送请求时,我们经常需要设置请求头和自定义参数来满足不同的需求。本文将详细探讨如何在Python中使用`requests`库进行请求头和自定义参数的设置。
|
8天前
|
Ubuntu Python
python3安装clickhouse_sqlalchemy(greenlet) 失败
如果上述方法仍然无法解决问题,建议查阅相关错误信息和官方文档,以获取更详细的帮助。确保你的Python环境和依赖库都在最新版本,有时问题可能会因为版本不兼容而导致安装失败。
14 0
|
10天前
|
数据采集 自然语言处理 搜索推荐
一篇博客带你领略学习Python的第三方库---如何获取和安装第三方库,关于三种常见第三方库的下载和讲解(pyinstall库,jieba库,wordcloud库),更多第三方库的分类介绍
一篇博客带你领略学习Python的第三方库---如何获取和安装第三方库,关于三种常见第三方库的下载和讲解(pyinstall库,jieba库,wordcloud库),更多第三方库的分类介绍
|
12天前
|
数据采集 机器学习/深度学习 人工智能
Python环境搭建—安装Python3解释器
Python环境搭建—安装Python3解释器
31 2
|
12天前
|
数据采集 JavaScript C++
Python搭建编程环境-安装Python3解释器
Python搭建编程环境-安装Python3解释器
24 1
|
2月前
|
Linux 开发工具 C语言
30天python速成-第一天(python简介及下载安装)
30天python速成-第一天(python简介及下载安装)
49 3
|
2月前
|
Linux 开发者 iOS开发