Hi,
C2 Week-1 Assignment: All the exercises passes ,but final score is zero.
please help !!
β Bonny
Hi,
C2 Week-1 Assignment: All the exercises passes ,but final score is zero.
please help !!
β Bonny
C2_W1_Assignment
I get the following error:
Cell In [24], line 9
dLdOmega_array = dLdOmega.at[i].set(dLdOmega)
^
SyntaxError: invalid syntax
thanks @Carlos_Merino . I fix it.
Is everything ok here? Or do you need more help?
@yjcb22 yes, all good. Thank you.
unable to finish C2_W1_Assignment Machine Learning Calculus I get error in line 20:
def dLdOmega_of_omega_array(omega_array):
N = len(omega_array)
dLdOmega_array = np.zeros(N)
for i in range(N):
### START CODE HERE ### (~ 2 lines of code)
dLdOmega = grad(omega_array([i])
dLdOmega_array = dLdOmega.at[i].set(dLdOmega)
#L = L_of_omega(omega_array[i])
#L_array = L_array.at[i].set(L)
### END CODE HERE ###
return dLdOmega_array
dLdOmega_array = dLdOmega_of_omega_array(omega_array)
ell In [20], line 9
dLdOmega_array = dLdOmega.at[i].set(dLdOmega)
^
SyntaxError: invalid syntax
This is correct!
You are getting an error because if you look at your code what you are trying to do is to place dLDOmega in the array named dLdOmega_array. But, you are trying to access dLDomega instead of dLDomega_array. Look at your code here:
dLdOmega_array = dLdOmega.at[i].set(dLdOmega)
Do you see something fishy after the = ?
sorry no
I have followed
#L = L_of_omega(omega_array[i])
#L_array = L_array.at[i].set(L)
I am not following. What do you mean by βsorry noβ?
The error show in your thread is not with the comments but here: dLdOmega_array = dLdOmega.at[i].set(dLdOmega)
i mean that I do not see something wrong after the = dLdOmega.at[i].set(dLdOmega) so I do not know how to proceed .
Probably we are talking about different things.
Can you please confirm if this is the part where you have issues?
It is that exercise C2_W1_Assignment but I have issues in exercise 4:
for i in range(N):
### START CODE HERE ### (~ 2 lines of code)
dLdOmega = grad(omega_array([i])
dLdOmega_array = dLdOmega.at[i].set(dLdOmega)
#L = L_of_omega(omega_array[i])
#L_array = L_array.at[i].set(L)
### END CODE HERE ###
I wanna exercise 4 in this assignment please
Thanks for your reply. Now, we are on the same page. I see multiple issues. Please find my comments:
grad(argument1)(argument2)
where:
argument1 will be the function you want to differentiate. In this case remember we want to differentiate the function defined with the name L_of_omega
argument2 will be the array with the values you want to evaluate for each iteration. In this case the name of the array is omega_array and you need to get the value at i so this one is correctly set as omega_array[i]
Please note that I cannot provide you with the answer of the exercise, but I can answer an specific question if that helps.
thanks, i understand that
Dear Fatma,
Thanks for your message. I will be kindly enough to explain your issue here:
You have the same problem I explained to Carlos as follows:
grad(argument1)(argument2)
where:
Thank you yjcb22,
I have tried:
def dLdOmega_of_omega_array(omega_array):
N = len(omega_array)
dLdOmega_array = np.zeros(N)
for i in range(N):
### START CODE HERE ### (~ 2 lines of code)
dLdOmega = grad(L_of_omega,omega_array[i])
dLdOmega_array= dLdOmega_array.at[i].set(dLdOmega_array)
return dLdOmega_array
dLdOmega_array = dLdOmega_of_omega_array(omega_array)
But, it does not work either,
Very good!
The only issue now is the syntax. It needs to be like this:
dLdOmega = grad(L_of_omega)(omega_array[i])
The other issue is dLdOmega_array needs to be like this:
dLdOmega_array = dLdOmega_array.at[i].set(dLdOmega)
thanks, now it works!!