Close Menu
    Trending
    • ‘Shark Tank’ Star Barbara Corcoran Reveals Her True Passion
    • How AI Is Revolutionizing the Fashion Industry: From Smart Designs to Futuristic Runways! | by Maha Althobaiti | May, 2025
    • Elon Musk Is Committing to Five More Years as Tesla CEO
    • What the Most Detailed Peer-Reviewed Study on AI in the Classroom Taught Us
    • Smart Caching for Fast LLM Tools — ColdStarts & HotContext, Part 1 | by Zeneil Ambekar | May, 2025
    • Why Your Audience Isn’t Listening Anymore (And What You Can Do About It)
    • I Teach Data Viz with a Bag of Rocks
    • AI strategies from the front lines
    Finance StarGate
    • Home
    • Artificial Intelligence
    • AI Technology
    • Data Science
    • Machine Learning
    • Finance
    • Passive Income
    Finance StarGate
    Home»Machine Learning»Introduction To Linear Regression | by Jeet Mukherjee | May, 2025
    Machine Learning

    Introduction To Linear Regression | by Jeet Mukherjee | May, 2025

    FinanceStarGateBy FinanceStarGateMay 20, 2025No Comments6 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    Jeet Mukherjee

    You probably have ever made a single search on Machine Studying, I’m positive you’ve gotten encountered the time period linear regression. Welcome to Linear Regression 101. On this weblog, collectively we’ll discover each theoretical and mathematical elements of Linear Regression.

    If this query ever involves you, ‘What’s machine studying?’, keep in mind the reply already lies within the query. All of your objective is to make machines be taught. However the larger query is how? I imply ‘How a machine learns’. Effectively, it makes use of nothing however information. A whole lot of information and totally different varieties of information for various kinds of studying. So when a machine learns, we count on it to share that studying with us. Now, there are alternative ways of sharing that exact studying.

    Bear in mind, a Machine can be taught solely from numerical information. However how we extract that studying out of a machine can differ. If the output of a machine studying mannequin is numerical, steady values, it’s a regression mannequin. A typical instance can be the fundamental home value upon giving housing particulars. However, if the output is categorical, it’s a classification mannequin. For instance, if a given picture is a canine or a cat. ( We are able to have a number of values for categorical outputs as effectively. )

    — What’s Linear Regression?

    Discovering the best-fit line in a given information plot.

    Now, what’s a knowledge plot? Let’s say you’ve gotten a 2D picture. Think about an X axis and a Y axis in that picture. Your X-axis refers back to the variety of rooms, and your Y-axis refers back to the value of the home. Upon altering the worth of X ( the impartial variable ), the worth of Y ( the dependent variable ) modifications linearly. If we enhance/lower X, Y will increase/decreases. Which makes full sense additionally, should you take a look at the instance correctly. Upon growing the variety of rooms in a home, the value of the home will routinely enhance.

    So we all know from this graph that if we are attempting to foretell a home value, the variety of rooms will play a big function in that prediction. (Ref to Determine 1)

    Determine 1

    Now you may ask a query. How do we discover this line, and greater than that, how do we all know the place to place that line? How can we determine the intercept (The road might be positioned a little bit up or down) or slope (The road might be a little bit steeper) of the road?

    Let me introduce → Y = mX + c

    An equation that represents the road in slope-intercept type. Right here, m is the slope and c is the intercept. Now, you is perhaps considering: when did we immediately bounce into this equation out of nowhere? And the way is that this making the machine be taught?

    Effectively, let’s begin from the fundamentals. We already find out about Y(Home Worth) and X(Variety of Rooms). We have to discover a line that may completely match between these two explicit axes in order that, sooner or later, when we’ve a brand new worth for X, we must always be capable to get the worth of Y. ( If you’re a little bit confused right here, attempt visualising the graph by altering the worth of X and see how the worth of Y is getting effected). This equation helps us to seek out that line.

    Notations —

    → X — Impartial variable ( Xᵢ represents the i-th worth of X )

    → Y — Dependent variable ( Yᵢ represents the i-th worth of Y )

    → y — Predicted worth ( The worth for ‘y’ is calculated through the use of a specific worth of X )

    → m — Slope ( The worth of ‘m’ decides how a lot significance Xᵢ has for predicting y)

    → c — Intercepts ( For Xᵢ = 0, what must be the worth of yᵢ )

    → Σ — Summation ( For i=1, add all of the values from 1 to n )

    — Discovering ‘m’

    Calculating the worth for m and c is easy but essential. For a sure worth of X, we calculate the worth of y. Initially, a random worth is assigned to c. Then we discover the distinction between ‘Y’ (precise worth) and ‘y’ (predicted worth). These variations are generally known as residuals. A activity for ML algorithm is to scale back this error between the precise worth and predicted worth.

    The components that we used to calculate the worth of ‘m and c’ is OLS ( Abnormal Least Squares ). L = Σ(Yᵢ−yᵢ)²

    Let’s begin fixing this equation,

    • Step 1 → L = Σ(Yᵢ − mXᵢ − c)² as yᵢ = mXᵢ + c ( Bear in mind right here yᵢ is the expected worth for the i-th worth of X )
    • Step 2 → First, we calculate the by-product for ‘c’.

    → dL/dc = 2 Σ(Yᵢ − mXᵢ − c) * (-1)

    → −2Σ(Yᵢ − mXᵢ − c) = 0

    → N*c = Σ(Yᵢ − mXᵢ)

    → c = Y’ − mX’ ( Right here, Y’ and X’ represents the imply worth for ΣYᵢ and ΣXᵢ )

    • Step 3 → Calculate the by-product for ‘m’.
    • Step 4 → L = Σ(Yᵢ − mXᵢ − c)² with c = Σ(Y’ − mX’)

    → dL/dm = 2 Σ(Yᵢ − mXᵢ − Y’ + mX’) * ( − Xᵢ + X’ )

    → 2 Σ(Yᵢ − mXᵢ − Y’ + mX’) * ( − Xᵢ + X’ ) = 0

    → −2 Σ((Yᵢ − Y’) − m(Xᵢ − X’)) * ( Xᵢ − X’ ) = 0

    → Σ((Yᵢ − Y’) − m(Xᵢ − X’)) * ( Xᵢ − X’ ) = 0

    → Σ((Yᵢ − Y’)( Xᵢ − X’ ) − m(Xᵢ − X’)²)= 0

    → m = Σ(Yᵢ − Y’)( Xᵢ − X’ )/Σ(Xᵢ − X’)²

    That is the components you employ to calculate the worth of ‘m’, once you write your code in Python. Now, after you have the worth of ‘m’ and ‘c’, you may calculate the worth of y for any new worth of X through the use of the components Y = mX + c. The preliminary worth for ‘c’ is randomly chosen in some instances.

    However this components will solely works for Easy Linear Regression, for A number of Linear Regression we’ve to make use of Gradient Descent algorithm.



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleDDN Teams With NVIDIA on AI Data Platform Reference Design
    Next Article AI strategies from the front lines
    FinanceStarGate

    Related Posts

    Machine Learning

    How AI Is Revolutionizing the Fashion Industry: From Smart Designs to Futuristic Runways! | by Maha Althobaiti | May, 2025

    May 21, 2025
    Machine Learning

    Smart Caching for Fast LLM Tools — ColdStarts & HotContext, Part 1 | by Zeneil Ambekar | May, 2025

    May 21, 2025
    Machine Learning

    Rock-Paper-Scissors Classifier. Introduction | by AbdGhordlo | May, 2025

    May 20, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    Work-Life Balance Is Outdated. Here’s a Better Approach.

    April 8, 2025

    How to break into data science \ machine learning | by Data_Guy | Apr, 2025

    April 28, 2025

    10 Data Access Control Best Practices

    March 5, 2025

    5 Ways CEOs Can Assess and Reset Their Company Culture

    May 8, 2025

    Dell Issues Strict RTO Mandate for Most Employees

    February 1, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Data Science
    • Finance
    • Machine Learning
    • Passive Income
    Most Popular

    63-year-old wonders if she can retire with $100,000 debt

    February 12, 2025

    How to Position Your Financial Firm as an Industry Leader

    March 30, 2025

    Learn Data Science Like a Pro: Python Control Flow #Day2 | by Ritesh Gupta | May, 2025

    May 4, 2025
    Our Picks

    Graph Representation Learning using Graph Transformers !! | by Sarvesh Khetan | Mar, 2025

    March 16, 2025

    Codie Sanchez’s Contrarian Thinking Announces the Appointment of Marc Hustvedt, Former MrBeast President

    February 28, 2025

    Hughigfu – Giggjgcjg Jcggucfigcig – Medium

    February 14, 2025
    Categories
    • AI Technology
    • Artificial Intelligence
    • Data Science
    • Finance
    • Machine Learning
    • Passive Income
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2025 Financestargate.com All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.