スキップしてメイン コンテンツに移動

Understanding Linear Regression from Scratch

 Linear regression, known as a gateway to statistics and machine learning, is a method for simply capturing the linear relationship between variables. 


It’s a fundamental technique for discovering patterns hidden within data and applying them to predictions and decision-making.



1. What is Linear Regression?



Linear regression is a method for predicting changes in a target variable (such as sales or temperature) using the relationship with explanatory variables (such as advertising spend or time).


The simplest form, “simple linear regression,” uses a single straight line, while “multiple linear regression,” which deals with multiple factors, models the relationship with a high-dimensional “plane” or “hyperplane.”


- Example of Simple Linear Regression


Represent the relationship between "study time" and "test scores" with a straight line, and estimate how many points the score will increase if study time increases by one hour.


- Example of Multiple Linear Regression


Predict sales by combining "advertising spend," "seasonal factors," and "economic indicators."



2. Where is Linear Regression Used?



The simplicity and ease of interpretation of linear regression make it valuable in a wide range of fields, from business to science.


- Marketing Analysis


Use advertising spend and campaign variables as explanations to predict sales and customer acquisition numbers.


- Economic and Financial Modelling


Quantify the impact of macroeconomic indicators such as interest rates and price indices on stock prices and exchange rates.


- Healthcare and Public Health


Use patient age, BMI, and smoking history as explanatory variables to predict disease risk and treatment effectiveness.


- Real Estate Price Estimation


Analyse the relationship between property area, age of building, distance to station, and price to calculate a fair price.


- Manufacturing Quality Control


Model the relationship between production conditions (temperature, pressure, raw materials) and product defect rate, and explore optimal production settings.



3. Benefits of Learning Linear Regression



- You can intuitively understand "which factors have how much influence" simply by reading the coefficients of the model.


- It’s the perfect first step for exploring correlations and potential causal relationships between data.


- The simple mathematical model is highly explainable, giving stakeholders and non-technical personnel a sense of understanding.


- It’s easy to incorporate directly into decision-making processes such as budgeting and KPI setting.


- You can directly identify areas for improvement by visualising the model’s goodness of fit (R²) and residual distribution.


- You’ll learn the basics of feature engineering and develop variable design skills that are also effective in non-linear models.


- It’s easy to run with just a few lines of code. With Python, you can complete a prototype instantly using `scikit-learn`.



Summary



Once you have a deeper understanding of linear regression, practice applying your knowledge to your own data and develop a feel for optimal model selection and tuning.


Linear regression will always be your first step and powerfully support your journey into data analysis.

If you want to learn linear regression, we recommend this book (access here).

コメント

このブログの人気の投稿

Understanding the Modified Euler Method (Heun's Method) from Scratch

This article explains the basic concepts, applications, and benefits of learning the Modified Euler Method (Heun's Method). This method, a step forward from the simple Euler method, plays a very important role in the world of numerical analysis. 1. What is the Modified Euler Method (Heun's Method)? The Modified Euler Method, also known as Heun’s Method, is a numerical method for obtaining approximate solutions to initial value problems: dy/dt = f(t, y), y(t_0) = y_0 The traditional Euler method determines the next value, y_{n+1}, using only the slope of the tangent line at time t_n, namely f(t_n, y_n).  However, when the step size is large or the problem exhibits strong non-linearity, this can lead to significant errors. A key feature of Heun’s Method is its ability to achieve higher accuracy (local error of second order) through a two-stage evaluation process, improving upon the Euler method. 2. In What Scenarios is it Applied? Due to its simplicity and improved accuracy, Heun...

Lista de publicaciones del Dr. Mint (en inglés)

   Mint Publishing ha publicado los siguientes libros. Todos ellos son fáciles de entender y están cuidadosamente explicados para que puedas comprenderlos desde cero. Las siguientes series ya están disponibles.   Serie Inteligencia Artificial   Serie Matemáticas   Serie Física   Serie Procesamiento de Imágenes   Serie Cálculo y Análisis Numérico   Serie Python   Serie R Las series están organizadas de tal manera que puedes aprender de la que más te interese, o puedes empezar con el primer volumen de la serie en orden. Al ir y venir entre las series, el contenido es altamente sinérgico entre sí. A continuación se enumeran los libros. (Para más información sobre cada libro, visite la página del libro correspondiente).   Serie Inteligencia Artificial   [1]. Entendiendo los perceptrones : Una base para el aprendizaje profundo  (próximamente) [2]. Understanding the Improved Perceptron (El...

Understanding Reciprocal Functions from Scratch

The reciprocal function is one of the fundamental functions in mathematics, and despite its simplicity, it’s a powerful tool with applications in many fields thanks to its unique characteristics. This article will provide a detailed explanation of the definition and properties of reciprocal functions, explore the contexts in which they are used, and outline the benefits of learning about them. 1. What is a Reciprocal Function? A reciprocal function returns the reciprocal of a given real number.  - Graph Shape The graph of a reciprocal function forms a hyperbola, with values increasing or decreasing rapidly as it approaches the origin. It takes the shape of a hyperbola spanning the first and third quadrants, and has asymptotes at x = 0 and y = 0. Behind this simple equation lies the concept of a multiplicative inverse, which forms the foundation of basic algebra. 2. Where are Reciprocal Functions Used? Due to their fundamental nature and simplicity, reciprocal functions are used in ...