Machine Learning Algorithms(using sklearn)
Linear Regression
It is one of the simplest Algorithm to get started. The goal here is to fit a straight line between two or more variables. Where one is independent and another is dependent (i.e, Y=f(X), means that the value of Y changes according to X but we can take any X in the range given.). Thus, we try to find a relationship (definition of f(X)) between Y and X. Which is in the form of a line Y = m*X + b.
- Y — Dependent
- X — independent
- m — Slope
- b — Intercept
We try to predict real values at a given point. This gives us continuous values on a line .
It is to be noted that m can be multi dimensional, means X is multivariate (we can represent in a table form instead of a 1D array). This is called ‘Multivariate Linear regression’. We fit the line by reducing the Mean Squared Error (Loss) between predicted value and original Y. This is called Gradient Descent optimization Technique.
CODE:
Logistic Regression
It is a classification algorithm though having ‘regression’ in its name. It is used to estimate discrete values (0/1, yes/no, true/false) from the independent variables. It predicts the probability of an event by using a logistic function. so its also known as logit regression. We know that probabilities lies between 0 and 1, so it predicts value between 0 and 1(like regression).
logit(p) = ln(p/(1-p))
CODE:
I will continue this, Stay Tuned, Thanks!