SlideShare a Scribd company logo
1 of 10
Download to read offline
https://www.youtube.com/watch?v=EN8u8KtYWtM
Linear Regression From Scratch
Linear
Regression
Linear Regression Algorithm
Relationship between two or more variables
Independent Variable
Dependent Variable
Algorithm
Why Linear Regression from Scratch
Understanding the fundamentals
Math behind the algorithm
No dependency
Introduction
Statistical concepts used
Mean
Average of a data set
Add all numbers
Divide by the number of values
Statistical concepts used
Variance
Measure of the spread
Distance from Mean
Divide by the number of values
Statistical concepts used
Covariance
Two random variables
How variables vary together
Measure of the directional relationship
Linear Regression
Salary data with years of experience
Linear Regression
Equation of a line is Y = m * X + c
Linear Regression
Implementation Steps
Import the required libraries
Load the data
Visualize the data
Calculate the Mean
Calculate the variance
Calculate the covariance
Calculate the coefficients
Predict using the model
https://www.youtube.com/watch?v=EN8u8KtYWtM
https://medium.com/@dhiraj8899
Happy Learning
Thank You

More Related Content

What's hot

Unit 6 input modeling
Unit 6 input modeling Unit 6 input modeling
Unit 6 input modeling raksharao
 
Snapshot: Functional Excel Functions for E-Resources
Snapshot: Functional Excel Functions for E-ResourcesSnapshot: Functional Excel Functions for E-Resources
Snapshot: Functional Excel Functions for E-ResourcesNASIG
 
Energy Wasting Rate as a Metrics for Green Computing and Static Analysis
Energy Wasting Rate as a Metrics for Green Computing and Static AnalysisEnergy Wasting Rate as a Metrics for Green Computing and Static Analysis
Energy Wasting Rate as a Metrics for Green Computing and Static AnalysisJérôme Rocheteau
 
Exploiting Big Data in Time Series Forecasting: A Cross-Sectional Approach
Exploiting Big Data in Time Series Forecasting: A Cross-Sectional ApproachExploiting Big Data in Time Series Forecasting: A Cross-Sectional Approach
Exploiting Big Data in Time Series Forecasting: A Cross-Sectional ApproachMolham Al-Maleh
 
C programming exercises and solutions
C programming exercises and solutions C programming exercises and solutions
C programming exercises and solutions Rumman Ansari
 
Experimental Meta-analyses
Experimental Meta-analysesExperimental Meta-analyses
Experimental Meta-analysesWeitao Duan
 
Chapter 13 finding relationships
Chapter 13 finding relationshipsChapter 13 finding relationships
Chapter 13 finding relationships201120305
 
MATLAB Project Ideas Engineering Research Assistance
MATLAB Project Ideas Engineering Research AssistanceMATLAB Project Ideas Engineering Research Assistance
MATLAB Project Ideas Engineering Research AssistanceMatlab Simulation
 
Creating a histogram
Creating a histogramCreating a histogram
Creating a histogramKyle Greaves
 
Application of calculus in cse
Application of calculus in cseApplication of calculus in cse
Application of calculus in cseMd. Janibul Hoque
 
Interactive data visualization project
Interactive data visualization project Interactive data visualization project
Interactive data visualization project BabatundeSogunro
 

What's hot (15)

Unit 6 input modeling
Unit 6 input modeling Unit 6 input modeling
Unit 6 input modeling
 
Pareto
ParetoPareto
Pareto
 
Mann Whitney U test
Mann Whitney U testMann Whitney U test
Mann Whitney U test
 
Numerical Algorithms
Numerical AlgorithmsNumerical Algorithms
Numerical Algorithms
 
Snapshot: Functional Excel Functions for E-Resources
Snapshot: Functional Excel Functions for E-ResourcesSnapshot: Functional Excel Functions for E-Resources
Snapshot: Functional Excel Functions for E-Resources
 
Energy Wasting Rate as a Metrics for Green Computing and Static Analysis
Energy Wasting Rate as a Metrics for Green Computing and Static AnalysisEnergy Wasting Rate as a Metrics for Green Computing and Static Analysis
Energy Wasting Rate as a Metrics for Green Computing and Static Analysis
 
Exploiting Big Data in Time Series Forecasting: A Cross-Sectional Approach
Exploiting Big Data in Time Series Forecasting: A Cross-Sectional ApproachExploiting Big Data in Time Series Forecasting: A Cross-Sectional Approach
Exploiting Big Data in Time Series Forecasting: A Cross-Sectional Approach
 
