Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please fill in the question marks: # First we set the state of the network sigma = np . tanh w 1 = 1

please fill in the question marks:
# First we set the state of the network
\sigma = np.tanh
w1=1.3
b1=-0.1
# Then we define the neuron activation.
def a1(a0):
z = w1* a0+ b1
return \sigma (z)
# Experiment with different values of x below.
x =0
print((a1(x)-1)**2)
# First define our sigma function.
sigma = np.tanh
# Next define the feed-forward equation.
def a1(w1, b1, a0) :
z = w1* a0+ b1
return sigma(z)
# The individual cost function is the square of the difference between
# the network output and the training data output.
def C (w1, b1, x, y) :
return (a1(w1, b1, x)- y)**2
# This function returns the derivative of the cost function with
# respect to the weight.
def dCdw (w1, b1, x, y) :
z =???
dCda =??? # Derivative of cost with activation
dadz =1/np.cosh(z)**2 # derivative of activation with weighted sum z
dzdw =??? # derivative of weighted sum z with weight
return ??? # Return the chain rule product.
# This function returns the derivative of the cost function with
# respect to the bias.
# It is very similar to the previous function.
# You should complete this function.
def dCdb (w1, b1, x, y) :
z =???
dCda =???
dadz =???
# Change the next line to give the derivative of
# the weighted sum, z, with respect to the bias, b.
dzdb =???
return ???
w1=2.3
b1=-1.2
# We can test on a single data point pair of x and y.
x =0
y =1
# Output how the cost would change
# in proportion to a small change in the bias
print( dCdb(w1, b1, x, y))
You should get -1.1186026425530913

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions