Skip to main content
 首页 » 编程设计

python neurolab 前馈神经网络

2025年05月04日8bhlsheji

谁能向我解释一下如何使用这个库:

http://code.google.com/p/neurolab/

创建一个遵循这些规则的神经网络:

  1. 多层前馈:3 层,225 个输入,50 个隐藏层和 10 个输出层

    (因为输入是 15x15 黑白图像,输出是 10 位数字)

  2. 反向错误传播

我在 OSX 上安装 PyBrain 时遇到问题,也许这样会更容易。

请您参考如下方法:

一些: 将 numpy 导入为 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) 

参见示例 http://packages.python.org/neurolab/ex_newff.html 和文档:http://packages.python.org/neurolab/lib.html#neurolab.train.train_bfgs