160 Questions for Data Science - Part 3

Intro (3/?)

I totally forgot about writing some new stuff here, but recently I found these 160 data science interview questions on Hackernoon, and decided to try to answer each one of them in order to force me to study all of those interesting topics. I will post my answers (hopefully, right and comprehensible) trying to write ~23 answers each couple of days.

If you spot anything wrong, contact me please!

What are the methods for solving linear regression do you know

The linear regression is a linear modeling algorithm that fits a line (for univariate datasets) or a n-plane to a dataset of samples by minimizing a specific cost function. Usually this cost function is the sum of the squared error for each prediction.

A method that can be used is the gradient descent, explained in the next question. More methods may be added in the future.

What is gradient descent, how does it work

Gradient descent is an optimization algorithm used to find a minimum (or maximum) of a function. It’s used for regression modeling, or in several other situations, where the goal is to minimize some cost function without knowing the internal structure of the function itself.

It works by starting the state in a random point of the function, and then computing the slope of the function in that random point. It then changes the input of the function moving in the desired direction, if pointing towards a minimum, it will move where the function gives a minor result. This is repeated until all results are higher than the current point.

It simply needs a value for the learning rate, that defines how distant will be two points, then it simply computes everything by itself. While simple, it’s biggest flaw is that will fall into a local solution if it starts from the wrong point.

What is the normal equation

It’s a topic correlated to the matricial solution for the linear regression, but I will probably explain it tomorrow.