Make Your Own Neural Network

2018-10-09  本文已影响0人  巴喬書摘

Introduction

Part 1 - How They Work

如何根据偏差的平方和对于权重参数的梯度变化,来调整权重参数值。

Part 2 - DIY with Python

# neural network class definition
class neuralNetwork:
   
    # initialise the neural network
    def __init__():
        pass
   
    # train the neural network
    def train():
        pass
   
    # query the neural network
    def query():
        pass
    # 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
        # learning rate
        self.lr = learningrate
        pass

# number of input, hidden and output nodes
input_nodes = 3
hidden_nodes = 3
output_nodes = 3
# learning rate is 0.3
learning_rate = 0.3
# create instance of neural network
n = neuralNetwork(input_nodes,hidden_nodes,output_nodes, learning_rate)
上一篇 下一篇

猜你喜欢

热点阅读