{"id":10881,"date":"2021-07-10T12:02:00","date_gmt":"2021-07-10T06:32:00","guid":{"rendered":"https:\/\/www.botreetechnologies.com\/blog\/?p=10881"},"modified":"2026-03-27T15:59:40","modified_gmt":"2026-03-27T10:29:40","slug":"machine-learning-algorithms-mathematics-behind-linear-regression","status":"publish","type":"post","link":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/","title":{"rendered":"ML Algorithms: Mathematics behind Linear Regression"},"content":{"rendered":"\n<p>There are several machine learning algorithms that can provide the desired outputs by processing the input data. One of the widely used algorithms is linear regression. One of the widely used Machine learning algorithms in Python is linear regression.<\/p>\n\n\n\n<p>Linear regression is a type of supervised learning algorithm where the output is in a continuous range and isn\u2019t classified into categories. Through a linear regression machine learning algorithm, we can predict values with a constant slope.<\/p>\n\n\n\n<figure class=\"wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"What is Machine Learning | How Machine Learning Works | Future of Machine Learning\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/J2-NMJbZKjI?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">What is Linear Regression Used for?<\/h2>\n\n\n\n<p>The most popular uses of <a href=\"https:\/\/www.botreetechnologies.com\/machine-learning-solutions\" target=\"_blank\" rel=\"noreferrer noopener\">linear regression in a machine learning system<\/a> is predictive analytics and modeling. With the help of linear regression, we can quantify the relationship between the predictor variable and an output variable. It is one of the most commonly used <a href=\"https:\/\/deepinfra.com\/bert-large-cased\" target=\"_blank\" rel=\"noreferrer noopener\">Machine Learning algorithms<\/a> for prediction and building models.<\/p>\n\n\n\n<p>For example, We can quantify the impact of advertising on sales in a business, demographics on location tracking, age on height, and many more.<\/p>\n\n\n\n<p>Linear regression is used in machine learning solutions to predict the future values. It is also known as multiple regression, multivariate regression, and ordinarily least squares.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Related: <a href=\"https:\/\/www.botreetechnologies.com\/blog\/decision-tree-algorithm-in-machine-learning\" target=\"_blank\" rel=\"noopener noreferrer\">Decision Tree Algorithm in Machine Learning<\/a><\/p>\n<\/blockquote>\n\n\n\n<div class=\" bdm\">\n<div class=\"breadcrumb\">How to use linear regression in a machine learning model?<\/div>\n<\/div>\n\n\n\n<p>There are various blogs explaining how to perform linear regression on various datasets. However, there are only a few articles explaining the mathematical formulae used in the backend when we use the linear regression classifier of sklearn (python library) or other libraries.<\/p>\n\n\n\n<p>Here we will dive deep into the mathematics of linear regression.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Supervised Learning:<\/strong><\/h3>\n\n\n\n<p>We are taking a simple linear regression mathematical example of a dataset having some values of houses as per their areas.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"627\" height=\"204\" src=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/Supervised-Learning.png\" alt=\"Supervised Learning\" class=\"wp-image-14394\" srcset=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/Supervised-Learning.png 627w, https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/Supervised-Learning-300x98.png 300w\" sizes=\"auto, (max-width: 627px) 100vw, 627px\" \/><\/figure>\n\n\n\n<p>As you can see in our machine learning algorithm dataset, we have some value for areas and their respective prices, let&#8217;s say our input parameter x is Area and our output parameter y is Price.<\/p>\n\n\n\n<p><strong>When we have fixed output parameter y and input parameter x, this type of learning is called supervised learning.<\/strong><\/p>\n\n\n\n<p>So for a given machine learning training dataset, our goal is to learn a function h:x y so that h(x) is a prediction value for the corresponding value of y.<\/p>\n\n\n\n<p>Function h is known as hypothesis.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"470\" height=\"352\" src=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/hypothesis.png\" alt=\"hypothesis\" class=\"wp-image-14395\" srcset=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/hypothesis.png 470w, https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/hypothesis-300x225.png 300w\" sizes=\"auto, (max-width: 470px) 100vw, 470px\" \/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\"><strong>Regression Problem:<\/strong><\/h3>\n\n\n\n<p>When the target variable that we are trying to predict is continuous such as in our housing price prediction example, we call this learning problem a <strong>regression problem<\/strong>.<\/p>\n\n\n\n<p>Classification Problem:<\/p>\n\n\n\n<p>When y can take only a small number of discrete values we call it a <strong>classification problem<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Linear Regression:<\/h3>\n\n\n\n<p>Linear regression is a <a href=\"https:\/\/www.botreetechnologies.com\/machine-learning-solutions\" target=\"_blank\" rel=\"noreferrer noopener\">supervised learning algorithm in machine learning solutions<\/a> used when the target \/ dependent variable <strong>continues in real<\/strong> numbers.<\/p>\n\n\n\n<p>It is one of those Machine learning algorithms Python uses that establishes a relationship between dependent variable y and one or more independent variable x using the best fit line. It works on the principle of ordinary least square (OLS) \/ Mean square error (MSE).<\/p>\n\n\n\n<p>In statistics OLS is a method to estimate unknown parameters of linear regression function, it&#8217;s goal is to minimize the sum of square differences between observed dependent variables in the given data set and those predicted by linear regression function.<\/p>\n\n\n\n<p>We have three methods to draw the best fit line for linear regression.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Batch Gradient descent<\/li>\n\n\n\n<li>Stochastic Gradient descent<\/li>\n\n\n\n<li>Normal equation<\/li>\n<\/ol>\n\n\n\n<p>Lets make our dataset a little more richer to understand the concept in a broader manner.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"202\" src=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/dataset.png\" alt=\"dataset\" class=\"wp-image-14397\" srcset=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/dataset.png 622w, https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/dataset-300x97.png 300w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/><\/figure>\n\n\n\n<p>According to our hypothesis our equation will be:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"462\" height=\"253\" src=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/bedrooms-code-1.png\" alt=\"bedrooms code 1\" class=\"wp-image-14399\" srcset=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/bedrooms-code-1.png 462w, https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/bedrooms-code-1-300x164.png 300w\" sizes=\"auto, (max-width: 462px) 100vw, 462px\" \/><\/figure>\n<\/div>\n\n\n<p>Now before jumping into example and cost function let us make several notations.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"448\" height=\"121\" src=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/bedrooms-code-2.png\" alt=\"example and cost function\" class=\"wp-image-14400\" srcset=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/bedrooms-code-2.png 448w, https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/bedrooms-code-2-300x81.png 300w\" sizes=\"auto, (max-width: 448px) 100vw, 448px\" \/><\/figure>\n<\/div>\n\n\n<p>Let\u2019s take some random values of x and y to train our model.<\/p>\n\n\n<p><script src=\"https:\/\/gist.github.com\/pranavbtc\/1b4c1be1c8ebba96d844919afd7ac15a.js\"><\/script><\/p>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"480\" src=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/relationship.png\" alt=\"scatter plot shows relationship between x and y\" class=\"wp-image-14401\" srcset=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/relationship.png 640w, https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/relationship-300x225.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n<\/div>\n\n\n<p>To decide whether our line is best fitted or not we will define a cost function.<\/p>\n\n\n\n<p>The error between predicted values and observed values is called <strong>residuals<\/strong>, and our <strong>cost function<\/strong> is nothing but the sum of squares of residuals.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"269\" height=\"188\" src=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/observed-values.png\" alt=\"observed values is called residuals\" class=\"wp-image-14402\"\/><\/figure>\n<\/div>\n\n\n<p>Cost function is denoted by:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"287\" height=\"83\" src=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/12\/cost-functiion.png\" alt=\"Cost function is denoted by\" class=\"wp-image-14403\"\/><\/figure>\n<\/div>\n\n\n<p>The linear regression algorithm in machine learning models passes through 1000s of iterations before arriving on a set of weights used to make the predictions. These iterations train the model to generate the desired output every time we input the predictor variable into the equation. &nbsp;It leads to the best Machine Learning algorithms for prediction based problems.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Also Read: <a style=\"font-size: 16px;\" href=\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-everything-you-need-to-know\" target=\"_blank\" rel=\"noopener noreferrer\">Machine Learning: Everything you Need to Know<\/a><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion: Mathematics for Machine Learning<\/h2>\n\n\n\n<p>Linear regression is the <a href=\"https:\/\/www.botreetechnologies.com\/machine-learning-solutions\" target=\"_blank\" rel=\"noreferrer noopener\">most basic type of machine learning algorithm<\/a> used to predict the relationship between two variables. The factor being predicted is called the dependent variable as it requires the input variable for reaching that value.<\/p>\n\n\n\n<p>One of the widely popular use cases of linear regression is in forecasting the sales of any company. Companies that have steady sales increase or decrease over the past few months can predict the future trend using this machine learning algorithms for Python.<\/p>\n\n\n\n<p>Today, more and more businesses are trying to eliminate uncertainty by utilizing machine learning models that make near accurate predictions. Machine learning as a service is widely used by enterprises of all kinds and industries to forecast demand, supply, estimate market trends, income, expenses, and even the overall growth.<\/p>\n\n\n\n<p>In the next blog, we will try to do hands-on training using our first method Gradient Descent with the help of numpy library, we will also see the result of scikit learn library for the same above dataset.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Read more: <a href=\"https:\/\/www.business2community.com\/business-innovation\/7-machine-learning-challenges-businesses-face-while-implementing-02341340\" target=\"_blank\" rel=\"noopener noreferrer\">7 Machine Learning Challenges Businesses Face While Implementing<\/a><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Enjoy Learning with Machines..!<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><a href=\"https:\/\/www.botreetechnologies.com\/machine-learning-solutions\" target=\"_blank\" rel=\"noreferrer noopener\">Click here for more blogs<\/a>\u2026<\/h3>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>At&nbsp;<a href=\"https:\/\/www.botreetechnologies.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">BoTree Technologies<\/a>, we build enterprise applications with our 10+ expert ML developers.<\/p>\n\n\n\n<p>We also specialize in RPA, AI, Python, Ruby on Rails, JavaScript and ReactJS.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><a href=\"https:\/\/www.botreetechnologies.com\/contact\" target=\"_blank\" rel=\"noopener noreferrer\">Consulting is free<\/a>&nbsp;\u2013 let us help you grow!<\/h3>\n","protected":false},"excerpt":{"rendered":"<p>There are several machine learning algorithms that can provide the&#8230;<\/p>\n","protected":false},"author":61,"featured_media":14390,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,51],"tags":[],"class_list":["post-10881","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-automation","category-machine-learning"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ML Algorithms: Mathematics behind Linear Regression<\/title>\n<meta name=\"description\" content=\"Learn the mathematics behind the linear regression Machine Learning algorithms for prediction. Explore a simple linear regression mathematical example to get a better understanding.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ML Algorithms: Mathematics behind Linear Regression\" \/>\n<meta property=\"og:description\" content=\"Learn the mathematics behind the linear regression Machine Learning algorithms for prediction. Explore a simple linear regression mathematical example to get a better understanding.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/\" \/>\n<meta property=\"og:site_name\" content=\"BoTree Technologies\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/BoTreeTechnologies\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-10T06:32:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-27T10:29:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/machine-learning-algorithms-mathematics-behind-linear-regression.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"852\" \/>\n\t<meta property=\"og:image:height\" content=\"479\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Pranav Modh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@BoTreeTech\" \/>\n<meta name=\"twitter:site\" content=\"@BoTreeTech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pranav Modh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/\"},\"author\":{\"name\":\"Pranav Modh\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/5302c63509dd2f73e7546d4998e7d412\"},\"headline\":\"ML Algorithms: Mathematics behind Linear Regression\",\"datePublished\":\"2021-07-10T06:32:00+00:00\",\"dateModified\":\"2026-03-27T10:29:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/\"},\"wordCount\":949,\"commentCount\":20,\"image\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/machine-learning-algorithms-mathematics-behind-linear-regression.jpg\",\"articleSection\":[\"Automation\",\"Machine Learning\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/\",\"name\":\"ML Algorithms: Mathematics behind Linear Regression\",\"isPartOf\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/machine-learning-algorithms-mathematics-behind-linear-regression.jpg\",\"datePublished\":\"2021-07-10T06:32:00+00:00\",\"dateModified\":\"2026-03-27T10:29:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/5302c63509dd2f73e7546d4998e7d412\"},\"description\":\"Learn the mathematics behind the linear regression Machine Learning algorithms for prediction. Explore a simple linear regression mathematical example to get a better understanding.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#primaryimage\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/machine-learning-algorithms-mathematics-behind-linear-regression.jpg\",\"contentUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/machine-learning-algorithms-mathematics-behind-linear-regression.jpg\",\"width\":852,\"height\":479,\"caption\":\"Machine Learning Algorithms\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.botreetechnologies.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ML Algorithms: Mathematics behind Linear Regression\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#website\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/\",\"name\":\"BoTree Technologies\",\"description\":\"Committed to inspire generation.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.botreetechnologies.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/5302c63509dd2f73e7546d4998e7d412\",\"name\":\"Pranav Modh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/pranav-modh-150x150.png\",\"url\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/pranav-modh-150x150.png\",\"contentUrl\":\"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/pranav-modh-150x150.png\",\"caption\":\"Pranav Modh\"},\"description\":\"I am a passionate Python developer worked on several projects on web development using Django. I am enthusiastic about working on machine learning and data science projects. I love to explore new technologies and apart from it, I like to listen to music, play computer and mobile games.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ML Algorithms: Mathematics behind Linear Regression","description":"Learn the mathematics behind the linear regression Machine Learning algorithms for prediction. Explore a simple linear regression mathematical example to get a better understanding.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/","og_locale":"en_US","og_type":"article","og_title":"ML Algorithms: Mathematics behind Linear Regression","og_description":"Learn the mathematics behind the linear regression Machine Learning algorithms for prediction. Explore a simple linear regression mathematical example to get a better understanding.","og_url":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/","og_site_name":"BoTree Technologies","article_publisher":"https:\/\/www.facebook.com\/BoTreeTechnologies\/","article_published_time":"2021-07-10T06:32:00+00:00","article_modified_time":"2026-03-27T10:29:40+00:00","og_image":[{"width":852,"height":479,"url":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/machine-learning-algorithms-mathematics-behind-linear-regression.jpg","type":"image\/jpeg"}],"author":"Pranav Modh","twitter_card":"summary_large_image","twitter_creator":"@BoTreeTech","twitter_site":"@BoTreeTech","twitter_misc":{"Written by":"Pranav Modh","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#article","isPartOf":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/"},"author":{"name":"Pranav Modh","@id":"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/5302c63509dd2f73e7546d4998e7d412"},"headline":"ML Algorithms: Mathematics behind Linear Regression","datePublished":"2021-07-10T06:32:00+00:00","dateModified":"2026-03-27T10:29:40+00:00","mainEntityOfPage":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/"},"wordCount":949,"commentCount":20,"image":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#primaryimage"},"thumbnailUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/machine-learning-algorithms-mathematics-behind-linear-regression.jpg","articleSection":["Automation","Machine Learning"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/","url":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/","name":"ML Algorithms: Mathematics behind Linear Regression","isPartOf":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#primaryimage"},"image":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#primaryimage"},"thumbnailUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/machine-learning-algorithms-mathematics-behind-linear-regression.jpg","datePublished":"2021-07-10T06:32:00+00:00","dateModified":"2026-03-27T10:29:40+00:00","author":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/5302c63509dd2f73e7546d4998e7d412"},"description":"Learn the mathematics behind the linear regression Machine Learning algorithms for prediction. Explore a simple linear regression mathematical example to get a better understanding.","breadcrumb":{"@id":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#primaryimage","url":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/machine-learning-algorithms-mathematics-behind-linear-regression.jpg","contentUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/07\/machine-learning-algorithms-mathematics-behind-linear-regression.jpg","width":852,"height":479,"caption":"Machine Learning Algorithms"},{"@type":"BreadcrumbList","@id":"https:\/\/www.botreetechnologies.com\/blog\/machine-learning-algorithms-mathematics-behind-linear-regression\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.botreetechnologies.com\/blog\/"},{"@type":"ListItem","position":2,"name":"ML Algorithms: Mathematics behind Linear Regression"}]},{"@type":"WebSite","@id":"https:\/\/www.botreetechnologies.com\/blog\/#website","url":"https:\/\/www.botreetechnologies.com\/blog\/","name":"BoTree Technologies","description":"Committed to inspire generation.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.botreetechnologies.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.botreetechnologies.com\/blog\/#\/schema\/person\/5302c63509dd2f73e7546d4998e7d412","name":"Pranav Modh","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/pranav-modh-150x150.png","url":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/pranav-modh-150x150.png","contentUrl":"https:\/\/www.botreetechnologies.com\/blog\/wp-content\/uploads\/2020\/10\/pranav-modh-150x150.png","caption":"Pranav Modh"},"description":"I am a passionate Python developer worked on several projects on web development using Django. I am enthusiastic about working on machine learning and data science projects. I love to explore new technologies and apart from it, I like to listen to music, play computer and mobile games."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/10881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/users\/61"}],"replies":[{"embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=10881"}],"version-history":[{"count":5,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/10881\/revisions"}],"predecessor-version":[{"id":19817,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/10881\/revisions\/19817"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/media\/14390"}],"wp:attachment":[{"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=10881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=10881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.botreetechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=10881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}