Question: Backward Propagation In [ 3 ] : import numpy as n p def backward _ propagation ( x , y , predicted _ output, weights,
Backward Propagation
In : import numpy as
def backwardpropagation predictedoutput, weights, learningrate:
Perform backward propagation for one perceptron to update weights.
Parameters:
: Input data.
y: True label the actual output
predictedoutput: Output of the perceptron from the forward pass
weights: Weights matrix including bias
learningrate: Learning rate alpha
Returns:
updatedweights: Updated weights matrix.
n
# Write your code here
return updatedweights
Use the following cell to test your solution in the previous cell. Here is a list of correct answers:
In : # Example usage
if :
# Sample input data for one example
array # Input features
# True Label
predictedoutput # Output of the perceptron from the forward pass
weights nparray # Weights matrix including bias
learningrate #Learning rate alpha
# Perform backward propagation to update weights
updatedweights backwardpropagation predictedoutput, weights, learningrate
printOriginal weights:", weights
printUpdated weights: updatedweights
Original weights:
Updated weights:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
