Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Linear Regression A Tale of a Transform (safwanahmad.github.io)
83 points by farhanhubble on Jan 21, 2018 | hide | past | favorite | 5 comments


I still wish I could find a short python code explains does linear regression, without the math.

Actually I think I should write a book about algorithms that are about math, but only with code, not math. I guess it would sell.


x = numpy.linalg.pinv(A) * b

There we go. Code is math; just math that is encoded for computers. I think the problem is programmers who are not used to reading math. The problem is not math, which is meant to be read by humans.


I mean python code, not something from numpy.

I know how to read math, but code is much more readable, and is much more relevant when describing a procedure than a one-line equation.

Not to mention paragraph long explanations which are missing the point of one simple thing it tries to explain.

> The problem is not math, which is meant to be read by humans.

Code is also meant to be read by humans. But math can be ambiguous because of different ways of writing the same thing or concept, meanwhile code is precisely defined and doesn't tolerate ambiguity.


I don't really see how you can justify your position, except as someone who finds code easier to read than math. People like that are mainly computer science people, who have had years of training staring at code, while there exists swathes of people out there in the science and math world who find code impenetrable.

So code is certainly not "much more relevant when describing a procedure" than a simple well defined equation.

And badly written articles explaining equations is not a reason to say that code is more readable or more relevant.

Math can be ambiguous, I will give you that, but a well written article should not have ambiguous terms.

Also, I don't want to go back and forth arguing that badly written math is less readable than well written code or that well written math code is more readable than badly written code.


Code can easily be tested, which makes it so much more usable and verifiable in my view. Not to mention how easily you can teach it, and how students can experiment with it on their own time.

Proving equations is much trickier. I also never understand why you always need to use proofs in maths to show you understand something, yet it's the only way. This makes it frustrating to do math. Even good mathematicians come up with flawed proofs, which I find weird. Meanwhile if you use data you can often visualize and test something.

Data is more concrete. I concede that you cannot express everything in code, but I'm amazed at how simple things in code can grow into unnecessarily complex math which becomes a barrier for many people.

> while there exists swathes of people out there in the science and math world who find code impenetrable

I find that laughable. People who do well in math should be smart enough to learn how to code. Programming language are easily taught. It has become a necessity in any science field to be able to write code to do decent work.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: