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
Library Management System Software Requirements Specification
Library Management System Software Requirements Specification

6 pages

0% (0)
DOCX
MATLAB Script for Cloud Removal in Satellite Images
MATLAB Script for Cloud Removal in Satellite Images

1 pages

0% (0)
DOCX
COMP-8567 Project Winter 2024 Server Code
COMP-8567 Project Winter 2024 Server Code

17 pages

0% (0)
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
The Role of Information Systems in the Data Mining Process
The Role of Information Systems in the Data Mining Process

6 pages

0% (0)
DOCX
Reflective Report on Risk Plan for Rent Management System in Java
Reflective Report on Risk Plan for Rent Management System in Java

3 pages

0% (0)
DOCX
Server Types and Selection for Cost and Performance Optimization
Server Types and Selection for Cost and Performance Optimization

2 pages

0% (0)
DOCX
SQL Database Query and Update Exercises
SQL Database Query and Update Exercises

6 pages

0% (0)
DOCX
ISMS Implementation and ISO 27001:2013 Notes
ISMS Implementation and ISO 27001:2013 Notes

11 pages

0% (0)