0% found this document useful (0 votes)
3 views1 page

Program No8

The document contains a Python program that implements a simple neural network using NumPy and Matplotlib. It trains the network on generated data and visualizes the results through various plots. The program includes functionalities for adjusting weights based on error and simulating control processes.

Uploaded by

pratikrumane6555
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Program No8

The document contains a Python program that implements a simple neural network using NumPy and Matplotlib. It trains the network on generated data and visualizes the results through various plots. The program includes functionalities for adjusting weights based on error and simulating control processes.

Uploaded by

pratikrumane6555
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

4/26/26, 6:34 PM Program No8

In [18]: import numpy as np, [Link] as plt


W1,W2 = [Link](2,5), [Link](5,1)
lr=0.01
def nn(x,t=None):
global W1,W2
x=[Link](x); t=[Link](t) if t is not None else None
h=[Link](x@W1); y=h@W2
if t is not None:
e=y-t
W2-=lr*h.T@e
W1-=lr*x.T@((e@W2.T)*(1-h*h))
return y
P,A=[],[]
for _ in range(200):
x=[[Link]()*10,[Link]()]
y=5*x[0]+50*x[1]+[Link]()*5
[Link](nn([x],[[y]])[0,0]); [Link](y)
y=0; Y=[]
for _ in range(200):
e=1-y
u=nn([[e,-y]])
y+=0.1*u[0,0]
nn([[e,-y]],[[1]])
[Link](y)
X,P2,A2=[],[],[]
for _ in range(200):
u=[Link](-1,1)
y=[Link](2*u)+0.3*u
[Link](nn([[u,0]],[[y]])[0,0])
[Link](u); [Link](y)
[Link](figsize=(10,3))
[Link](131); [Link](A); [Link](P); [Link]("Grades")
[Link](132); [Link](Y); [Link](1,ls='--'); [Link]("Control")
[Link](133); [Link](X,A2); [Link](X,P2); [Link]("Process")
plt.tight_layout(); [Link]()

In [ ]: SE-B
S8 ROLL NO:465

[Link] No8 (2) (1).html 1/1

You might also like