Skip to main content

Linear Regression- Details

 

Linear Regression:

  • Linear regression is a statistical regression method which is used for predictive analysis.
  • It is one of the very simple and easy algorithms which works on regression and shows the relationship between the continuous variables.
  • It is used for solving the regression problem in machine learning.
  • Linear regression shows the linear relationship between the independent variable (X-axis) and the dependent variable (Y-axis), hence called linear regression.
  • If there is only one input variable (x), then such linear regression is called simple linear regression. And if there is more than one input variable, then such linear regression is called multiple linear regression.
  • The relationship between variables in the linear regression model can be explained using the below image. Here we are predicting the salary of an employee on the basis of the year of experience.
Regression Analysis in Machine learning
  • Below is the mathematical equation for Linear regression:
  1. Y= aX+b  

Here, Y = dependent variables (target variables),
X= Independent variables (predictor variables),
a and b are the linear coefficients

Some popular applications of linear regression are:

  • Analyzing trends and sales estimates
  • Salary forecasting
  • Real estate prediction
  • Arriving at ETAs in traffic.

Logistic Regression:

  • Logistic regression is another supervised learning algorithm which is used to solve the classification problems. In classification problems, we have dependent variables in a binary or discrete format such as 0 or 1.
  • Logistic regression algorithm works with the categorical variable such as 0 or 1, Yes or No, True or False, Spam or not spam, etc.
  • It is a predictive analysis algorithm which works on the concept of probability.
  • Logistic regression is a type of regression, but it is different from the linear regression algorithm in the term how they are used.
  • Logistic regression uses sigmoid function or logistic function which is a complex cost function. This sigmoid function is used to model the data in logistic regression. The function can be represented as:
Regression Analysis in Machine learning
  • f(x)= Output between the 0 and 1 value.
  • x= input to the function
  • e= base of natural logarithm.

When we provide the input values (data) to the function, it gives the S-curve as follows:

Regression Analysis in Machine learning
  • It uses the concept of threshold levels, values above the threshold level are rounded up to 1, and values below the threshold level are rounded up to 0.

There are three types of logistic regression:

  • Binary(0/1, pass/fail)
  • Multi(cats, dogs, lions)
  • Ordinal(low, medium, high)

Polynomial Regression:

  • Polynomial Regression is a type of regression which models the non-linear dataset using a linear model.
  • It is similar to multiple linear regression, but it fits a non-linear curve between the value of x and corresponding conditional values of y.
  • Suppose there is a dataset which consists of data points which are present in a non-linear fashion, so for such case, linear regression will not best fit to those data points. To cover such data points, we need Polynomial regression.
  • In Polynomial regression, the original features are transformed into polynomial features of given degree and then modeled using a linear model. Which means the data points are best fitted using a polynomial line.
Regression Analysis in Machine learning
  • The equation for polynomial regression also derived from linear regression equation that means Linear regression equation Y= b0+ b1x, is transformed into Polynomial regression equation Y= b0+b1x+ b2x2+ b3x3+.....+ bnxn.
  • Here Y is the predicted/target output, b0, b1,... bn are the regression coefficients. x is our independent/input variable.
  • The model is still linear as the coefficients are still linear with quadratic

Note: This is different from Multiple Linear regression in such a way that in Polynomial regression, a single element has different degrees instead of multiple variables with the same degree.

Support Vector Regression:

Support Vector Machine is a supervised learning algorithm which can be used for regression as well as classification problems. So if we use it for regression problems, then it is termed as Support Vector Regression.

Support Vector Regression is a regression algorithm which works for continuous variables. Below are some keywords which are used in Support Vector Regression:

  • Kernel: It is a function used to map a lower-dimensional data into higher dimensional data.
  • Hyperplane: In general SVM, it is a separation line between two classes, but in SVR, it is a line which helps to predict the continuous variables and cover most of the datapoints.
  • Boundary line: Boundary lines are the two lines apart from hyperplane, which creates a margin for datapoints.
  • Support vectors: Support vectors are the datapoints which are nearest to the hyperplane and opposite class.

In SVR, we always try to determine a hyperplane with a maximum margin, so that maximum number of datapoints are covered in that margin. The main goal of SVR is to consider the maximum datapoints within the boundary lines and the hyperplane (best-fit line) must contain a maximum number of datapoints. Consider the below image:

Regression Analysis in Machine learning

Here, the blue line is called hyperplane, and the other two lines are known as boundary lines.

Decision Tree Regression:

  • Decision Tree is a supervised learning algorithm which can be used for solving both classification and regression problems.
  • It can solve problems for both categorical and numerical data
  • Decision Tree regression builds a tree-like structure in which each internal node represents the "test" for an attribute, each branch represent the result of the test, and each leaf node represents the final decision or result.
  • A decision tree is constructed starting from the root node/parent node (dataset), which splits into left and right child nodes (subsets of dataset). These child nodes are further divided into their children node, and themselves become the parent node of those nodes. Consider the below image:
Regression Analysis in Machine learning

