SlideShare a Scribd company logo
1 of 31
globalaihub.com
Day 2
Regression Problem
globalaihub.com
What Will We Learn Today?
● We will learn what is Regression problem in Machine Learning
● We will learn about the kinds of models that can be developed to solve the regression problem.
● We will learn the concept of error and its metrics in our regression model
● We will learn to measure and improve performance in our regression model.
● We will develop a Regression model using the iris dataset
globalaihub.com
Fethi Tekyaygil
Github: TekyaygilFethi
Twitter: fethidev
LinkedIn: fethitekyaygil
globalaihub.com
Sources
Deep Learning Türkiye Hands-on Machine Learning
with Scikit-Learn, Keras &
TensorFlow
Aurelien Geron
globalaihub.com
What is Regression?
Regression determines the relationship between one
dependent variable and one or more independent variables.
If the value predicted by the model is a continuous value,
this type of problem is a Regression problem.
There are 3 different types of Regression according to the
definition of the problem.
globalaihub.com
Regression Types
1. Simple Linear Regression: Regression type used when there is only one independent
variable.
2. Multiple Linear Regression: It is a type of Regression used when there is more than
one independent variable.
3. Polynomial Regression: It is a type of Regression in which the relationship between
the independent variable x and the dependent variable y is modeled as an nth order
polynomial in x.
globalaihub.com
Basic Linear Regression
Simple Linear Regression uses an optimal straight line (also known as a regression line) to establish
a relationship between a dependent variable (Y) and an independent variable (X).
Regression tries to find the most optimal line equation that will try to fit all points.
globalaihub.com
Multiple Linear Regression
Multiple Linear Regression uses an optimal straight line (also known as a regression line) to
establish a relationship between the dependent variable (Y) and more than one independent
variable (X).
globalaihub.com
Polynomial Regression
Polynomial Regression is a form of regression
analysis in which the relationship between
one or more independent variable x and
dependent variable y is modeled as an nth
order polynomial in x.
● In cases where our simple and multiple
linear regression models fail to predict
(when our data is nonlinear), we can
better fit our model to our data with the
help of polynomial regression. For this,
we need to give the features we give to
the model in degrees (exponential).
globalaihub.com
Measuring the
Performance of the
Regression Model
globalaihub.com
Error Concept
In our regression model, the error is the
distance between the true value of the
data and its predicted value. Our goal is
to minimize this distance for each of our
data points.
Since negative errors and positive errors
cancel each other out, we use certain
statistical equations to calculate the
error instead of doing standard addition.
globalaihub.com
R-squared (R²)
R² is a statistical measure of how close the data are to the fitted regression line. That is, it is a
measure of fitness for linear regression models.
✯ A high R² value does not always mean the model is good. In case of overfitting, our R² score will be
high.
globalaihub.com
Mean Absolute Error (MAE)
The MAE is the mean of the absolute values of the differences between the predicted values and the
actual values.The MAE method has the advantage of not being overly affected by outliers in the
training data. A model trained with the MAE approach will give equal importance to 1 error of 5
units and 5 errors of 1 unit.
● The main problem with MAE is that it is not at least differentiable. This lack of differentiability
can produce convergence problems when training machine learning models.
globalaihub.com
Mean Squared Error (MSE)
MSE is the most commonly used regression error function. Because of the squaring process, large
errors (the difference between the actual value and the predicted value) have a greater impact on the
MSE than small errors. It's really useful when you want to see if outliers are overly affecting your
estimates.
● The MSE function is widely used because it is simple, continuous, and differentiable.
● An MSE-trained model will give the same importance to a single 5-unit error versus 25 1-unit
errors. The model will be biased to reduce the largest errors
globalaihub.com
Mean Squared Error (MSE)
● The mean square error function is widely used because it is simple, continuous, and
differentiable.
● An important MSE feature is its disproportionate sensitivity to large errors compared to small
errors. An MSE-trained model will give the same importance to a single 5-unit error versus 25
1-unit errors. In other words, even if it penalizes the predictions of many common conditions,
the model will be biased to reduce the largest errors.
globalaihub.com
Errors Encountered in
Model Training
Underfitting & Overfitting
globalaihub.com
Underfitting & Overfitting
Underfitting
It is a problem that arises when the Machine
Learning model fails to catch the trend of our
data. In other words, our model does not learn
enough from the data or does not extract
enough meaning from the data.
Overfitting
It is a problem that arises when the Machine
Learning model catches the trend of our data
more than it should. In other words, our
model memorizes the data we give it rather
than learning it and cannot make a successful
inference on data it has not seen before.
globalaihub.com
Underfitting & Overfitting
● An important theoretical consequence of Statistics and Machine Learning is that the generalization (ability
to make predictions using data it does not see) error of a model can be expressed as the sum of three very
different errors:
○ Bias
○ Variance
○ Irreducible Errors
● High bias means less variance, which is an example of underfit.
● High variance means less bias, which is an example of overfit.
● Irreducible errors are related to noise in the data and the only way to fix it is to clean the data
✯ An underfit model has low variance and
high bias values.
✯ An overfit model has high variance and
low bias.
globalaihub.com
Bias/Variance Tradeoff
Bias
Bias is the difference between the mean
estimate of our model and the correct value
we are trying to predict. The high-bias model
pays little attention to the training data and
oversimplifies the model. It always leads to
high error in training and test data. This can
be called underfit
Variance
Variance is the variability of the model
estimate for a given data point. If a model
with high complexity has high variance and
thus overfits the training data, it causes
errors in the predictions in the test set, which
can be called overfit.
✯ As the variance increases, the bias
decreases.
✯ As the bias increases, the variance
decreases.
globalaihub.com
What can be done?
Underfitting
1. The complexity of the model can be
increased by adding new feature values or
layers
2. Noise can be removed from data
3. The number of epochs can be increased
during training
4. Better feature values can be given
(Feature Engineering)
5. Values that limit the model can be reduced
(eg regularization parameter)
Overfitting
1. Training data can be increased
2. The complexity of the model can be
reduced
3. Early stopping can be done during
training
4. Regularization can be applied
globalaihub.com
Error Reduction Methods
globalaihub.com
Splitting of Data as Training-Test-Validation
1. Our data is sent to the model for training.
Our model learns from the data and
improves itself by going over the learned
data over and over again. (forward-
backward prop.)
2. After the training is completely finished,
the model measures itself with the data
used in the learning in order to score itself.
3. If the score is high, our model is successful.
4. When data is sent to the model that is not
among the dataset given for training, it can
be seen that the model does not actually
make as successful predictions as it claims.
globalaihub.com
Early Stopping
1. The way to streamline iterative learning
algorithms like Gradient Descent is to stop
training as soon as the validation error
reaches a minimum.
2. A simple and effective editing technique
called the "No Free Lunch Theorem" by
Geoffrey Hinton, winner of the 2018 Turing
Award with Yoshua Bengio and Yann
LeCun
3. A minimum error value is determined and
n more iterations occur when the validation
set error falls below or equals this limit. If
our performance does not improve, our
error value returns to the best point and
training stops.(callback)
globalaihub.com
Gradient Descent
The general idea of Gradient Descent is to iteratively adjust the weights to minimize a output of cost
function. It does this until the error value converges to the local minimum.
Gradient Descent does exactly this: It measures the local gradient of the error function relative to the
parameter vector θ and goes in the decreasing gradient direction. When the gradient is zero, the
optimum weight value is found.
globalaihub.com
● Not all cost functions are convex, which
causes the algorithm to converge to the
local minimum.
● Cost functions such as MSE and MAE are
in the form of convex. This way we can be
sure that there is only one global minimum.
✯ When using Gradient Descent, you should make
sure that all features have a similar scale. (e.g. using
Scikit-Learn's StandardScaler class) or it will take
much longer to converge
Gradient Descent
globalaihub.com
Regularization
Regularization is the process of constraining a model to simplify and prevent overfitting. This
improves the model's performance on invisible data. In this method, the weights in the cost function
are updated by adding another term known as the regularization term, that is, they are penalized..
✯ The amount of regularization to be applied during learning can be controlled by a hyper parameter
called regularization term (regularization parameter).
globalaihub.com
Regularization
L1 Lasso
● In L1 regularization the error function is
penalized by the absolute value of the
weights
● The derivative of L1 is k (a constant whose
value is independent of weight)
● It is a force that subtracts the derivative of
L1 from the weight some constant each
time.
L2 Ridge
● In L2 regularization, the error function
is penalized by the square of the
weights.
● The derivative of L2 is 2 * weight
● It is a force that removes x% of the
weight each time the derivative of L2
globalaihub.com
Regularization
L1 Lasso
● L1 can solve the multicollinearity
problem by limiting the coefficient norm
and fixing some coefficient values to 0.
Multicollinearity is when two
independent variables are highly
correlated.
● If you have more features than the
number of observations (N), L1 holds at
most N coefficients.
● L1 is sometimes used as a feature
selection method. If you have some kind
of hard limit on the number of features
you can use, you can try using L1
regularization to get any number of non-
zero features.
L2 Ridge
● L2 can solve the multicollinearity
problem by limiting the coefficient norm
and keeping all variables
● The "classic" method of solving the
regression problem where you have
more features than the number of
observations (N)
● L2 can estimate a coefficient for each
feature even if there are more features
than observations
globalaihub.com
Hyper Parameter Definitions
Learning Rate (𝞪): It determines the rate at which the error converges to the optimum point during
operation of the Gradient Descent.
Theta (ϴ): It is the weight of our feature value.
Regularization Term (𝛌): It is the penalty term or regulation parameter that determines how much
weight will be penalized. If too much is given, our weights will be close to 0. This prevents our model
from being overfit, but at the same time, the model it creates will not be very efficient.
globalaihub.com
Cross Validation
Cross-validation is a statistical resampling
method used to improve the performance of a
machine learning model. This is done to
prevent the model from focusing too much on
the initial dataset.
By dividing our data set into k parts, training
is carried out with each part and the
performance of our model is measured by
taking the average of these errors.
globalaihub.com
Colab Time!

More Related Content

Similar to Regresión

AWS Certified Machine Learning Specialty
AWS Certified Machine Learning Specialty AWS Certified Machine Learning Specialty
AWS Certified Machine Learning Specialty Adnan Rashid
 
Dimd_m_004 DL.pdf
Dimd_m_004 DL.pdfDimd_m_004 DL.pdf
Dimd_m_004 DL.pdfjuan631
 
Sample_Subjective_Questions_Answers (1).pdf
Sample_Subjective_Questions_Answers (1).pdfSample_Subjective_Questions_Answers (1).pdf
Sample_Subjective_Questions_Answers (1).pdfAaryanArora10
 
Machine learning in credit risk modeling : a James white paper
Machine learning in credit risk modeling : a James white paperMachine learning in credit risk modeling : a James white paper
Machine learning in credit risk modeling : a James white paperJames by CrowdProcess
 
Machine learning with scikitlearn
Machine learning with scikitlearnMachine learning with scikitlearn
Machine learning with scikitlearnPratap Dangeti
 
MACHINE LEARNING YEAR DL SECOND PART.pptx
MACHINE LEARNING YEAR DL SECOND PART.pptxMACHINE LEARNING YEAR DL SECOND PART.pptx
MACHINE LEARNING YEAR DL SECOND PART.pptxNAGARAJANS68
 
How to understand and implement regression analysis
How to understand and implement regression analysisHow to understand and implement regression analysis
How to understand and implement regression analysisClaireWhittaker5
 
Machine Learning in the Financial Industry
Machine Learning in the Financial IndustryMachine Learning in the Financial Industry
Machine Learning in the Financial IndustrySubrat Panda, PhD
 
General Concepts of Machine Learning
General Concepts of Machine LearningGeneral Concepts of Machine Learning
General Concepts of Machine LearningKush Kulshrestha
 
_Whitepaper-Ultimate-Guide-to-ML-Model-Performance_Fiddler.pdf
_Whitepaper-Ultimate-Guide-to-ML-Model-Performance_Fiddler.pdf_Whitepaper-Ultimate-Guide-to-ML-Model-Performance_Fiddler.pdf
_Whitepaper-Ultimate-Guide-to-ML-Model-Performance_Fiddler.pdfXIAOZEJIN1
 
Sarcia idoese08
Sarcia idoese08Sarcia idoese08
Sarcia idoese08asarcia
 
Essentials of machine learning algorithms
Essentials of machine learning algorithmsEssentials of machine learning algorithms
Essentials of machine learning algorithmsArunangsu Sahu
 
logisticregression-190726150723.pdf
logisticregression-190726150723.pdflogisticregression-190726150723.pdf
logisticregression-190726150723.pdfSuaibDanish
 
Logistic regression : Use Case | Background | Advantages | Disadvantages
Logistic regression : Use Case | Background | Advantages | DisadvantagesLogistic regression : Use Case | Background | Advantages | Disadvantages
Logistic regression : Use Case | Background | Advantages | DisadvantagesRajat Sharma
 
Lecture 3.1_ Logistic Regression.pptx
Lecture 3.1_ Logistic Regression.pptxLecture 3.1_ Logistic Regression.pptx
Lecture 3.1_ Logistic Regression.pptxajondaree
 

Similar to Regresión (20)

AWS Certified Machine Learning Specialty
AWS Certified Machine Learning Specialty AWS Certified Machine Learning Specialty
AWS Certified Machine Learning Specialty
 
Dimd_m_004 DL.pdf
Dimd_m_004 DL.pdfDimd_m_004 DL.pdf
Dimd_m_004 DL.pdf
 
Qt unit i
Qt unit   iQt unit   i
Qt unit i
 
Sample_Subjective_Questions_Answers (1).pdf
Sample_Subjective_Questions_Answers (1).pdfSample_Subjective_Questions_Answers (1).pdf
Sample_Subjective_Questions_Answers (1).pdf
 
Machine learning in credit risk modeling : a James white paper
Machine learning in credit risk modeling : a James white paperMachine learning in credit risk modeling : a James white paper
Machine learning in credit risk modeling : a James white paper
 
4.1.pptx
4.1.pptx4.1.pptx
4.1.pptx
 
Machine learning with scikitlearn
Machine learning with scikitlearnMachine learning with scikitlearn
Machine learning with scikitlearn
 
MACHINE LEARNING YEAR DL SECOND PART.pptx
MACHINE LEARNING YEAR DL SECOND PART.pptxMACHINE LEARNING YEAR DL SECOND PART.pptx
MACHINE LEARNING YEAR DL SECOND PART.pptx
 
MACHINE LEARNING.pptx
MACHINE LEARNING.pptxMACHINE LEARNING.pptx
MACHINE LEARNING.pptx
 
How to understand and implement regression analysis
How to understand and implement regression analysisHow to understand and implement regression analysis
How to understand and implement regression analysis
 
Machine Learning in the Financial Industry
Machine Learning in the Financial IndustryMachine Learning in the Financial Industry
Machine Learning in the Financial Industry
 
ML-Unit-4.pdf
ML-Unit-4.pdfML-Unit-4.pdf
ML-Unit-4.pdf
 
General Concepts of Machine Learning
General Concepts of Machine LearningGeneral Concepts of Machine Learning
General Concepts of Machine Learning
 
_Whitepaper-Ultimate-Guide-to-ML-Model-Performance_Fiddler.pdf
_Whitepaper-Ultimate-Guide-to-ML-Model-Performance_Fiddler.pdf_Whitepaper-Ultimate-Guide-to-ML-Model-Performance_Fiddler.pdf
_Whitepaper-Ultimate-Guide-to-ML-Model-Performance_Fiddler.pdf
 
Sarcia idoese08
Sarcia idoese08Sarcia idoese08
Sarcia idoese08
 
Essentials of machine learning algorithms
Essentials of machine learning algorithmsEssentials of machine learning algorithms
Essentials of machine learning algorithms
 
logisticregression-190726150723.pdf
logisticregression-190726150723.pdflogisticregression-190726150723.pdf
logisticregression-190726150723.pdf
 
Logistic regression : Use Case | Background | Advantages | Disadvantages
Logistic regression : Use Case | Background | Advantages | DisadvantagesLogistic regression : Use Case | Background | Advantages | Disadvantages
Logistic regression : Use Case | Background | Advantages | Disadvantages
 
Lecture 3.1_ Logistic Regression.pptx
Lecture 3.1_ Logistic Regression.pptxLecture 3.1_ Logistic Regression.pptx
Lecture 3.1_ Logistic Regression.pptx
 
Machine Learning by Rj
Machine Learning by RjMachine Learning by Rj
Machine Learning by Rj
 

More from Ramiro Aduviri Velasco

Instituto de Inteligencia Artificial Aplicada Cursos 2024
Instituto de Inteligencia Artificial Aplicada Cursos 2024Instituto de Inteligencia Artificial Aplicada Cursos 2024
Instituto de Inteligencia Artificial Aplicada Cursos 2024Ramiro Aduviri Velasco
 
Overview of Artificial Neural Networks and its Applications
Overview of Artificial Neural Networks and its ApplicationsOverview of Artificial Neural Networks and its Applications
Overview of Artificial Neural Networks and its ApplicationsRamiro Aduviri Velasco
 
LA DOCENCIA UNIVERSITARIA ENFOQUE AULA INVERTIDA Medina.pdf
LA DOCENCIA UNIVERSITARIA ENFOQUE AULA INVERTIDA Medina.pdfLA DOCENCIA UNIVERSITARIA ENFOQUE AULA INVERTIDA Medina.pdf
LA DOCENCIA UNIVERSITARIA ENFOQUE AULA INVERTIDA Medina.pdfRamiro Aduviri Velasco
 
Mentoría en Inteligencia Artificial con asistencia de ChatGPT y Python
Mentoría en Inteligencia Artificial con asistencia de ChatGPT y PythonMentoría en Inteligencia Artificial con asistencia de ChatGPT y Python
Mentoría en Inteligencia Artificial con asistencia de ChatGPT y PythonRamiro Aduviri Velasco
 
Mentoría en Matemáticas con ChatGPT y Python.docx
Mentoría en Matemáticas con ChatGPT y Python.docxMentoría en Matemáticas con ChatGPT y Python.docx
Mentoría en Matemáticas con ChatGPT y Python.docxRamiro Aduviri Velasco
 
Alfabetizaciones Pendientes: ChatGPT e Inteligencia Artificial (IA) en Educación
Alfabetizaciones Pendientes: ChatGPT e Inteligencia Artificial (IA) en EducaciónAlfabetizaciones Pendientes: ChatGPT e Inteligencia Artificial (IA) en Educación
Alfabetizaciones Pendientes: ChatGPT e Inteligencia Artificial (IA) en EducaciónRamiro Aduviri Velasco
 
Contenidos Interactivos Personalizados con ChatGPT.docx
Contenidos Interactivos Personalizados con ChatGPT.docxContenidos Interactivos Personalizados con ChatGPT.docx
Contenidos Interactivos Personalizados con ChatGPT.docxRamiro Aduviri Velasco
 
Introducción a la Inteligencia Artificial Generativa.docx
Introducción a la Inteligencia Artificial Generativa.docxIntroducción a la Inteligencia Artificial Generativa.docx
Introducción a la Inteligencia Artificial Generativa.docxRamiro Aduviri Velasco
 
analitica datos con chatGPT y Python.docx
analitica datos con chatGPT y Python.docxanalitica datos con chatGPT y Python.docx
analitica datos con chatGPT y Python.docxRamiro Aduviri Velasco
 
aprendizaje automatico con chatGPT y Python.docx
aprendizaje automatico con chatGPT y Python.docxaprendizaje automatico con chatGPT y Python.docx
aprendizaje automatico con chatGPT y Python.docxRamiro Aduviri Velasco
 

More from Ramiro Aduviri Velasco (20)

Instituto de Inteligencia Artificial Aplicada Cursos 2024
Instituto de Inteligencia Artificial Aplicada Cursos 2024Instituto de Inteligencia Artificial Aplicada Cursos 2024
Instituto de Inteligencia Artificial Aplicada Cursos 2024
 
Overview of Artificial Neural Networks and its Applications
Overview of Artificial Neural Networks and its ApplicationsOverview of Artificial Neural Networks and its Applications
Overview of Artificial Neural Networks and its Applications
 
Machine Learning
Machine LearningMachine Learning
Machine Learning
 
Ingenieria y Arte Prompts.pdf
Ingenieria y Arte Prompts.pdfIngenieria y Arte Prompts.pdf
Ingenieria y Arte Prompts.pdf
 
Diplomado IA Innovación Profesional
Diplomado IA Innovación ProfesionalDiplomado IA Innovación Profesional
Diplomado IA Innovación Profesional
 
LA DOCENCIA UNIVERSITARIA ENFOQUE AULA INVERTIDA Medina.pdf
LA DOCENCIA UNIVERSITARIA ENFOQUE AULA INVERTIDA Medina.pdfLA DOCENCIA UNIVERSITARIA ENFOQUE AULA INVERTIDA Medina.pdf
LA DOCENCIA UNIVERSITARIA ENFOQUE AULA INVERTIDA Medina.pdf
 
ChatGPT e IA en Educación
ChatGPT e IA en EducaciónChatGPT e IA en Educación
ChatGPT e IA en Educación
 
ChatGPT e Inteligencia Artificial
ChatGPT e Inteligencia ArtificialChatGPT e Inteligencia Artificial
ChatGPT e Inteligencia Artificial
 
Mentoría en Robótica Educativa
Mentoría en Robótica EducativaMentoría en Robótica Educativa
Mentoría en Robótica Educativa
 
Mentoría en Inteligencia Artificial con asistencia de ChatGPT y Python
Mentoría en Inteligencia Artificial con asistencia de ChatGPT y PythonMentoría en Inteligencia Artificial con asistencia de ChatGPT y Python
Mentoría en Inteligencia Artificial con asistencia de ChatGPT y Python
 
Mentoría en Matemáticas con ChatGPT y Python.docx
Mentoría en Matemáticas con ChatGPT y Python.docxMentoría en Matemáticas con ChatGPT y Python.docx
Mentoría en Matemáticas con ChatGPT y Python.docx
 
Guía rápida chat GPT
Guía rápida chat GPTGuía rápida chat GPT
Guía rápida chat GPT
 
Practicando ChatGPT
Practicando ChatGPT Practicando ChatGPT
Practicando ChatGPT
 
Alfabetizaciones Pendientes: ChatGPT e Inteligencia Artificial (IA) en Educación
Alfabetizaciones Pendientes: ChatGPT e Inteligencia Artificial (IA) en EducaciónAlfabetizaciones Pendientes: ChatGPT e Inteligencia Artificial (IA) en Educación
Alfabetizaciones Pendientes: ChatGPT e Inteligencia Artificial (IA) en Educación
 
Programación en Python.docx
Programación en Python.docxProgramación en Python.docx
Programación en Python.docx
 
Contenidos Interactivos Personalizados con ChatGPT.docx
Contenidos Interactivos Personalizados con ChatGPT.docxContenidos Interactivos Personalizados con ChatGPT.docx
Contenidos Interactivos Personalizados con ChatGPT.docx
 
ChatGPT y prompts educativos.docx
ChatGPT y prompts educativos.docxChatGPT y prompts educativos.docx
ChatGPT y prompts educativos.docx
 
Introducción a la Inteligencia Artificial Generativa.docx
Introducción a la Inteligencia Artificial Generativa.docxIntroducción a la Inteligencia Artificial Generativa.docx
Introducción a la Inteligencia Artificial Generativa.docx
 
analitica datos con chatGPT y Python.docx
analitica datos con chatGPT y Python.docxanalitica datos con chatGPT y Python.docx
analitica datos con chatGPT y Python.docx
 
aprendizaje automatico con chatGPT y Python.docx
aprendizaje automatico con chatGPT y Python.docxaprendizaje automatico con chatGPT y Python.docx
aprendizaje automatico con chatGPT y Python.docx
 

Recently uploaded

Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 

Recently uploaded (20)

Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 

Regresión

  • 2. globalaihub.com What Will We Learn Today? ● We will learn what is Regression problem in Machine Learning ● We will learn about the kinds of models that can be developed to solve the regression problem. ● We will learn the concept of error and its metrics in our regression model ● We will learn to measure and improve performance in our regression model. ● We will develop a Regression model using the iris dataset
  • 4. globalaihub.com Sources Deep Learning Türkiye Hands-on Machine Learning with Scikit-Learn, Keras & TensorFlow Aurelien Geron
  • 5. globalaihub.com What is Regression? Regression determines the relationship between one dependent variable and one or more independent variables. If the value predicted by the model is a continuous value, this type of problem is a Regression problem. There are 3 different types of Regression according to the definition of the problem.
  • 6. globalaihub.com Regression Types 1. Simple Linear Regression: Regression type used when there is only one independent variable. 2. Multiple Linear Regression: It is a type of Regression used when there is more than one independent variable. 3. Polynomial Regression: It is a type of Regression in which the relationship between the independent variable x and the dependent variable y is modeled as an nth order polynomial in x.
  • 7. globalaihub.com Basic Linear Regression Simple Linear Regression uses an optimal straight line (also known as a regression line) to establish a relationship between a dependent variable (Y) and an independent variable (X). Regression tries to find the most optimal line equation that will try to fit all points.
  • 8. globalaihub.com Multiple Linear Regression Multiple Linear Regression uses an optimal straight line (also known as a regression line) to establish a relationship between the dependent variable (Y) and more than one independent variable (X).
  • 9. globalaihub.com Polynomial Regression Polynomial Regression is a form of regression analysis in which the relationship between one or more independent variable x and dependent variable y is modeled as an nth order polynomial in x. ● In cases where our simple and multiple linear regression models fail to predict (when our data is nonlinear), we can better fit our model to our data with the help of polynomial regression. For this, we need to give the features we give to the model in degrees (exponential).
  • 11. globalaihub.com Error Concept In our regression model, the error is the distance between the true value of the data and its predicted value. Our goal is to minimize this distance for each of our data points. Since negative errors and positive errors cancel each other out, we use certain statistical equations to calculate the error instead of doing standard addition.
  • 12. globalaihub.com R-squared (R²) R² is a statistical measure of how close the data are to the fitted regression line. That is, it is a measure of fitness for linear regression models. ✯ A high R² value does not always mean the model is good. In case of overfitting, our R² score will be high.
  • 13. globalaihub.com Mean Absolute Error (MAE) The MAE is the mean of the absolute values of the differences between the predicted values and the actual values.The MAE method has the advantage of not being overly affected by outliers in the training data. A model trained with the MAE approach will give equal importance to 1 error of 5 units and 5 errors of 1 unit. ● The main problem with MAE is that it is not at least differentiable. This lack of differentiability can produce convergence problems when training machine learning models.
  • 14. globalaihub.com Mean Squared Error (MSE) MSE is the most commonly used regression error function. Because of the squaring process, large errors (the difference between the actual value and the predicted value) have a greater impact on the MSE than small errors. It's really useful when you want to see if outliers are overly affecting your estimates. ● The MSE function is widely used because it is simple, continuous, and differentiable. ● An MSE-trained model will give the same importance to a single 5-unit error versus 25 1-unit errors. The model will be biased to reduce the largest errors
  • 15. globalaihub.com Mean Squared Error (MSE) ● The mean square error function is widely used because it is simple, continuous, and differentiable. ● An important MSE feature is its disproportionate sensitivity to large errors compared to small errors. An MSE-trained model will give the same importance to a single 5-unit error versus 25 1-unit errors. In other words, even if it penalizes the predictions of many common conditions, the model will be biased to reduce the largest errors.
  • 16. globalaihub.com Errors Encountered in Model Training Underfitting & Overfitting
  • 17. globalaihub.com Underfitting & Overfitting Underfitting It is a problem that arises when the Machine Learning model fails to catch the trend of our data. In other words, our model does not learn enough from the data or does not extract enough meaning from the data. Overfitting It is a problem that arises when the Machine Learning model catches the trend of our data more than it should. In other words, our model memorizes the data we give it rather than learning it and cannot make a successful inference on data it has not seen before.
  • 18. globalaihub.com Underfitting & Overfitting ● An important theoretical consequence of Statistics and Machine Learning is that the generalization (ability to make predictions using data it does not see) error of a model can be expressed as the sum of three very different errors: ○ Bias ○ Variance ○ Irreducible Errors ● High bias means less variance, which is an example of underfit. ● High variance means less bias, which is an example of overfit. ● Irreducible errors are related to noise in the data and the only way to fix it is to clean the data ✯ An underfit model has low variance and high bias values. ✯ An overfit model has high variance and low bias.
  • 19. globalaihub.com Bias/Variance Tradeoff Bias Bias is the difference between the mean estimate of our model and the correct value we are trying to predict. The high-bias model pays little attention to the training data and oversimplifies the model. It always leads to high error in training and test data. This can be called underfit Variance Variance is the variability of the model estimate for a given data point. If a model with high complexity has high variance and thus overfits the training data, it causes errors in the predictions in the test set, which can be called overfit. ✯ As the variance increases, the bias decreases. ✯ As the bias increases, the variance decreases.
  • 20. globalaihub.com What can be done? Underfitting 1. The complexity of the model can be increased by adding new feature values or layers 2. Noise can be removed from data 3. The number of epochs can be increased during training 4. Better feature values can be given (Feature Engineering) 5. Values that limit the model can be reduced (eg regularization parameter) Overfitting 1. Training data can be increased 2. The complexity of the model can be reduced 3. Early stopping can be done during training 4. Regularization can be applied
  • 22. globalaihub.com Splitting of Data as Training-Test-Validation 1. Our data is sent to the model for training. Our model learns from the data and improves itself by going over the learned data over and over again. (forward- backward prop.) 2. After the training is completely finished, the model measures itself with the data used in the learning in order to score itself. 3. If the score is high, our model is successful. 4. When data is sent to the model that is not among the dataset given for training, it can be seen that the model does not actually make as successful predictions as it claims.
  • 23. globalaihub.com Early Stopping 1. The way to streamline iterative learning algorithms like Gradient Descent is to stop training as soon as the validation error reaches a minimum. 2. A simple and effective editing technique called the "No Free Lunch Theorem" by Geoffrey Hinton, winner of the 2018 Turing Award with Yoshua Bengio and Yann LeCun 3. A minimum error value is determined and n more iterations occur when the validation set error falls below or equals this limit. If our performance does not improve, our error value returns to the best point and training stops.(callback)
  • 24. globalaihub.com Gradient Descent The general idea of Gradient Descent is to iteratively adjust the weights to minimize a output of cost function. It does this until the error value converges to the local minimum. Gradient Descent does exactly this: It measures the local gradient of the error function relative to the parameter vector θ and goes in the decreasing gradient direction. When the gradient is zero, the optimum weight value is found.
  • 25. globalaihub.com ● Not all cost functions are convex, which causes the algorithm to converge to the local minimum. ● Cost functions such as MSE and MAE are in the form of convex. This way we can be sure that there is only one global minimum. ✯ When using Gradient Descent, you should make sure that all features have a similar scale. (e.g. using Scikit-Learn's StandardScaler class) or it will take much longer to converge Gradient Descent
  • 26. globalaihub.com Regularization Regularization is the process of constraining a model to simplify and prevent overfitting. This improves the model's performance on invisible data. In this method, the weights in the cost function are updated by adding another term known as the regularization term, that is, they are penalized.. ✯ The amount of regularization to be applied during learning can be controlled by a hyper parameter called regularization term (regularization parameter).
  • 27. globalaihub.com Regularization L1 Lasso ● In L1 regularization the error function is penalized by the absolute value of the weights ● The derivative of L1 is k (a constant whose value is independent of weight) ● It is a force that subtracts the derivative of L1 from the weight some constant each time. L2 Ridge ● In L2 regularization, the error function is penalized by the square of the weights. ● The derivative of L2 is 2 * weight ● It is a force that removes x% of the weight each time the derivative of L2
  • 28. globalaihub.com Regularization L1 Lasso ● L1 can solve the multicollinearity problem by limiting the coefficient norm and fixing some coefficient values to 0. Multicollinearity is when two independent variables are highly correlated. ● If you have more features than the number of observations (N), L1 holds at most N coefficients. ● L1 is sometimes used as a feature selection method. If you have some kind of hard limit on the number of features you can use, you can try using L1 regularization to get any number of non- zero features. L2 Ridge ● L2 can solve the multicollinearity problem by limiting the coefficient norm and keeping all variables ● The "classic" method of solving the regression problem where you have more features than the number of observations (N) ● L2 can estimate a coefficient for each feature even if there are more features than observations
  • 29. globalaihub.com Hyper Parameter Definitions Learning Rate (𝞪): It determines the rate at which the error converges to the optimum point during operation of the Gradient Descent. Theta (ϴ): It is the weight of our feature value. Regularization Term (𝛌): It is the penalty term or regulation parameter that determines how much weight will be penalized. If too much is given, our weights will be close to 0. This prevents our model from being overfit, but at the same time, the model it creates will not be very efficient.
  • 30. globalaihub.com Cross Validation Cross-validation is a statistical resampling method used to improve the performance of a machine learning model. This is done to prevent the model from focusing too much on the initial dataset. By dividing our data set into k parts, training is carried out with each part and the performance of our model is measured by taking the average of these errors.