Facing an error while passing args

I’m facing the following TypeError. Please, someone help me out. I have been trying to fix this issue for quite some time now. Although I don’t have that level of expertise in Machine Learning as of now.
It will be really helpful for me.

Course name: Calculus for ML and Data Science
Week 1
Exercise 4
ERROR:

1 Like

Hi @MAYANK4, welcome to the community!

Note: Please remove your code in your posts because it is against the honor code.

The function dLdOmega_of_omega_array should only accept the omega_array input. Thus, kindly remove all the prices_A and prices_B that you added in that cell. In general, you should only edit/replace the lines of code inside the “START CODE HERE” and “END CODE HERE”

1 Like

Okay sorry for that. I’ve removed the code snippet from there. But I’m getting this error now:

1 Like

Based on the last sentence of the error message,

TypeError: L_of_omega() missing 2 required positional arguments: ‘prices_A’ and ‘prices_B’

I think you also added prices_A and prices_B as inputs in the L_of_omega function. Instead, L_of_omega function should only accept omega as its input.

1 Like

You are right. I had passed two extra arguments before. Fixing it resolved the issue. But two test cases are still failing in the same exercise.

1 Like

Great. There are just some minor errors remaining.

Can you send me your code (.ipynb) privately? Click my logo/name then click Message

1 Like

Yes, I’ll share it with you.

1 Like

Hi.

Some errors arise because you used jax in Exercise 1. Do not use jax in Exercise 1. Instead, your first 2 lines of prices_A and prices_B should work.

prices_A = …
prices_B = …

In the notebook, you combined those procedures (obtaining data from df and setting to numpy array with float32 dtype) in just 2 lines. Thus, you can either separate those procedures into 4 lines, or keep your original 2 lines then delete the 3rd and 4th lines of code.

1 Like

It’s still showing that two test cases have failed. But I just went through the code once again and found out that exercise 2 is producing an error while passing arguments to the test function.
Would you please be able to check that once?

1 Like

I need to see how you corrected Exercise 1. Can you send me your new notebook privately again?

1 Like

Nothing happened here.

1 Like

better in a private message :wink:

1 Like

Hmm… Your solution notebook looks correct and I can’t seem to recreate the error in Exercise 2 even if I copy your solutions. Can you try restarting your notebook then rerun?

1 Like

I tried, but nothing happened. The error says that omega is not defined.

1 Like

I noticed you edited this line and inserted omega inside f_of_omega.

Screen Shot 2023-04-27 at 8.18.38 AM

In general, do not edit lines in the notebook unless there is a “START CODE HERE” and “END CODE HERE” instructions. Let me know if that works.

1 Like

Sorry, I really messed that up. But the code is working now. Thanks for your help, Jonathan!

2 Likes