Above image showing the example of Decision Tee regression, here, the model is trying to predict the choice of a person between Sports cars or Luxury car.

  • Random forest is one of the most powerful supervised learning algorithms which is capable of performing regression as well as classification tasks.
  • The Random Forest regression is an ensemble learning method which combines multiple decision trees and predicts the final output based on the average of each tree output. The combined decision trees are called as base models, and it can be represented more formally as:
g(x)= f0(x)+ f1(x)+ f2(x)+....
  • Random forest uses Bagging or Bootstrap Aggregation technique of ensemble learning in which aggregated decision tree runs in parallel and do not interact with each other.
  • With the help of Random Forest regression, we can prevent Overfitting in the model by creating random subsets of the dataset.
Regression Analysis in Machine learning

Ridge Regression:

  • Ridge regression is one of the most robust versions of linear regression in which a small amount of bias is introduced so that we can get better long term predictions.
  • The amount of bias added to the model is known as Ridge Regression penalty. We can compute this penalty term by multiplying with the lambda to the squared weight of each individual features.
  • The equation for ridge regression will be:
Regression Analysis in Machine learning
  • A general linear or polynomial regression will fail if there is high collinearity between the independent variables, so to solve such problems, Ridge regression can be used.
  • Ridge regression is a regularization technique, which is used to reduce the complexity of the model. It is also called as L2 regularization.
  • It helps to solve the problems if we have more parameters than samples.

Lasso Regression:

  • Lasso regression is another regularization technique to reduce the complexity of the model.
  • It is similar to the Ridge Regression except that penalty term contains only the absolute weights instead of a square of weights.
  • Since it takes absolute values, hence, it can shrink the slope to 0, whereas Ridge Regression can only shrink it near to 0.
  • It is also called as L1 regularization. The equation for Lasso regression will be:
Regression Analysis in Machine learning

Comments

Popular Post

How to earn money using ChatGPT !

  Content Creation and Writing: You can use AI language models to assist in content creation, such as writing articles, blog posts, or social media content. Some content creators use AI-generated drafts and then refine them with their own ideas and style. Language Translation Services: You can offer language translation services using AI language models to help with translating documents or text between different languages. Chatbot Development: If you have programming skills, you can integrate AI language models into chatbots for businesses or websites, helping them provide automated customer support. Tutoring and Educational Assistance: Use AI language models to create educational content, answer students' questions, or provide tutoring support in specific subjects. Copywriting and Marketing: Assist in generating marketing copy, ad content, or email campaigns using AI language models to improve efficiency and creativity. Writing and Publishing Books: Some authors use AI lang...

Apple is testing a ChatGPT-like AI chatbot

  According to a recent report by Bloomberg's Mark Gurman, Apple is making significant strides in the development of artificial intelligence tools to rival the likes of OpenAI and Google. Internally referred to as "Apple GPT," the tech giant has created a chatbot using its proprietary framework called "Ajax." This framework, built on Google Cloud with Google JAX, enables the creation of large language models similar to ChatGPT and Google's Bard. While Apple is yet to finalize its strategy for consumer release, it is reportedly planning a major AI-related announcement next year. The chatbot's internal rollout faced delays due to security concerns related to generative AI. However, it has been made available to a growing number of Apple employees with special approval, primarily for product prototyping purposes. Apple's chatbot can summarize text and answer questions based on its training data. Although it shares similarities with commercially availabl...

UPSC

📌PERIOD POVERTY Scotland may become the first country in the world to end ‘period poverty’ by making sanitary products free for all. About: • The Scottish Parliament passed the Period Products (Free Provision) (Scotland) Bill. • Referring to “period dignity”, the legislation aims to develop a universal system in Scotland, which will provide free sanitary products for “anyone who needs them”. • As of now, in Scotland, the provision of free sanitary products is already available in schools, universities and colleges. • The Bill has only passed the first hurdle to become a law. It still needs to be considered by a parliamentary committee, following which it will require approval from the parliament. It will finally need the Royal Assent of the Queen.  ▪️Important Info : What is ‘period poverty’? Some circumstances make menstruation a “difficult experience” for women. T...

Mobile hacking code.

               Hack Code. 1] *#0000# Displays Your Phones software version,Ist line: Software version, 2nd line: software release date,3rd line: compression type 2] *#9999# Phones softwares version if *#0000# does not work 3] *#06# For checking the international Mobile Equipment identity(IMEI number) 4] *#2640# Displays security Code in use 5] #pw+1234567890+1# Provides Lock Status(use the * button to obtain the "p,w,+" symbols for following codes)  6] #pw+1234567890+2# Network Lock Status(use the * button to obtain the "p,w,+" symbols for following codes)  7] #pw+1234567890+3# Country lock Status (use the * button to obtain the "p,w,+" symbols for following codes)  8] #pw+1234567890+4# SIM card Lock status(use the * button to obtain the "p,w,+" symbols for following codes) 9] *#21# Allows u to check the number that "All Calls" are diverted to 10] *#30# Lets u see the private number 11] *#43# Allows u to ch...

UPSC ARTICLE

