import math
import numpy as np

def sigmoid(x):
  return 1 / (1 + math.exp(-x))

class NeuralNetwork:
    def __init__(self, x, y):
        self.input = x
        self.weights1 = np.random.rand(self.input.shape[1], 4)
        self.weights2 = np.random.rand(4, 1)
        self.y = y
        self.output = np.zeros(y.shape)
        #简单的两层神经网络

    def feedforword(self):
        #前向传播
        #激活函数 sigmoid 可以提换成其他的激活函数 active function
        self.layer1 = sigmoid(np.dot(self.input, self.weights1))
        self.output = sigmoid(np.dot(self.layer1, self.weights2))

    def backprop(self):
        #反向传播
        d_weights2 = np.dot(self.layer1.T, (2*(self.y - self.output) * sigmoid_derivative(self.output)))
        d_weights1 = np.dot(self.input.T, (np.dot(2* (self.y - self.output) * sigmoid_derivative(self.output), 
            self.weights2.T) * sigmoid_derivative(self.layer1)))

        #update the weights by the derivative of the slope of loss function
        self.weights1 += d_weights1
        self.weights2 += d_weights2
        
@@ -28,16 +28,79 @@
 s np%0D%0A%0D%0A
+'''%0D%0AReference https://databoys.github.io/Feedforward/%0D%0A'''%0D%0A%0D%0A
 def sigm
@@ -108,16 +108,18 @@
 id(x):%0D%0A
+  
   return
@@ -145,16 +145,71 @@
 -x))%0D%0A%0D%0A
+def sigmoid_derivative(y)%0D%0A    return y * (1.0 - y)%0D%0A%0D%0A
 class Ne
@@ -1178,16 +1178,18 @@
 ights2%0D%0A        
+%0D%0A

Add reference