1 of 14

1

By Mostafa Mohammadi

Training Models

Chapter 4

2 of 14

2

Contents

  • Introduction
  • Types of Learning
  • What is Regression
  • Linear Regression
  • Normal Equation
  • Gradient Descent
  • Choose the right model
  • Set the best hyperparameters
  • Perform error analysis more efficiently

3 of 14

3

Types of Learning

Supervised Learning

Involves training a model on labeled data, where the input-output pairs are known. The model learns to predict the output from the input data.

Unsupervised Learning

Uses unlabeled data, allowing the model to identify patterns and relationships within the data without predefined labels.

Semi-supervised Learning

Combines a small amount of labeled data with a large amount of unlabeled data during training.

4 of 14

4

Supervised Learning

Where the objective is to predict a discrete class label for given input features. The model learns to categorize the input data into predefined classes or groups.

Classification

The goal is to predict a continuous output variable based on one or more input features. The model learns the relationship between the inputs and the continuous output.

Regression

5 of 14

5

Regression

Calculating the behavior of Y variable based on X variables

Prediction based on data for future samples

Estimating the relative importance of each independent variable in predicting the dependent variable

01

02

03

6 of 14

6

Why Linear Regression?

  1. Easy implementation
  2. Interpretability
  3. Scalability

What is Linear Regression?

  • Find the best line that fit the data
  • makes a prediction by simply computing a weighted sum of the input features, plus a constant called the intercept term

7 of 14

7

What is Linear Regression?

Simple Linear Regression

Multiple Linear Regression

8 of 14

8

Linear Regression Assumption

9 of 14

9

Linear Regression

So how it learns? 🤔🤔

Learning here means finding the best parameters which fits a line with least error.

10 of 14

10

Normal Equation

11 of 14

11

Gradient descent

Gradient descent is a generic optimization algorithm capable of finding optimal solutions to a wide range of problems. The general idea of gradient descent is to tweak

parameters iteratively in order to minimize a cost function.

12 of 14

12

Learning Rate

13 of 14

13

How GD works in Linear Regression

14 of 14

14

Thanks for attention

t.me/Mostafa_mhammadi

in/mostafamhammadi/