@Kapil3sh/

Neural Network from Scratch

Python

No description

fork
loading
Files
  • main.py
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import numpy as np

def sigmoid(x):
  
  return 1/(1+(np.exp(-x))

training_inputs = np.array([[0,0,1],[1,1,1],[1,0,1],[0,1,1]])

training_outputs = np.array([0,1,1,0]).T
np.random.seed(1)
synaptic_weights = 2*np.random.random((3,1)) - 1
print ("random starting synaptic weights:")
print (synaptic_weights)

for iterations in  range(1):
  input_layer = training_inputs

  outputs = sigmoid(np.dot(training_inputs,synaptic_weights)) 

print ("outputs after training:")
print(outputs)