根据《python 神经网络编程》(【英】塔里克.拉希德 tariq r中国工信出版社,人民邮电出版社)进行了初步实践,发现该书是入门的不二之选。
环境:
1、IDE:sublime_txt,配合python的相关插件
2、编译运行环境,推荐使用virtualenv沙盒环境
程序
# neural network class definition
import numpy
import scipy.special
import matplotlib.pyplot as plt
class NeuralNetwork:
# initialise the neural network
def __init__(self, inputnodes, hiddennodes, outputnodes, learningrate):
# set number of nodes in each input,hidden,output layer
self.inodes = inputnodes
self.hnodes = hiddennodes
self.onodes = outputnodes
# link weight matrices , wih and who
# weights inside the arrays w_i_j, where link is from node i to node j in the next layer
self.wih = numpy.random.normal(
0.0, pow(self.hnodes, -0.5), (self.hnodes, self.inodes))
self.who = numpy.random.normal(