C programming exercises and solutions
C programming exercises and solutions C programming exercises and solutions
C programming exercises and solutions
 
Experimental Meta-analyses
Experimental Meta-analysesExperimental Meta-analyses
Experimental Meta-analyses
 
Chapter 13 finding relationships
Chapter 13 finding relationshipsChapter 13 finding relationships
Chapter 13 finding relationships
 
Gordoncorr
GordoncorrGordoncorr
Gordoncorr
 
MATLAB Project Ideas Engineering Research Assistance
MATLAB Project Ideas Engineering Research AssistanceMATLAB Project Ideas Engineering Research Assistance
MATLAB Project Ideas Engineering Research Assistance
 
Creating a histogram
Creating a histogramCreating a histogram
Creating a histogram
 
Application of calculus in cse
Application of calculus in cseApplication of calculus in cse
Application of calculus in cse
 
Interactive data visualization project
Interactive data visualization project Interactive data visualization project
Interactive data visualization project
 

Similar to Linear Regression from Scratch in Python

Machine learning with scikitlearn
Machine learning with scikitlearnMachine learning with scikitlearn
Machine learning with scikitlearnPratap Dangeti
 
Anomaly detection Meetup Slides
Anomaly detection Meetup SlidesAnomaly detection Meetup Slides
Anomaly detection Meetup SlidesQuantUniversity
 
Anomaly detection: Core Techniques and Advances in Big Data and Deep Learning
Anomaly detection: Core Techniques and Advances in Big Data and Deep LearningAnomaly detection: Core Techniques and Advances in Big Data and Deep Learning
Anomaly detection: Core Techniques and Advances in Big Data and Deep LearningQuantUniversity
 
AIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTIONAIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTIONIRJET Journal
 
Multiple Regression Analysis Exam For Pathology Severity,...
Multiple Regression Analysis Exam For Pathology Severity,...Multiple Regression Analysis Exam For Pathology Severity,...
Multiple Regression Analysis Exam For Pathology Severity,...Samantha Reed
 
IRJET - Stock Market Prediction using Machine Learning Algorithm
IRJET - Stock Market Prediction using Machine Learning AlgorithmIRJET - Stock Market Prediction using Machine Learning Algorithm
IRJET - Stock Market Prediction using Machine Learning AlgorithmIRJET Journal
 
Regression and Artificial Neural Network in R
Regression and Artificial Neural Network in RRegression and Artificial Neural Network in R
Regression and Artificial Neural Network in RDr. Vaibhav Kumar
 
CASE STUDY: ADMISSION PREDICTION IN ENGINEERING AND TECHNOLOGY COLLEGES
CASE STUDY: ADMISSION PREDICTION IN ENGINEERING AND TECHNOLOGY COLLEGESCASE STUDY: ADMISSION PREDICTION IN ENGINEERING AND TECHNOLOGY COLLEGES
CASE STUDY: ADMISSION PREDICTION IN ENGINEERING AND TECHNOLOGY COLLEGESIRJET Journal
 
Thesis Presentation on Energy Efficiency Improvement in Data Centers
Thesis Presentation on Energy Efficiency Improvement in Data CentersThesis Presentation on Energy Efficiency Improvement in Data Centers
Thesis Presentation on Energy Efficiency Improvement in Data CentersMonica Vitali
 
Multiple-Linear-Regression-Model-Analysis.pptx
Multiple-Linear-Regression-Model-Analysis.pptxMultiple-Linear-Regression-Model-Analysis.pptx
Multiple-Linear-Regression-Model-Analysis.pptxNaryCasila
 
AIAA-SDM-PEMF-2013
AIAA-SDM-PEMF-2013AIAA-SDM-PEMF-2013
AIAA-SDM-PEMF-2013OptiModel
 
ML_Regression.pptx
ML_Regression.pptxML_Regression.pptx
ML_Regression.pptxhackcheck
 
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...Simplilearn
 
Kickstart ML.pptx
Kickstart ML.pptxKickstart ML.pptx
Kickstart ML.pptxGDSCVJTI
 

Similar to Linear Regression from Scratch in Python (20)

Machine learning with scikitlearn
Machine learning with scikitlearnMachine learning with scikitlearn
Machine learning with scikitlearn
 
MACHINE LEARNING.pptx
MACHINE LEARNING.pptxMACHINE LEARNING.pptx
MACHINE LEARNING.pptx
 
Anomaly detection Meetup Slides
Anomaly detection Meetup SlidesAnomaly detection Meetup Slides
Anomaly detection Meetup Slides
 
