CogSci131 Assignment 1 NeuralNetsFall23 import numpy as np %matplotlib inline import matplotlib.pyplot as plt class Neural_Network(object): def __init__(self): #Define Parameters self.inputLayerSize = 2 self.outputLayerSize=1 self.hiddenLayerSize=3 #Define Weights self.W1=np.random.rand(self.inputLayerSize,self.hiddenLayerSize) self.W2=np.random.rand(self.hiddenLayerSize,self.outputLayerSize) def forward(self,X): #Propagate inputs through network self.z2 = np.dot(X,self.W1) self.a2 = self.sigmoid(self.z2) self.z3 = np.dot(self.a2,self.W2) yHat = self.sigmoid(self.z3) return yHat def sigmoid(self, z): #Apply Sigmoid Activation …
CogSci131 Assignment 1 NeuralNetsFall23 Read More »