title: 'Neural_Network' object has no attribute 'w1', but I think it does
body: <p>I am trying to get into Neural Networks and wanted to test some code from a video I am watching, but I keep getting the error, " Neural_Network object has no attribute w1", and I can't seem to figure it out. I went through many related stackoverflows, but they don't seem to answer the question, and since I haven't done any object-oriented programming for python before, I do not understand what is going on. </p>
  
  <p>When I looked through the code, I thought that self.w1 was being set as a local variable so I tried to instantiate it and set is as a global variable above the constructor declaration, but that didn't work. </p>
  
  <pre><code>import numpy as np
  class Neural_Network(object):
  
  def _init_(self):
      self.inputLayerSize = 2
      self.outputLayerSize = 1
      self.hiddenLayerSize = 3
  
      self.w1 = np.random.randn(self.inputLayerSize, self.hiddenLayerSize)
      self.w2 = np.random.randn(self.hiddenLayerSize, self.outputLayerSize)
  
  def forward(self, x):
      self.z2= np.dot(x, self.w1)
      self.a2 = self.sigmoid(self.layer1)
      self.z3 = np.dot(self.a2,self.w2)
      yhat = self.sigmoid(self.z3)
      return yhat
  
  
  def sigmoid(self, x):
      return 1 / (1 + np.exp(-x))
  
  x = np.array(([3,5],[5,1],[10,2]),dtype=float)
  y = np.array((([75],[82],[93])),dtype=float)
  n1 = Neural_Network()
  yhat = n1.forward(x)
  print(yhat)
  </code></pre>
  
  <p>The code should produce a matrix that states possible grades given a specified input 'x'. </p>
  
  <p>something like: x = [[2,3],[5,2]]
                  output: [[82],[93],[100]]</p>