Machine learning meetup
Machine learning meetupMachine learning meetup
Machine learning meetup
 
Anomaly detection: Core Techniques and Advances in Big Data and Deep Learning
Anomaly detection: Core Techniques and Advances in Big Data and Deep LearningAnomaly detection: Core Techniques and Advances in Big Data and Deep Learning
Anomaly detection: Core Techniques and Advances in Big Data and Deep Learning
 
SEM
SEMSEM
SEM
 
AIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTIONAIRLINE FARE PRICE PREDICTION
AIRLINE FARE PRICE PREDICTION
 
Multiple Regression Analysis Exam For Pathology Severity,...
Multiple Regression Analysis Exam For Pathology Severity,...Multiple Regression Analysis Exam For Pathology Severity,...
Multiple Regression Analysis Exam For Pathology Severity,...
 
IRJET - Stock Market Prediction using Machine Learning Algorithm
IRJET - Stock Market Prediction using Machine Learning AlgorithmIRJET - Stock Market Prediction using Machine Learning Algorithm
IRJET - Stock Market Prediction using Machine Learning Algorithm
 
Regression and Artificial Neural Network in R
Regression and Artificial Neural Network in RRegression and Artificial Neural Network in R
Regression and Artificial Neural Network in R
 
CASE STUDY: ADMISSION PREDICTION IN ENGINEERING AND TECHNOLOGY COLLEGES
CASE STUDY: ADMISSION PREDICTION IN ENGINEERING AND TECHNOLOGY COLLEGESCASE STUDY: ADMISSION PREDICTION IN ENGINEERING AND TECHNOLOGY COLLEGES
CASE STUDY: ADMISSION PREDICTION IN ENGINEERING AND TECHNOLOGY COLLEGES
 
Supervised Machine Learning
Supervised Machine LearningSupervised Machine Learning
Supervised Machine Learning
 
Thesis Presentation on Energy Efficiency Improvement in Data Centers
Thesis Presentation on Energy Efficiency Improvement in Data CentersThesis Presentation on Energy Efficiency Improvement in Data Centers
Thesis Presentation on Energy Efficiency Improvement in Data Centers
 
Multiple-Linear-Regression-Model-Analysis.pptx
Multiple-Linear-Regression-Model-Analysis.pptxMultiple-Linear-Regression-Model-Analysis.pptx
Multiple-Linear-Regression-Model-Analysis.pptx
 
Regression
RegressionRegression
Regression
 
03 Data Mining Techniques
03 Data Mining Techniques03 Data Mining Techniques
03 Data Mining Techniques
 
AIAA-SDM-PEMF-2013
AIAA-SDM-PEMF-2013AIAA-SDM-PEMF-2013
AIAA-SDM-PEMF-2013
 
ML_Regression.pptx
ML_Regression.pptxML_Regression.pptx
ML_Regression.pptx
 
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...
Machine Learning Tutorial Part - 1 | Machine Learning Tutorial For Beginners ...
 
Kickstart ML.pptx
Kickstart ML.pptxKickstart ML.pptx
Kickstart ML.pptx
 

Recently uploaded

Elements of language learning - an analysis of how different elements of lang...
Elements of language learning - an analysis of how different elements of lang...Elements of language learning - an analysis of how different elements of lang...
Elements of language learning - an analysis of how different elements of lang...PrithaVashisht1
 
MEASURES OF DISPERSION I BSc Botany .ppt
MEASURES OF DISPERSION I BSc Botany .pptMEASURES OF DISPERSION I BSc Botany .ppt
MEASURES OF DISPERSION I BSc Botany .pptaigil2
 
ChistaDATA Real-Time DATA Analytics Infrastructure
ChistaDATA Real-Time DATA Analytics InfrastructureChistaDATA Real-Time DATA Analytics Infrastructure
ChistaDATA Real-Time DATA Analytics Infrastructuresonikadigital1
 
SFBA Splunk Usergroup meeting March 13, 2024
SFBA Splunk Usergroup meeting March 13, 2024SFBA Splunk Usergroup meeting March 13, 2024
SFBA Splunk Usergroup meeting March 13, 2024Becky Burwell
 
Mapping the pubmed data under different suptopics using NLP.pptx
Mapping the pubmed data under different suptopics using NLP.pptxMapping the pubmed data under different suptopics using NLP.pptx
Mapping the pubmed data under different suptopics using NLP.pptxVenkatasubramani13
 
