Study Muddy
Study Muddy

Upload, organize, preview, and share study documents from one clean workspace.

Explore

BrowseAbout UsContact Us

Workspace

UploadDashboard

Legal

Privacy PolicyTerms & ConditionsDisclaimerReport Copyright & Abuse
Study Muddy
DOC·0% (0)·0 views·1 pages

Neural Network Forward and Backward Propagation Code

Code snippet showing neural network forward and backward propagation, loss gradient steps, and reconstruction error plotting after model training.

Category: Technology

Uploaded by Lauren Bennett on Apr 30, 2026

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 DOCX.

Download PDF
/ 1
100%
1

Document text

input_error = np.dot(output_error, self.weights.T)

weights_gradient= np.dot(self.input.T, output_error)

bias_gradient = np.sum(output_error, axis=0, keepdims=True)

l1Out = self.layer1.forward_propagation(input_data)

a1Out = self.activation1.forward_propagation(l1Out)

l2Out = self.layer2.forward_propagation(a1Out)

a2Out = self.activation2.forward_propagation(l2Out)

l3Out = self.layer3.forward_propagation(a2Out)

a3Out = self.activation3.forward_propagation(l3Out)

pred = self.layer4.forward_propagation(a3Out)

loss_gradient = self.loss_gradient(y_true, y_pred)

l4Err = self.layer4.backward_propagation(loss_gradient, learning_rate)

activate3 = self.activation3.backward_propagation(l4Err)

l3Err = self.layer3.backward_propagation(activate3, learning_rate)

activate2 = self.activation2.backward_propagation(l3Err)

l2Err = self.layer2.backward_propagation(activate2, learning_rate)

activate1 = self.activation1.backward_propagation(l2Err)

l1Err = self.layer1.backward_propagation(activate1, learning_rate)

data_pred = net.forward(data_x)

reconstruction_error = np.mean(((data_x - data_pred)**2, axis=1)

plt.figure(figsize=(8, 4))

plt.hist(reconstruction_error, bins=100, alpha=0.6, color='g')

plt.xlabel('Error')

plt.ylabel('Samples')

plt.title('Reconstruction error after model training')

plt.show()

Related documents

DOCX
The Adventures of Momo Game Product Introduction
The Adventures of Momo Game Product Introduction

2 pages

0% (0)
PDF
CS725 Machine Learning Lecture Notes
CS725 Machine Learning Lecture Notes

116 pages

0% (0)
DOCX
Clustering Methods: K-means, Hierarchical, and DBSCAN
Clustering Methods: K-means, Hierarchical, and DBSCAN

3 pages

0% (0)
DOCX
Operating Systems, Networking and CPU Scheduling Answers
Operating Systems, Networking and CPU Scheduling Answers

5 pages

0% (0)
DOCX
SDN Security: DDoS Detection, Cryptography and IPsec
SDN Security: DDoS Detection, Cryptography and IPsec

3 pages

0% (0)
DOCX
Dream Weaver: A Tapestry of Artificial Imagination
Dream Weaver: A Tapestry of Artificial Imagination

1 pages

0% (0)
DOCX
Statement of Purpose for MSc in Digital Media and Communication
Statement of Purpose for MSc in Digital Media and Communication

4 pages

0% (0)
PDF
The History of Software Testing
The History of Software Testing

2 pages

0% (0)
DOCX
Statement of Purpose for MSc in Digital Media and Communication
Statement of Purpose for MSc in Digital Media and Communication

4 pages

0% (0)
DOCX
Enhancing Aviation Safety with GPS Navigation Systems
Enhancing Aviation Safety with GPS Navigation Systems

7 pages

0% (0)