FAQ: Linear Regression - Use Your Functions on Real Data

This community-built FAQ covers the “Use Your Functions on Real Data” exercise from the lesson “Linear Regression”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Data Science

Machine Learning

FAQs on the exercise Use Your Functions on Real Data

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Whats the difference between these two codes?

gradient_descent(X,y,num_iterations=1000, learning_rate=0.0001)

gradient_descent(X,y,1000, 0.0001)

I don’t understand why the second one is wrond.

3 Likes

Looking at the actual definition of the function gradient_descent(), it looks like this:

def gradient_descent(x, y, learning_rate, num_iterations):
  ...

In the hint of Step 2, the positions of learning_rate and num_iterations are reversed.

1 Like

The way the instructions are written makes it a bit confusing. I was coding as I was reading the instructions and so I (without looking at the previous function, since its in another file) didn’t look at the order of the parameters and this threw me off too.