Cash Is Still King: ATM market research '2023
Cash Is Still King: ATM market research '2023Cash Is Still King: ATM market research '2023
Cash Is Still King: ATM market research '2023Vladislav Solodkiy
 
Master's Thesis - Data Science - Presentation
Master's Thesis - Data Science - PresentationMaster's Thesis - Data Science - Presentation
Master's Thesis - Data Science - PresentationGiorgio Carbone
 
Cyclistic Memberships Data Analysis Project
Cyclistic Memberships Data Analysis ProjectCyclistic Memberships Data Analysis Project
Cyclistic Memberships Data Analysis Projectdanielbell861
 
YourView Panel Book.pptx YourView Panel Book.
YourView Panel Book.pptx YourView Panel Book.YourView Panel Book.pptx YourView Panel Book.
YourView Panel Book.pptx YourView Panel Book.JasonViviers2
 
Create Data Model & Conduct Visualisation in Power BI Desktop
Create Data Model & Conduct Visualisation in Power BI DesktopCreate Data Model & Conduct Visualisation in Power BI Desktop
Create Data Model & Conduct Visualisation in Power BI DesktopThinkInnovation
 
The Universal GTM - how we design GTM and dataLayer
The Universal GTM - how we design GTM and dataLayerThe Universal GTM - how we design GTM and dataLayer
The Universal GTM - how we design GTM and dataLayerPavel Šabatka
 
Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024
Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024
Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024Guido X Jansen
 
5 Ds to Define Data Archiving Best Practices
5 Ds to Define Data Archiving Best Practices5 Ds to Define Data Archiving Best Practices
5 Ds to Define Data Archiving Best PracticesDataArchiva
 

Recently uploaded (13)

Elements of language learning - an analysis of how different elements of lang...
Elements of language learning - an analysis of how different elements of lang...Elements of language learning - an analysis of how different elements of lang...
Elements of language learning - an analysis of how different elements of lang...
 
MEASURES OF DISPERSION I BSc Botany .ppt
MEASURES OF DISPERSION I BSc Botany .pptMEASURES OF DISPERSION I BSc Botany .ppt
MEASURES OF DISPERSION I BSc Botany .ppt
 
ChistaDATA Real-Time DATA Analytics Infrastructure
ChistaDATA Real-Time DATA Analytics InfrastructureChistaDATA Real-Time DATA Analytics Infrastructure
ChistaDATA Real-Time DATA Analytics Infrastructure
 
SFBA Splunk Usergroup meeting March 13, 2024
SFBA Splunk Usergroup meeting March 13, 2024SFBA Splunk Usergroup meeting March 13, 2024
SFBA Splunk Usergroup meeting March 13, 2024
 
Mapping the pubmed data under different suptopics using NLP.pptx
Mapping the pubmed data under different suptopics using NLP.pptxMapping the pubmed data under different suptopics using NLP.pptx
Mapping the pubmed data under different suptopics using NLP.pptx
 
Cash Is Still King: ATM market research '2023
Cash Is Still King: ATM market research '2023Cash Is Still King: ATM market research '2023
Cash Is Still King: ATM market research '2023
 
Master's Thesis - Data Science - Presentation
Master's Thesis - Data Science - PresentationMaster's Thesis - Data Science - Presentation
Master's Thesis - Data Science - Presentation
 
Cyclistic Memberships Data Analysis Project
Cyclistic Memberships Data Analysis ProjectCyclistic Memberships Data Analysis Project
Cyclistic Memberships Data Analysis Project
 
YourView Panel Book.pptx YourView Panel Book.
YourView Panel Book.pptx YourView Panel Book.YourView Panel Book.pptx YourView Panel Book.
YourView Panel Book.pptx YourView Panel Book.
 
Create Data Model & Conduct Visualisation in Power BI Desktop
Create Data Model & Conduct Visualisation in Power BI DesktopCreate Data Model & Conduct Visualisation in Power BI Desktop
Create Data Model & Conduct Visualisation in Power BI Desktop
 
The Universal GTM - how we design GTM and dataLayer
The Universal GTM - how we design GTM and dataLayerThe Universal GTM - how we design GTM and dataLayer
The Universal GTM - how we design GTM and dataLayer
 
Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024
Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024
Persuasive E-commerce, Our Biased Brain @ Bikkeldag 2024
 
5 Ds to Define Data Archiving Best Practices
5 Ds to Define Data Archiving Best Practices5 Ds to Define Data Archiving Best Practices
5 Ds to Define Data Archiving Best Practices
 

Linear Regression from Scratch in Python