Guest User

Untitled

a guest
Nov 22nd, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. import numpy
  2.  
  3. #neural network class definition
  4. class neuralNetwork:
  5.  
  6. #initialize the neural network
  7. def __init__(self, inputnodes, hiddennodes, outputnodes, learningrate):
  8. # set number of nodes in each input, hidden, output layer
  9. self.inodes = inputnodes
  10. self.hnodes = hiddennodes
  11. self.onodes = outputnodes
  12.  
  13. #learning rate
  14. self.lr = learningrate
  15. pass
  16.  
  17. #train the neural network
  18. def train():
  19. pass
  20.  
  21. #query the neural network
  22. def query():
  23. pass
  24.  
  25. #number of input, hidden and output nodes
  26. input_nodes = 3
  27. hidden_nodes = 3
  28. output_nodes = 3
  29.  
  30. #learning rate is 0.3
  31. learning_rate = 0.3
  32.  
  33. #create instance of neural network
  34. n = neuralNetwork(input_nodes, hidden_nodes, output_nodes, learning_rate)
  35.  
  36. numpy.random.rand(3, 3)-0.5
  37.  
  38. #link weight matrices, wih and who
  39. #weights inside the arrays are w_i_j, where link is from node i to node j in
  40. the next layer
  41. #w11 w21
  42. #w12 w22 etc
  43. self.wih = (numpy.random.rand(self.hnodes, self.inodes) - 0.5)
  44. self.who = (numpy.random.rand(self.onodes, self.hnodes) - 0.5)
Add Comment
Please, Sign In to add comment