<jupyter_start><jupyter_text>Defining inputs and outputs<jupyter_code>X = np.array(([2, 9], [1, 5], [3, 6]), dtype=float)
y = np.array(([92], [86], [89]), dtype=float)<jupyter_output><empty_output><jupyter_text>Preprocessing / Flattening data<jupyter_code>X = X / np.amax(X, axis=0)
y = y / 100
# Inspecting X
X
# Inspecting y
y
class NeuralNetwork(object):
    def __init__(self):
        # Hyperparemeters
        self.input_size = 2
        self.hidden_size = 3
        self.output_size = 1
        
        # Weights for input -> hidden
        self.W1 = np.random.randn(self.input_size, self.hidden_size)
        # Weights for hidden -> output
        self.W2 = np.random.randn(self.hidden_size, self.output_size)
    def sigmoid(self, s):
        # activation function 
        return 1/(1+np.exp(-s))

    def forward(self, X):
        # Dot product of X (input) and first set of 3 x 2 weights
        self.z = np.dot(X, self.W1)
        # Applying the activation function
        self.z2 = self.sigmoid(self.z)
        # Dot product of the hidden layer and second set of 3 x 1 weights
        self.z3 = np.dot(self.z2, self.W2)
        # Final activation function
        o = self.sigmoid(self.z3)
        return o
brain = NeuralNetwork()

o = brain.forward(X)
print('Predicted result ', o)
print('Actual output ', y)<jupyter_output>Predicted result  [[0.68148237]
 [0.66547497]
 [0.72757538]]
Actual output  [[0.92]
 [0.86]
 [0.89]]
{'fraction_non_alphanumeric': 0.1304649548924358, 'fraction_numerical': 0.047883414295628035, 'mean_word_length': 2.7260981912144704, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '561662', 'license': 'Apache-2.0', 'n_tokens_mistral': 561, 'n_tokens_neox': 516, 'n_words': 130, 'path': '006-neural-network/Forward Prop Neural Network.ipynb', 'repo_name': 'MuhamedEssam/deeplearning', 'size': '1441'}