Linear Regression
Introduction:
Before going inside linear regression,lets know what is regression.Regression is defined as the technique for determining the statistical relationship between two or more variables where the change in one variable(i.e dependent variable) is associated with,depends on change in one or more variables(independent variable).Machine Learning mostly uses regression to predict the outcome.In this article we will see about linear regression ,types and many other topics in linear regression
Before going inside linear regression,lets know what is regression.Regression is defined as the technique for determining the statistical relationship between two or more variables where the change in one variable(i.e dependent variable) is associated with,depends on change in one or more variables(independent variable).Machine Learning mostly uses regression to predict the outcome.In this article we will see about linear regression ,types and many other topics in linear regression
What is a linear regression?
linear regression gives the relationship between the variables i.e dependent variable and independent variable. The dependent variable is continuous and the independent variable may be continuous or discrete
linear regression is classified into two types:
*simple linear regression
*multiple linear regression or multiple regression
It is represented by an equation Y=a + b*X, where a is intercept, b is slope of the line and.This equation can be used to predict the value of target variable based on given predictor variable(s).
simple linear regression:
simple linear regression is the regression which shows the relationship the only one dependent variable and one independent variable.The relationship between the variables may be deterministic or statistical relation.deterministic relation is the exact relationship between two variables i.e the relationship with the variables will be proportional to each other,whereas statistical relationship is not the exact relationship it will show some trend in it and has scatter points in it
general form
y = a + bx + e
multiple linear regression or multiple regression:
multiple linear regression finds the relationship between one or more independent variables and one dependent variable
- Multiple regression: Y = a + b1X1 + b2X2 + b3X3 + ... + btXt + x
Where:
- Y = the variable that you are trying to predict (dependent variable).
- X = the variable that you are using to predict Y (independent variable).
- a = the intercept.
- b = the slope.
- x= residual
The relationship between two variables may be one of these two deterministic relation and statistical relation
regression line or best fit line
The best fit line can be obtained by least square method it calculate the best fit line by minimizing the sum of the squares of the vertical deviations from each point to the line,the squaring of the deviations there will be no cancellation of the values of opposite signs
when the slope of the regression line is positive (meaning that the value of b is positive) the value of y increases as the value of x increases. This is called a positive correlation. When the slope of the regression line is negative (meaning that the value of b is negative) the value of y decreases as x increases
A regression line will have a general form
y = a + bx + e
where:
a is the y-intercept
b is the slope of the line
e is an error term
A regression line is a straight line that describes how a response variable y changes as an explanatory variable x changes. We often use a regression line to predict the value of y for a given value of x.
In simple regression, how close the simple correlation of x and y is to 1 or -1 is a measure of the strength of the association. Because there are many correlations in multiple regression (one for each x) we need a different way to measure the overall strength of the regression.
Gradient Descent overview.
Gradient Descent is used while training a machine learning model. It is an optimization algorithm, based on a convex function, that tweaks it’s parameters iteratively to minimize a given function to its local minimum.It is simply used to find the values of a functions parameters (coefficients) that minimize a cost function as far as possible.
A gradient measures how much the output of a function changes if you change the inputs a little bit.gradient descent is a minimization algorithm
If you are dealing with a machine learning problem and want to train your algorithm with gradient descent to minimize your cost-function J(w, b) and reach its local minimum by tweaking its parameters (w and b).
Let’s take a look at the picture below, which is an illustration of Gradient Descent. The horizontal axes represent the parameters (w and b) and the cost function J(w, b) is represented on the vertical axes. You can also see in the image that gradient descent is a convex function
Gradient Descent Calculations
The equation below describes what Gradient Descent does: “b“ describes the next position of our climber, while “a“ represents his current position. The minus sign refers to the minimization part of gradient descent. The “dollar“ in the middle is a waiting factor and the gradient term ( &f(a) ) is simply the direction of the steepest descent.
b=a-$(&f(a))
we want to find the values of W and B that correspond to the minimum of the cost function marked with the red arrow. To start with finding the right values we initialize the values of W and B with some random numbers and Gradient Descent then starts at that point somewhere around the top of our illustration. Then it takes one step after another in the steepest downside direction i.e. from the top to the bottom of the illustration, till it reaches the point where the cost function is as small as possible.
In order for Gradient Descent to reach the local minimum, we have to set the learning rate to an appropriate value, which is neither too low nor too high.
A good way to make sure that Gradient Descent runs properly is by plotting the cost function as Gradient Descent runs. You put the number of iterations on the x-axes and the value of the cost-function at the y-axes. This enables you to see the value of your cost function after each iteration of gradient descent. This lets you easily spot how appropriate your learning rate is. You just try different values for it and plot them all together.
If gradient descent is working properly, the cost function should decrease after every iteration
R and Python Overview:
R and Python are both open-source programming languages with a large community. New libraries or tools are added continuously to their repository. R is mainly used for statistical analysis while Python provides a more general approach to data science.
Python is used because it is Simple and easy to understand and learn
packages like pandas, numpy and scikit-learn, make Python an excellent choice for machine learning activities.
R is statistical tool that Consists of packages for almost any statistical application one can think of. CRAN currently hosts more than 10k packages.
CRAN is a network of ftp and web servers around the world that store identical, up-to-date, versions of code and documentation for R
It is impossible to choose out from these two as they can be used on the user needs and some programmers use both R and python in their analysis
Both R and Python are quite robust languages and either one of them is actually sufficient to carry out the Data Analysis task. However, there are definitely some high and low points for both of them and if we could utilize the strengths of both, we could end up doing a much better job. Either way, having knowledge of both will make us more flexible thereby increasing our chances of being able to work in multiple environments.
Conclusion:
I hope you liked reading the article. To summarize most of the problems in machine learning is based on prediction ,it may be linear or multiple regression. Most of the companies have invested a lot in their in their past years data so the the machine learning models can identify hidden pattern in the data that will help the company to increase the advantage among the competitors, to recognize the new market opportunities and increase the efficiency of the company
for more articles on machine learning follow my blog : https://datasciencetrend.blogspot.com/
Search tags:
machine learning blogs
machine learning tutorials
machine learning interview questions
Search tags:
machine learning blogs
machine learning tutorials
machine learning interview questions



I’m happy I located this blog! From time to time, students want to recognize the keys of productive literary essays. Your first-class knowledge about this good post can become a proper basis for such people. nice one
ReplyDeletebusiness analytics course in hyderabad