{"id":816,"date":"2023-07-06T19:52:50","date_gmt":"2023-07-06T19:52:50","guid":{"rendered":"https:\/\/mlinsightscentral.com\/?page_id=816"},"modified":"2023-09-18T15:17:16","modified_gmt":"2023-09-18T15:17:16","slug":"linear-regression","status":"publish","type":"page","link":"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/","title":{"rendered":"Linear Regression"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"816\" class=\"elementor elementor-816\">\n\t\t\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-ef80bf7 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"ef80bf7\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-573595e\" data-id=\"573595e\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-3cbc271 elementor-widget elementor-widget-heading\" data-id=\"3cbc271\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.13.3 - 28-05-2023 *\/\n.elementor-heading-title{padding:0;margin:0;line-height:1}.elementor-widget-heading .elementor-heading-title[class*=elementor-size-]>a{color:inherit;font-size:inherit;line-height:inherit}.elementor-widget-heading .elementor-heading-title.elementor-size-small{font-size:15px}.elementor-widget-heading .elementor-heading-title.elementor-size-medium{font-size:19px}.elementor-widget-heading .elementor-heading-title.elementor-size-large{font-size:29px}.elementor-widget-heading .elementor-heading-title.elementor-size-xl{font-size:39px}.elementor-widget-heading .elementor-heading-title.elementor-size-xxl{font-size:59px}<\/style><h5 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Linear_Regression\"><\/span>Linear Regression<span class=\"ez-toc-section-end\"><\/span><\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-284d11f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"284d11f\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-679e8c6\" data-id=\"679e8c6\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-491c619 elementor-widget elementor-widget-text-editor\" data-id=\"491c619\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.13.3 - 28-05-2023 *\/\n.elementor-widget-text-editor.elementor-drop-cap-view-stacked .elementor-drop-cap{background-color:#69727d;color:#fff}.elementor-widget-text-editor.elementor-drop-cap-view-framed .elementor-drop-cap{color:#69727d;border:3px solid;background-color:transparent}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap{margin-top:8px}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap-letter{width:1em;height:1em}.elementor-widget-text-editor .elementor-drop-cap{float:left;text-align:center;line-height:1;font-size:50px}.elementor-widget-text-editor .elementor-drop-cap-letter{display:inline-block}<\/style>\t\t\t\t<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_53 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\" role=\"button\"><label for=\"item-69e301f729d32\" ><span class=\"\"><span style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input aria-label=\"Toggle\" aria-label=\"item-69e301f729d32\"  type=\"checkbox\" id=\"item-69e301f729d32\"><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/#Linear_Regression\" title=\"Linear Regression\">Linear Regression<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/#Model_estimation_Formulation\" title=\"Model estimation Formulation\">Model estimation Formulation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/#Python_implementation\" title=\"Python implementation\">Python implementation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/#Goodness_of_fit_and_R2_score\" title=\"Goodness of fit and R2 score\">Goodness of fit and R2 score<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/#Conclusion\" title=\"Conclusion\">Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-b318ce6 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"b318ce6\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2f6e681\" data-id=\"2f6e681\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-8ac2f49 elementor-widget elementor-widget-text-editor\" data-id=\"8ac2f49\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Linear regression is the most basic regression algorithm that assumes the existence of a linear relationship between the independent variable and the dependent variables.\u00a0<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8208998 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8208998\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-a4015a9\" data-id=\"a4015a9\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-82f574e elementor-widget elementor-widget-image\" data-id=\"82f574e\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.13.3 - 28-05-2023 *\/\n.elementor-widget-image{text-align:center}.elementor-widget-image a{display:inline-block}.elementor-widget-image a img[src$=\".svg\"]{width:48px}.elementor-widget-image img{vertical-align:middle;display:inline-block}<\/style>\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"144\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-06-at-22.16.59.png\" class=\"attachment-large size-large wp-image-839\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-06-at-22.16.59.png 979w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-06-at-22.16.59-300x44.png 300w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-06-at-22.16.59-768x113.png 768w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-4d46b47 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4d46b47\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-20e59f2\" data-id=\"20e59f2\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-99e027d elementor-widget elementor-widget-text-editor\" data-id=\"99e027d\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Albeit its basic relationship model, it is a powerful technique robust to noise that can estimate a skeletal relationship in labelled data.<br \/>Given the fictional dataset below of a survey data of different competitors of milk price settings, a regression model could be built to estimate the inherent relationship.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-de173aa elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"de173aa\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-b9c55bb\" data-id=\"b9c55bb\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-1b40ea1 elementor-widget elementor-widget-image\" data-id=\"1b40ea1\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"571\" height=\"453\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/milk_pricing_example.png\" class=\"attachment-medium_large size-medium_large wp-image-853\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/milk_pricing_example.png 571w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/milk_pricing_example-300x238.png 300w\" sizes=\"auto, (max-width: 571px) 100vw, 571px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-d9634be elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"d9634be\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2ccfe3b\" data-id=\"2ccfe3b\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5e61c04 elementor-widget elementor-widget-text-editor\" data-id=\"5e61c04\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>A linear regression model can be applied to the given datasets and estimate the inherent relationship which will come down to estimate the linear model parameters as show in the equation below.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-78c0e40 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"78c0e40\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-111e541\" data-id=\"111e541\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2ed8839 elementor-widget elementor-widget-image\" data-id=\"2ed8839\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"97\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/price_model_eq2.png\" class=\"attachment-large size-large wp-image-873\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/price_model_eq2.png 622w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/price_model_eq2-300x47.png 300w\" sizes=\"auto, (max-width: 622px) 100vw, 622px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a29b13d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a29b13d\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-faa8933\" data-id=\"faa8933\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e671fe7 elementor-widget elementor-widget-text-editor\" data-id=\"e671fe7\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>This leads to the derivation of the estimated model illustrated in the Figure below: p(g) = 0.111g + 19.861, which accurately describes the relationship in the dataset.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-41734d4 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"41734d4\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-e87788d\" data-id=\"e87788d\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e2bddb8 elementor-widget elementor-widget-image\" data-id=\"e2bddb8\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"613\" height=\"453\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/milk_pricing_model.png\" class=\"attachment-medium_large size-medium_large wp-image-861\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/milk_pricing_model.png 613w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/milk_pricing_model-300x222.png 300w\" sizes=\"auto, (max-width: 613px) 100vw, 613px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-ef1e716 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"ef1e716\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2327f37\" data-id=\"2327f37\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-0807914 elementor-widget elementor-widget-heading\" data-id=\"0807914\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h5 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Model_estimation_Formulation\"><\/span>Model estimation Formulation<span class=\"ez-toc-section-end\"><\/span><\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-f534688 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"f534688\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-bdc995d\" data-id=\"bdc995d\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-023182f elementor-widget elementor-widget-text-editor\" data-id=\"023182f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p><span dir=\"ltr\" role=\"presentation\">Given a set of M observations of labelled data (<\/span><span dir=\"ltr\" role=\"presentation\">x<\/span><span dir=\"ltr\" role=\"presentation\">d<\/span><span dir=\"ltr\" role=\"presentation\">i<\/span> <span dir=\"ltr\" role=\"presentation\">, y<\/span><span dir=\"ltr\" role=\"presentation\">d<\/span><span dir=\"ltr\" role=\"presentation\">i<\/span> <span dir=\"ltr\" role=\"presentation\">) with n dependent <\/span><span dir=\"ltr\" role=\"presentation\">variables, the model parameters below can be estimated using <\/span><span dir=\"ltr\" role=\"presentation\">the<\/span> <strong><span dir=\"ltr\" role=\"presentation\">least square estimation method.<\/span><\/strong><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-dbdc19b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"dbdc19b\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-076ba20\" data-id=\"076ba20\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-759e594 elementor-widget elementor-widget-image\" data-id=\"759e594\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"910\" height=\"75\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq3_m.png\" class=\"attachment-large size-large wp-image-982\" alt=\"linear regression equation\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq3_m.png 910w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq3_m-300x25.png 300w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq3_m-768x63.png 768w\" sizes=\"auto, (max-width: 910px) 100vw, 910px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-7e1803e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7e1803e\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-da8a9fc\" data-id=\"da8a9fc\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-f5effa8 elementor-widget elementor-widget-text-editor\" data-id=\"f5effa8\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>which requires finding the model parameters that will minimise the sum of square error (SSE) between the target output observation values and the model prediction.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-f634170 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"f634170\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c3f935c\" data-id=\"c3f935c\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-bad4c23 elementor-widget elementor-widget-image\" data-id=\"bad4c23\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"359\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq_345_m-1024x359.png\" class=\"attachment-large size-large wp-image-983\" alt=\"sum of square error\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq_345_m-1024x359.png 1024w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq_345_m-300x105.png 300w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq_345_m-768x270.png 768w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq_345_m.png 1060w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-2831cad elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"2831cad\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2d7d70c\" data-id=\"2d7d70c\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2e15f43 elementor-widget elementor-widget-text-editor\" data-id=\"2e15f43\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p><span dir=\"ltr\" role=\"presentation\">Utilizing the<a href=\"https:\/\/mlinsightscentral.com\/index.php\/gradient-descent-algorithm\/\"> gradient descent algorithm<\/a> is a common approach to minimize this cost function (SSE(\u03b8)) and estimate the model parameters. For datasets of manageable size, a direct estimation approach employing matrix manipulation is also viable. Interested readers can look at Appendix A of the work at the following <a href=\"https:\/\/www.researchgate.net\/profile\/Yves-Matanga\/publication\/326175998_Master_Thesis_Analysis_of_Control_Attainment_in_Endogenous_Electroencephalogram-Based_Brain_Computer_Interfaces\/links\/5b3c8170a6fdcc8506eef7e7\/Master-Thesis-Analysis-of-Control-Attainment-in-Endogenous-Electroencephalogram-Based-Brain-Computer-Interfaces.pdf\">link<\/a>.<\/span><\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-442040d elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"442040d\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c2799e6\" data-id=\"c2799e6\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-9a4e333 elementor-widget elementor-widget-heading\" data-id=\"9a4e333\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h5 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Python_implementation\"><\/span>Python implementation<span class=\"ez-toc-section-end\"><\/span><\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a026a89 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a026a89\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-23e786a\" data-id=\"23e786a\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-7c502d3 elementor-widget elementor-widget-elementor-syntax-highlighter\" data-id=\"7c502d3\" data-element_type=\"widget\" data-widget_type=\"elementor-syntax-highlighter.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre><code class='language-python'>import pandas as pd\nimport matplotlib.pyplot as plt\nimport warnings\nwarnings.filterwarnings('ignore') #ignore warnings\n\ndf = pd.read_csv('https:\/\/raw.githubusercontent.com\/mlinsights\/freemium\/main\/datasets\/regression-analysis\/milk_price_market_survey.csv')\ndf.head()\n\nplt.figure() #plotting the data\nplt.scatter(df['gram'],df['price'])\nplt.xlabel('gram (g)')\nplt.ylabel('unit price')\nplt.title('Milk Pricing Survey Data')\n\nfrom sklearn.linear_model import LinearRegression\nimport numpy as np\n\nlm = LinearRegression()\nX = df[['gram']]\ny = df[['price']]\n\nlm.fit(X,y) #fit model\ny_predict = lm.predict(X)#get model prediction of observation\nprice_model = &quot;p(g) = %.3fg + %.3f&quot;%(lm.coef_[0],lm.intercept_)\nprint(price_model)\n\nx_min = X.min()[0] #find variable lower bound\nx_max = X.max()[0] #find variable upper bound\nr_x = x_max-x_min\nx_n = np.arange(x_min,x_max,step=r_x\/100) \ny_n = lm.predict(x_n.reshape(-1,1))\n\nplt.figure()\nplt.scatter(df['gram'],df['price'])\nplt.plot(x_n,y_n,color=&quot;red&quot;)\nplt.xlabel('gram (g)')\nplt.ylabel('unit price')\nplt.title('Milk Pricing Survey Data - Regression model: %s'%(price_model))\nplt.show()\n\n <\/code><\/pre><script>\nif (!document.getElementById('syntaxed-prism')) {\n\tvar my_awesome_script = document.createElement('script');\n\tmy_awesome_script.setAttribute('src','https:\/\/mlinsightscentral.com\/wp-content\/plugins\/syntax-highlighter-for-elementor\/assets\/prism2.js');\n\tmy_awesome_script.setAttribute('id','syntaxed-prism');\n\tdocument.body.appendChild(my_awesome_script);\n} else {\n\twindow.Prism && Prism.highlightAll();\n}\n<\/script>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-7f3ec55 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7f3ec55\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-472f607\" data-id=\"472f607\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-58cbd2d elementor-widget elementor-widget-heading\" data-id=\"58cbd2d\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h5 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Goodness_of_fit_and_R2_score\"><\/span>Goodness of fit and R2 score<span class=\"ez-toc-section-end\"><\/span><\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-eb19d16 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"eb19d16\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-34e1d6e\" data-id=\"34e1d6e\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-3fcca73 elementor-widget elementor-widget-text-editor\" data-id=\"3fcca73\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"page\" role=\"region\" data-page-number=\"4\" aria-label=\"Page 4\" data-loaded=\"true\" data-listening-for-double-click=\"true\"><div class=\"textLayer\">To evaluate the goodness of fit for a regression model, a scatter plot displaying observed data and model predictions is often created, accompanied by the coefficient of determination score R2. A well-fitted model will yield a stronger correlation between observed data and the model prediction.<\/div><\/div>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-becbd65 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"becbd65\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5489f23\" data-id=\"5489f23\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a680e8a elementor-widget elementor-widget-image\" data-id=\"a680e8a\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"572\" height=\"453\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/goodness_fit.png\" class=\"attachment-large size-large wp-image-951\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/goodness_fit.png 572w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/goodness_fit-300x238.png 300w\" sizes=\"auto, (max-width: 572px) 100vw, 572px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-79db6e7 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"79db6e7\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-648a206\" data-id=\"648a206\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-4d2e153 elementor-widget elementor-widget-image\" data-id=\"4d2e153\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"537\" height=\"311\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq_78910.png\" class=\"attachment-large size-large wp-image-953\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq_78910.png 537w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq_78910-300x174.png 300w\" sizes=\"auto, (max-width: 537px) 100vw, 537px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-54ceeb3 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"54ceeb3\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7ca90d0\" data-id=\"7ca90d0\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-26bd23d elementor-widget elementor-widget-image\" data-id=\"26bd23d\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"780\" height=\"145\" src=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq_78910_legend.png\" class=\"attachment-large size-large wp-image-954\" alt=\"\" srcset=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq_78910_legend.png 780w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq_78910_legend-300x56.png 300w, https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/08\/eq_78910_legend-768x143.png 768w\" sizes=\"auto, (max-width: 780px) 100vw, 780px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8d12cef elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8d12cef\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c1d6fc6\" data-id=\"c1d6fc6\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-4ef371f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4ef371f\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-8f6ccda\" data-id=\"8f6ccda\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e611989 elementor-widget elementor-widget-elementor-syntax-highlighter\" data-id=\"e611989\" data-element_type=\"widget\" data-widget_type=\"elementor-syntax-highlighter.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<pre><code class='language-python'>from sklearn.metrics import r2_score\r\n\r\nr2_score_m = r2_score(y_predict,y)\r\n\r\nplt.figure()\r\nplt.scatter(y, y_predict, color=&quot;b&quot;)\r\nplt.xlabel('observed data: y_d')\r\nplt.ylabel('model prediction: y_p')\r\nplt.title('Goodness of fit -  R2: %.2f'%r2_score_m)\r\nplt.show() <\/code><\/pre><script>\nif (!document.getElementById('syntaxed-prism')) {\n\tvar my_awesome_script = document.createElement('script');\n\tmy_awesome_script.setAttribute('src','https:\/\/mlinsightscentral.com\/wp-content\/plugins\/syntax-highlighter-for-elementor\/assets\/prism2.js');\n\tmy_awesome_script.setAttribute('id','syntaxed-prism');\n\tdocument.body.appendChild(my_awesome_script);\n} else {\n\twindow.Prism && Prism.highlightAll();\n}\n<\/script>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5d87ec2 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5d87ec2\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-6cd45a1\" data-id=\"6cd45a1\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-6f04a1c elementor-widget elementor-widget-heading\" data-id=\"6f04a1c\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h5 class=\"elementor-heading-title elementor-size-default\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h5>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-236fb2c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"236fb2c\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-e0812d6\" data-id=\"e0812d6\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-fd4e78e elementor-widget elementor-widget-text-editor\" data-id=\"fd4e78e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Linear regression is a simple regression model that assumes a linear relationship between dependent variables and the target output using, most typically the least square estimation approach to determine the model parameters. It is robust in estimating the skeletal relational in simple and complex datasets.\u00a0 Nonlinear regression models can be used to estimate more intricate relationships when the data inherent connections are nonlinear.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-4f1de3b elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4f1de3b\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-86a4b06\" data-id=\"86a4b06\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-725139f elementor-widget elementor-widget-heading\" data-id=\"725139f\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Author: Yves Matanga, PhD<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-b42e6f5 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"b42e6f5\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-0d00745\" data-id=\"0d00745\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap\">\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-6cb58b7c elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"6cb58b7c\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-32ef01a5\" data-id=\"32ef01a5\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2b22e41 elementor-widget elementor-widget-heading\" data-id=\"2b22e41\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<p class=\"elementor-heading-title elementor-size-default\">Be the first to receive notification, when new content is available!<\/p>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-27cb8a94 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"27cb8a94\" data-element_type=\"section\">\n\t\t\t\t\t\t\t<div class=\"elementor-background-overlay\"><\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-591fcdac\" data-id=\"591fcdac\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-55187e2 elementor-widget elementor-widget-wpforms\" data-id=\"55187e2\" data-element_type=\"widget\" data-widget_type=\"wpforms.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<div class=\"wpforms-container inline-fields\" id=\"wpforms-10\"><form id=\"wpforms-form-10\" class=\"wpforms-validate wpforms-form\" data-formid=\"10\" method=\"post\" enctype=\"multipart\/form-data\" action=\"\/index.php\/wp-json\/wp\/v2\/pages\/816\" data-token=\"bbd3c4710160bb8dec80be36f260a4f7\"><noscript class=\"wpforms-error-noscript\">Please enable JavaScript in your browser to complete this form.<\/noscript><div class=\"wpforms-field-container\"><div id=\"wpforms-10-field_1-container\" class=\"wpforms-field wpforms-field-email wpforms-mobile-full\" data-field-id=\"1\"><label class=\"wpforms-field-label wpforms-label-hide\" for=\"wpforms-10-field_1\">Email <span class=\"wpforms-required-label\">*<\/span><\/label><input type=\"email\" id=\"wpforms-10-field_1\" class=\"wpforms-field-large wpforms-field-required\" name=\"wpforms[fields][1]\" placeholder=\"Email address\" spellcheck=\"false\" required><\/div><\/div><!-- .wpforms-field-container --><div class=\"wpforms-submit-container\" ><input type=\"hidden\" name=\"wpforms[id]\" value=\"10\"><input type=\"hidden\" name=\"wpforms[author]\" value=\"1\"><button type=\"submit\" name=\"wpforms[submit]\" id=\"wpforms-submit-10\" class=\"wpforms-submit\" data-alt-text=\"Sending...\" data-submit-text=\"Subscribe\" aria-live=\"assertive\" value=\"wpforms-submit\">Subscribe<\/button><\/div><\/form><\/div>  <!-- .wpforms-container -->\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Linear Regression Linear regression is the most basic regression algorithm that assumes the existence of a linear relationship between the independent variable and the dependent variables.\u00a0 Albeit its basic relationship model, it is a powerful technique robust to noise that can estimate a skeletal relationship in labelled data.Given the fictional dataset below of a survey &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/\"> <span class=\"screen-reader-text\">Linear Regression<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"wf_page_folders":[13],"class_list":["post-816","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.11 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linear Regression - MLInsightsCentral<\/title>\n<meta name=\"description\" content=\"Linear regression assumes linear relationships between the dependent variables and the output. This tutorial formulates the problem, including Python implementation.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linear Regression - MLInsightsCentral\" \/>\n<meta property=\"og:description\" content=\"Linear regression assumes linear relationships between the dependent variables and the output. This tutorial formulates the problem, including Python implementation.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/\" \/>\n<meta property=\"og:site_name\" content=\"MLInsightsCentral\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-18T15:17:16+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-06-at-22.16.59.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/\",\"url\":\"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/\",\"name\":\"Linear Regression - MLInsightsCentral\",\"isPartOf\":{\"@id\":\"https:\/\/mlinsightscentral.com\/#website\"},\"datePublished\":\"2023-07-06T19:52:50+00:00\",\"dateModified\":\"2023-09-18T15:17:16+00:00\",\"description\":\"Linear regression assumes linear relationships between the dependent variables and the output. This tutorial formulates the problem, including Python implementation.\",\"breadcrumb\":{\"@id\":\"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/mlinsightscentral.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linear Regression\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mlinsightscentral.com\/#website\",\"url\":\"https:\/\/mlinsightscentral.com\/\",\"name\":\"MLInsightsCentral\",\"description\":\"Learn Machine Learning and AI for engineers, data scientists and AI practionners.\",\"publisher\":{\"@id\":\"https:\/\/mlinsightscentral.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/mlinsightscentral.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/mlinsightscentral.com\/#organization\",\"name\":\"MLInsightsCentral\",\"url\":\"https:\/\/mlinsightscentral.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/mlinsightscentral.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/06\/cropped-1290538dccf74accb0ae585ff4e8586c-1.png\",\"contentUrl\":\"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/06\/cropped-1290538dccf74accb0ae585ff4e8586c-1.png\",\"width\":200,\"height\":110,\"caption\":\"MLInsightsCentral\"},\"image\":{\"@id\":\"https:\/\/mlinsightscentral.com\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linear Regression - MLInsightsCentral","description":"Linear regression assumes linear relationships between the dependent variables and the output. This tutorial formulates the problem, including Python implementation.","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:\/\/mlinsightscentral.com\/index.php\/linear-regression\/","og_locale":"en_US","og_type":"article","og_title":"Linear Regression - MLInsightsCentral","og_description":"Linear regression assumes linear relationships between the dependent variables and the output. This tutorial formulates the problem, including Python implementation.","og_url":"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/","og_site_name":"MLInsightsCentral","article_modified_time":"2023-09-18T15:17:16+00:00","og_image":[{"url":"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/07\/Screenshot-2023-07-06-at-22.16.59.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/","url":"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/","name":"Linear Regression - MLInsightsCentral","isPartOf":{"@id":"https:\/\/mlinsightscentral.com\/#website"},"datePublished":"2023-07-06T19:52:50+00:00","dateModified":"2023-09-18T15:17:16+00:00","description":"Linear regression assumes linear relationships between the dependent variables and the output. This tutorial formulates the problem, including Python implementation.","breadcrumb":{"@id":"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/mlinsightscentral.com\/index.php\/linear-regression\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/mlinsightscentral.com\/"},{"@type":"ListItem","position":2,"name":"Linear Regression"}]},{"@type":"WebSite","@id":"https:\/\/mlinsightscentral.com\/#website","url":"https:\/\/mlinsightscentral.com\/","name":"MLInsightsCentral","description":"Learn Machine Learning and AI for engineers, data scientists and AI practionners.","publisher":{"@id":"https:\/\/mlinsightscentral.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mlinsightscentral.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/mlinsightscentral.com\/#organization","name":"MLInsightsCentral","url":"https:\/\/mlinsightscentral.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mlinsightscentral.com\/#\/schema\/logo\/image\/","url":"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/06\/cropped-1290538dccf74accb0ae585ff4e8586c-1.png","contentUrl":"https:\/\/mlinsightscentral.com\/wp-content\/uploads\/2023\/06\/cropped-1290538dccf74accb0ae585ff4e8586c-1.png","width":200,"height":110,"caption":"MLInsightsCentral"},"image":{"@id":"https:\/\/mlinsightscentral.com\/#\/schema\/logo\/image\/"}}]}},"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"admin","author_link":"https:\/\/mlinsightscentral.com\/index.php\/author\/yvesm\/"},"uagb_comment_info":2,"uagb_excerpt":"Linear Regression Linear regression is the most basic regression algorithm that assumes the existence of a linear relationship between the independent variable and the dependent variables.\u00a0 Albeit its basic relationship model, it is a powerful technique robust to noise that can estimate a skeletal relationship in labelled data.Given the fictional dataset below of a survey&hellip;","_links":{"self":[{"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/pages\/816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/comments?post=816"}],"version-history":[{"count":181,"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/pages\/816\/revisions"}],"predecessor-version":[{"id":2103,"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/pages\/816\/revisions\/2103"}],"wp:attachment":[{"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/media?parent=816"}],"wp:term":[{"taxonomy":"wf_page_folders","embeddable":true,"href":"https:\/\/mlinsightscentral.com\/index.php\/wp-json\/wp\/v2\/wf_page_folders?post=816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}