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
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”
Okay sorry for that. I’ve removed the code snippet from there. But I’m getting this error now:
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.
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.
Great. There are just some minor errors remaining.
Can you send me your code (.ipynb) privately? Click my logo/name then click Message
Yes, I’ll share it with you.
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.
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?
I need to see how you corrected Exercise 1. Can you send me your new notebook privately again?
better in a private message
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?
I tried, but nothing happened. The error says that omega is not defined.
I noticed you edited this line and inserted omega inside f_of_omega.
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.
Sorry, I really messed that up. But the code is working now. Thanks for your help, Jonathan!