FAQ: Logistic Regression - Linear Regression Approach


#1

This community-built FAQ covers the “Linear Regression Approach” exercise from the lesson “Logistic Regression”.

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

Machine Learning

FAQs on the exercise Linear Regression Approach

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

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!


#2

When doing offline exercise Reggie’s Linear Regression, I found something interesting.


I think the correct result shoud be like “-10.0, -9.9, -9.8, -9.7, -9.6, -9.5, -9.4, -9.3, …”.
Does anyone know why?
Thx~


#3

if you use round, yes.

the problem you run into is explained in the python docs:

https://docs.python.org/2/tutorial/floatingpoint.html


#4

I agree that you should be getting the numbers without the long tails. I (and it seems many other users) used
i / 10 for i in range (-100,101) while the authors used:
i * 0.1 for i in range…

Yes you can/should read about floating points & why that happened, but I am wondering why the authors don’t correct this as our method finds a lower error AND the list comprehension creates the desired list (-10 to 10 in .1 increments)
Thoughts CA community?


#5

the creator of the course wanted float values for some reason, multiplying by 0.1 achieves this

using i / 10 doesn’t guarantee float numbers across both major python versions. In programming, every approach has its advantages and drawbacks.

But not being aware of Floating Point Arithmetic limitations is also not good.