0% found this document useful (0 votes)
2 views36 pages

01_lecture1

This document outlines an introductory machine learning course led by Dr. Farhad Pourkamali Anaraki, covering fundamental concepts, tools, and practical applications. It includes prerequisites in calculus, linear algebra, and statistics, as well as an overview of machine learning types, challenges, and tools like Anaconda and Google Colab. The course structure consists of two main parts: fundamentals using Scikit-Learn and advanced techniques with neural networks and deep learning frameworks.

Uploaded by

intandidik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views36 pages

01_lecture1

This document outlines an introductory machine learning course led by Dr. Farhad Pourkamali Anaraki, covering fundamental concepts, tools, and practical applications. It includes prerequisites in calculus, linear algebra, and statistics, as well as an overview of machine learning types, challenges, and tools like Anaconda and Google Colab. The course structure consists of two main parts: fundamentals using Scikit-Learn and advanced techniques with neural networks and deep learning frameworks.

Uploaded by

intandidik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Machine Learning

Lecture 1: Introduction

Instructor: Dr. Farhad Pourkamali Anaraki


Machine Learning, Pourkamali

What do you learn from this course?


• Concepts, tools, and intuition you need to implement programs capable of
learning from data

• From simple techniques such as linear regression to some of deep learning


techniques

• A hands-on approach with just a little bit of theory to use production-ready


Python frameworks

Public perception of ML Reality

2
Machine Learning, Pourkamali

Course prerequisites
• We need some level of calculus and linear algebra
• Vector, matrix, inner product, matrix-matrix multiplication
• Derivatives of polynomials and exponential functions
• Chain rule for nding the derivative of a composite function

• Basics of probability and statistics


• Probability distributions (normal distribution, Bernoulli distribution, etc.)
• Mean, standard deviation, …

3
fi
Machine Learning, Pourkamali

Anaconda
• https://www.anaconda.com/

4
Machine Learning, Pourkamali

Google Colab
• Google Colaboratory, or “Colab” for short, allows you to write and execute
Python in your browser

• Zero con guration required


• Free access to GPUs and other computing resources
• Use terminal commands on Google Colab

• https://drive.google.com (for the rst time, select “Connect more apps”)

5
fi
fi
Machine Learning, Pourkamali

Visual Studi Code


• Better alternative for “real” machine learning projects
• https://code.visualstudio.com/

6
Machine Learning, Pourkamali

Course structure
• Part 1: Fundamentals of Machine Learning (Scikit-Learn)
• Review of Python’s main scienti c libraries: NumPy, pandas, and Matplotlib
• Steps in a typical machine learning project
• Learning by tting a model to data and optimizing a cost function
• Challenges of using machine learning systems
• Part 2: Neural Networks and Deep Learning (TensorFlow 2.0, Keras, and PyTorch)
• What neural nets are and what they are good for
• Building and training feedforward neural nets (basics and implementation)
• Convolutional nets for deep computer vision and recurrent neural nets (mainly
fundamental concepts)

7
fi
fi
Machine Learning, Pourkamali

A little bit history

• Alan Turing gave quite possibly the earliest public lecture on this topic in 1947:
“What we want is a machine that can learn from experience”

8
Machine Learning, Pourkamali

Why should we use machine learning?


• Let’s say we want to design a spam ltering system
• One approach is to use traditional programming techniques
• Look for words or phrases such as: credit card, free, bank information, “C U”
• Write a detection algorithm for each of the patterns
• Test your program and improve it

9
fi
Machine Learning, Pourkamali

Why use machine learning?


• A spam lter based on machine learning automatically learns which words and
phrases are good predictors

• Possible bene ts: simpler, easier to maintain, and more accurate


• The examples that the system uses are called the training set
• We should also think of a performance measure

10
fi
fi
Machine Learning, Pourkamali

Beyond prediction
• Machine learning can help human learn and discover patterns from large
amounts of data that are not immediately apparent

• This is usually called data mining

11
Machine Learning, Pourkamali

A few applications of machine learning

• Autonomous navigation systems


• Analyzing images of items on a product line
• Analyzing medical images
• Automatically agging offensive comments on social media platforms
• Forecasting revenue
• Creating a recommendation engine
• Speech recognition (like Siri and Alexa)
• And many more!

12
fl
Machine Learning, Pourkamali

Types of machine learning


• ML systems can be classi ed according to the amount and type of supervision
1. Supervised learning: training set includes the desired solutions or labels

• Classi cation: labels are classes (e.g., spam or ham)

• Regression: labels are numeric values (e.g., price of car)

