Skip to content

Instantly share code, notes, and snippets.

View angadsinghsandhu's full-sized avatar
🎯
Focusing

Angad Sandhu angadsinghsandhu

🎯
Focusing
View GitHub Profile
@angadsinghsandhu
angadsinghsandhu / train.py
Created December 1, 2020 05:11
function that executed forward prop, backprop and loss calculation
# training neural net
def train(self):
# dynamically calculating layers and their respective z
for i in range(len(self.input)):
self.z0 = self.input[i].reshape([-1, 1])
# forward step
output = self.forwardprop()
@angadsinghsandhu
angadsinghsandhu / sigmoid.py
Created December 1, 2020 04:39
the sigmoid squashing function
# activation function
def sigmoid(self, x):
return 1 / (1 + np.exp(-x))
@angadsinghsandhu
angadsinghsandhu / initialize_NN.py
Created December 1, 2020 04:30
Neural Network From Scratch
# imports
import numpy as np
# nn class
class NeuralNetwork:
# initializing variables
def __init__(self, x, y, learning_rate=0.06, num_layers=2):
# input array