๐Ÿ“š เคจिเคตेเคถเค•ों เค•ो เคจเคˆ เคคेเคฒ เคต เค—ैเคธ เคจीเคคि เคธे เคฒुเคญाเคจे เค•ी เค•ोเคถिเคถ เคธเคฐเค•ाเคฐ เคจे เคคेเคฒ เคเคตं เค—ैเคธ เค–ोเคœ เค•्เคทेเคค्เคฐ เคฎें เคจिเคœी เค”เคฐ เคตिเคฆेเคถी เคจिเคตेเคถ เค†เค•เคฐ्เคทिเคค เค•เคฐเคจे เค•े เคฒिเค เค‡เคธเคธे เคœुเคก़ी เคจीเคคि เคฎें เค…เคนเคฎ เคฌเคฆเคฒाเคต เค•िเค เคนैं। เคจเคˆ เคจीเคคि เค•े เคคเคนเคค เคธเคฐเค•ाเคฐ เคจเค เคเคตं เค•เคฎ เค–ोเคœे เค—เค เค•्เคทेเคค्เคฐों เคฎें เคนाเค‡เคก्เคฐोเค•ाเคฐ्เคฌเคจ เค‰เคค्เคชाเคฆเคจ เคชเคฐ เคธंเคฌंเคงिเคค เค•ंเคชเคจी เคธे เคฒाเคญ เคฎें เคนिเคธ्เคธा เคจเคนीं เคฎांเค—ेเค—ी। เคนเคฐ เคคเคฐเคน เค•े เคฌेเคธिเคจ เค•े เคฒिเค เคเค• เคธเคฎाเคจ เค…เคจुเคฌंเคง เคตाเคฒी เคฆो เคฆเคถเค• เคชुเคฐाเคจी เคจीเคคि เคฎें เคฌเคฆเคฒाเคต เค•เคฐเคคे เคนुเค เคจเคˆ เคจीเคคि เคฎें เค…เคฒเค—-เค…เคฒเค— เค•्เคทेเคค्เคฐों เค•े เคฒिเค เค…เคฒเค—-เค…เคฒเค— เคจिเคฏเคฎ เคฌเคจाเค เค—เค เคนैं। เค‡เคธเค•े เคคเคนเคค เคชเคนเคฒे เคธे เค‰เคค्เคชाเคฆเคจ เคตाเคฒे เค•्เคทेเคค्เคฐों เค”เคฐ เคจเค เค•्เคทेเคค्เคฐों เค•े เคฒिเค เคจिเคฏเคฎ เค…เคฒเค—-เค…เคฒเค— เคฐเคนेंเค—े। เค†เคงिเค•ाเคฐिเค• เค…เคงिเคธूเคšเคจा เค•े เค…เคจुเคธाเคฐ เค‰เคค्เคชाเคฆเค•ों เค•ो เคญเคตिเคท्เคฏ เคฎें เคฌोเคฒी เค•े เคฆौเคฐाเคจ เคคेเคฒ เคเคตं เค—ैเคธ เค•े เคฒिเค เคตिเคชเคฃเคจ เค”เคฐ เค•ीเคฎเคค (เคฎाเคฐ्เค•ेเคŸिंเค— เคंเคก เคช्เคฐाเค‡เคธिंเค—) เค•े เคฎाเคฎเคฒे เคฎें เค†เคœाเคฆी เคนोเค—ी। เค‡เคธ เคช्เคฐเค•्เคฐिเคฏा เคฎें เค‡เคธ เคฌाเคค เคธे เค•ोเคˆ เคช्เคฐเคญाเคต เคจเคนीं เคชเคก़ेเค—ा เค•ि เคฌेเคธिเคจ เค•ैเคธा เคนै। เค•ेंเคฆ्เคฐीเคฏ เคฎंเคค्เคฐिเคฎंเคกเคฒ เคจे 28 เคซเคฐเคตเคฐी เค•ो เคจिเคฏเคฎ เคฎें เคฌเคฆเคฒाเคต เค•ो เคฎंเคœूเคฐी เคฆी เคฅी। เค‡เคธเคฎें เค•เคนा เค—เคฏा เคนै เค•ि เคญเคตिเคท्เคฏ เคฎें เคธเคญी เคคेเคฒ เคเคตं เค—ैเคธ เค•्เคทेเคค्เคฐ เคฏा เคฌ्เคฒॉเค• เค•ा เค†เคตंเคŸเคจ เคช्เคฐाเคฅเคฎिเค• เคฐूเคช เคธे เค–ोเคœ เค•ाเคฐ्เคฏों เค•ो เคฒेเค•เคฐ เคœเคคाเคˆ เค—เคˆ เคช्เคฐเคคिเคฌเคฆ्เคงเคคा เค•े เค†เคงाเคฐ เคชเคฐ เค•िเคฏा เคœाเคเค—ा।เคจเค เคจिเคฏเคฎ เค•े เคคเคนเคค เค•ंเคชเคจिเคฏों เค•ो เคถ्เคฐेเคฃी-เคเค• ...

Follow the Page for Daily Updates!