Skip to content

Commit

Permalink
Added code for p5
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-kukiela committed May 27, 2020
1 parent 3d484a7 commit 7380483
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions nnfs_video_tutorial_code/005.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import numpy as np
import nnfs
from nnfs.datasets import spiral_data # See for code: https://gist.github.com/Sentdex/454cb20ec5acf0e76ee8ab8448e6266c

nnfs.init()

X, y = spiral_data(100, 3)


class Layer_Dense:
def __init__(self, n_inputs, n_neurons):
self.weights = 0.10 * np.random.randn(n_inputs, n_neurons)
self.biases = np.zeros((1, n_neurons))
def forward(self, inputs):
self.output = np.dot(inputs, self.weights) + self.biases


class Activation_ReLU:
def forward(self, inputs):
self.output = np.maximum(0, inputs)


layer1 = Layer_Dense(2,5)
activation1 = Activation_ReLU()

layer1.forward(X)

#print(layer1.output)
activation1.forward(layer1.output)
print(activation1.output)

0 comments on commit 7380483

Please sign in to comment.