diff --git a/.idea/PyTorch.iml b/.idea/PyTorch.iml index 99e0c2f..95a59ad 100644 --- a/.idea/PyTorch.iml +++ b/.idea/PyTorch.iml @@ -1,10 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/.idea/editor.xml b/.idea/editor.xml new file mode 100644 index 0000000..fef3201 --- /dev/null +++ b/.idea/editor.xml @@ -0,0 +1,249 @@ + + + + + \ No newline at end of file diff --git a/NoTorch/BookExamples/BasicExample.py b/NoTorch/BookExamples/BasicExample.py new file mode 100644 index 0000000..c4bc043 --- /dev/null +++ b/NoTorch/BookExamples/BasicExample.py @@ -0,0 +1,29 @@ +import numpy as np + +#inputs * weights + biases = predictions +inputs = [[1.0, 2.0, 3.0, 2.5], + [2.0, 5.0, -1.0, 2.0], + [-1.5, 2.7, 3.3, -0.8]] + +weights = [[0.2, 0.8, -0.5, 1.0], + [0.5, -0.91, 0.26, -0.5], + [-0.26, -0.27, 0.17, 0.87]] + +biases = [2.0, 3.0, 0.5] + +#adding more sets of weights and biases creates more layers for our neural network +weights2 = [[0.1, -0.14, 0.5], + [-0.5, 0.12, -0.33], + [-0.44, 0.73, -0.13]] + +biases2 = [-1, 2, -0.5] + +#take dot product of the two matrices and add biases (transpose so that we can do matrix multiplication) +layer_outputs = np.dot(inputs, np.array(weights).T) + biases + +#repeat dot product but instead with the output matrix from layer1 and the second layer of weights and biases +layer_outputs2 = np.dot(layer_outputs, np.array(weights2).T) + biases2 +print(layer_outputs2) + + + diff --git a/NoTorch/BookExamples/SpiralDataExample.py b/NoTorch/BookExamples/SpiralDataExample.py new file mode 100644 index 0000000..a6d5e5f --- /dev/null +++ b/NoTorch/BookExamples/SpiralDataExample.py @@ -0,0 +1,22 @@ +from nnfs.datasets import spiral_data +import numpy as np +import nnfs +import matplotlib.pyplot as plt + +#sets random seed to zero, float 32 dtype default, overrides original dot product from numpy +nnfs.init() + +class Layer_Dense: + + #layer initialization + def __init__(self, n_inputs, n_neurons): + #random initialization of weights and biases + self.weights = 0.01 * np.random.randn(n_inputs, n_neurons) + self.biases = np.zeros((1, n_neurons)) + + + #forward pass + def forward(self, inputs): + #calculate outputs from inputs weights and biases + self.output = np.dot(inputs, self.weights) + self.biases + diff --git a/NoTorch/main.py b/NoTorch/main.py deleted file mode 100644 index e69de29..0000000