13
fi
fi
Machine Learning, Pourkamali

Types of machine learning


2. Unsupervised learning: ML system tries to learn without a teacher

• For example, based on the shopping history, detect groups of similar visitors

• Another example is novelty detection: nd new instances that look different

14
fi
Machine Learning, Pourkamali

Types of machine learning


3. Semisupervised learning: plenty of unlabeled instances and few labeled

• Why? Labeling data is costly and time-consuming


• Application: Google Photo
• Tools: Amazon SageMaker Ground Truth

4. Reinforcement learning: select and perform actions, and get rewards or


penalties in return

• Find the best strategy known as policy to get the most reward

15
Machine Learning, Pourkamali

Another categorization
1. Batch learning or of ine learning: the system must be trained using all the
available data

• Drawbacks:

• Take a lot of time, computing resources, and storage space

• Not suitable for rapidly changing data

2. Incremental learning: train the system incrementally by feeding data instances


sequentially

16
fl
Machine Learning, Pourkamali

Another categorization
1. Instance-based learning: the system uses a similarity measure to compare new
cases to the learned examples

6. Model-based learning: build a model of the learned examples and then use that
model to make predictions

17
Machine Learning, Pourkamali

Model-based learning
• Does money make people happier?

• Let us model life satisfaction as a linear function of GDP


• A simple linear model

• Examples

18
Machine Learning, Pourkamali

Training a linear model using Scikit-Learn


• A few lines of code

19
Machine Learning, Pourkamali

Summary of steps

• Study the data (data preparation)


• Select a model or learning algorithm
• Train on the available data and assess performance
• Apply the model to make predictions on new cases

20
Machine Learning, Pourkamali

Challenges of machine learning


• Insuf cient quantity of training data
• Non-representative and poor-quality training data

• Irrelevant features: coming up with a good set of features

21
fi
Machine Learning, Pourkamali

Challenges of machine learning


• Over tting the training data
• When the model is too complex relative to the amount and noisiness of data

• How to alleviate this problem?


• Simplify the model
• Gather more training data
• Reduce noise and outliers (i.e., data preparation)

22
fi
Machine Learning, Pourkamali

Example of reducing overfitting


• Use a subset of data and regularization
• Regularization: balance between tting the data perfectly and keeping the
model simple enough

• Amount of regularization is controlled by a hyperparameter (must be set prior


to learning and remains constant during training)

• Tuning hyperparameters is extremely important

23
fi
Machine Learning, Pourkamali

Challenges of machine learning


• Under tting the training data
• When the model is too simple

• How to solve this problem?


• Select a more powerful model
• Reduce constraints on the model such as regularization

24
fi
Machine Learning, Pourkamali

Testing and validation


• The only way to know how a model will generalize to new cases is to actually try
it out on new cases

• Split the available data into two sets: training set and testing set
• The error on the test set is called the generalization error or out-of-sample
error

• If training error is low and generalization error is high, then over tting occurs
• How to choose suitable models and their hyperparameters?

25
fi
Basics of Python
https://github.com/farhad-pourkamali/machine-learning
Review of linear algebra and NumPy
https://github.com/farhad-pourkamali/machine-learning
Part 1: https://youtu.be/xSO0qOyvevc
Part 2: https://youtu.be/SeBRHg9ZrSs
Machine Learning, Pourkamali

Introduction
• NumPy offers mathematical functions, random number generators, linear algebra
routines, and more

• ‘’de-facto” standards of array computing


• 1D (vector) and 2D arrays (matrix)

a1
a11 … a1m
a2
a= ∈ ℝn A= ⋮ ⋮ ∈ ℝn×m
⋮ an1 anm
an

28
Machine Learning, Pourkamali

Creating arrays

• Notice the difference between 1D and 2D arrays

29
Machine Learning, Pourkamali

Creating arrays

30
Machine Learning, Pourkamali

Creating random numbers


• Two popular choices are uniform distribution between 0 and 1, and a univariate
normal distribution

31
Machine Learning, Pourkamali

Array data
• NumPy’s ndarrays are ef cient because their elements must have the same type
• Data types: https://numpy.org/doc/stable/user/basics.types.html

32
fi
Machine Learning, Pourkamali

Array data
• NumPy’s ndarrays are ef cient because their elements must have the same type

33
fi
Machine Learning, Pourkamali

Reshaping an array

34
Machine Learning, Pourkamali

Reshaping an array
• The reshape function returns a new array object pointing at the same data.

35
Machine Learning, Pourkamali

Conditional operators

36

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy