This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# activation function | |
def sigmoid(self, x): | |
return 1 / (1 + np.exp(-x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
NewerOlder