Python Artificial Neural Networks




In this Artificial Neural Networks (ANN) this is a method to get identify some output result with different inputs.calculations are done in system is unknown

example
  this system is to analyze sleeping hours and working hours and get the grade of the exam



This is the wight and inputs in function




coding :-

import numpy as np

# this x is 3 input sets for inputs
x=np.array(([3,5],[5,1],[10,2]),dtype=float)
y=np.array(([75],[82],[93]),dtype=float)
print ("============ x value ==========")
print (x)
print ("============ y value ==========")
print (y)


# scaling x is to convert hours unit to some conman unit
# scaling is divides set maximum number of set
x = x/np.amax(x,axis=0)
print ("============ x scale ==========")
print (x)

#this is a random values generate to wights as a example
W1= np.random.randn(2, 3)
W2 = np.random.randn(3,1)
print ("============ random w1 values ==========")
print (W1)
print ("============ random w2 values ==========")
print (W2)

#z2 is a multiple input sets by the wights(w1,w2,w3,w4,w5)
print ("============ z2 values ==========")
Z2 = np.dot(x,W1)
print (Z2)

#Sigmoid function to exhilarate the function output
print ("============ a Sigmoid values ==========")
a = 1 / (1 + np.exp(-Z2))
print (a)

#z3 is a multiple z2 by the wights(w6,w7,w8)
print ("============ z3 with multiple a values ==========")
Z3 = np.dot(a,W2)
print (Z3) 

#Sigmoid function to exhilarate the function output
print ("============ z3 Sigmoid values ==========")
a1 = 1 / (1 + np.exp(-Z3))
print (a1)

#generate the output of predicated marks
print ("============  genarated predicate values ==========")
a2=a1*100
print (a2)

#distance between predicate and actual results
print("============= error result ==============")
a3=y-a2
print(a3)

To improve aquracy this want to TRAINING  THE CODE 


Output :



Comments

Post a Comment

Popular Posts