SlideShare a Scribd company logo
1 of 23
Download to read offline
What is machine learning?
▶ Task Identify handwritten digits
▶ We can see this as a function in the following way:
▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers
▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282
= 784 entries
▶ The output is a vector with 10 entries
▶ We thus have a function R784
→ R10
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is machine learning?
▶ Task Identify handwritten digits
▶ We can see this as a function in the following way:
▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers
▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282
= 784 entries
▶ The output is a vector with 10 entries
▶ We thus have a function R784
→ R10
Input example
Output example
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is machine learning?
▶ Task Identify handwritten digits
▶ We can see this as a function in the following way:
▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers
▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282
= 784 entries
▶ The output is a vector with 10 entries
▶ We thus have a function R784
→ R10
Task – rephrased
We have a function R784
→ R10
How can we describe this function?
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is machine learning?
▶ Task Identify handwritten digits
▶ We can see this as a function in the following way:
▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers
▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282
= 784 entries
▶ The output is a vector with 10 entries
▶ We thus have a function R784
→ R10
Task – rephrased
We have a function R784
→ R10
How can we describe this function?
Machine/deep learning (today’s topic)
tries to answer questions of this type
letting a computer detect patterns in data
Crucial In ML the computer performs tasks without explicit instructions
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is machine learning?
,
▶ Idea Approximate the unknown function R784
→ R10
▶ Neural network = a piecewise linear approximation (matrices + PL maps)
▶ The matrices = a bunch of numbers (weights) and offsets (biases)
▶ The PL maps = usually ReLU
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is machine learning?
Forward
→
Loss
→
Backward
→ → → → ...
▶ Machine learning mantra
▶ Forward = calculate an approximation (start with random inputs)
▶ Loss = compare to real data
▶ Backward = adjust the approximation
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is a neural network (nn)?
▶ NN = a directed graph as above
▶ The task of a nn is to approximate an unknown function
▶ It consist of neurons = entries of vectors, and weights = entries of matrices
The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
What is a neural network (nn)?
▶ NN = a directed graph as above
▶ The task of a nn is to approximate an unknown function
▶ It consist of neurons = entries of vectors, and weights = entries of matrices
Example
Here we have two matrices, a 3-by-1 and a 2-by-3 matrix


w
x
y

 and

a11 a12 a13
a21 a22 a23

plus two bias terms as in y = matrix · x + bias
The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
What is a neural network (nn)?
▶ NN = a directed graph as above
▶ The task of a nn is to approximate an unknown function
▶ It consist of neurons = entries of vectors, and weights = entries of matrices
Example
Here we have four matrices (plus four biases), whose composition gives a map
R3
→ R4
→ R3
→ R3
→ R2
The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
What is a neural network (nn)?
▶ NN = a directed graph as above
▶ The task of a nn is to approximate an unknown function
▶ It consist of neurons = entries of vectors, and weights = entries of matrices
Actually...
we need nonlinear maps as well, say ReLU applied componentwise
Here we have four matrices, whose composition gives a map
R3 ReLU◦matrix
−
−
−
−
−
−
−
→ R4 ReLU◦matrix
−
−
−
−
−
−
−
→ R3 ReLU◦matrix
−
−
−
−
−
−
−
→ R3 ReLU◦matrix
−
−
−
−
−
−
−
→ R2
But ignore that for now
ReLU doesn’t learn anything, its just brings in nonlinearity
The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
What is a neural network (nn)?


a1
11 b1
1
a1
12 b1
2
a1
13 b1
3

 ,

a2
11 a2
12 a2
13 b2
1
a2
21 a2
22 a2
23 b2
2

▶ The ak
ij and bk
i are the parameters of our nn
▶ k = number of the layer
▶ Deep = many layers = better approximation
The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
What is a neural network (nn)?


a1
11 b1
1
a1
12 b1
2
a1
13 b1
3

 ,

a2
11 a2
12 a2
13 b2
1
a2
21 a2
22 a2
23 b2
2

▶ The ak
ij and bk
i are the parameters of our nn
▶ k = number of the layer
▶ Deep = many layers = better approximation
The point
Many layers → many parameters
These are good for approximating real world problems
Examples
ResNet-152 with 152. layers (used in transformer models such as ChatGPT)
VGG-19 with 19 layers (used in image classification)
GoogLeNet with 22 layers (used in face detection)
The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
What is a neural network (nn)?


a1
11 b1
1
a1
12 b1
2
a1
13 b1
3

 ,

a2
11 a2
12 a2
13 b2
1
a2
21 a2
22 a2
23 b2
2

▶ The ak
ij and bk
i are the parameters of our nn
▶ k = number of the layer
▶ Deep = many layers = better approximation
Side fact
Gaming has improved AI!?
A GPU can do e.g. matrix multiplications faster
than a CPU and lots of nn run on GPUs
The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
How learning works
▶ Supervised learning Create a dataset with answers, e.g. pictures of
handwritten digits plus their label
▶ There are other forms of learning e.g. unsupervised, which I skip
▶ Split the data into ≈80% training and ≈20% testing data
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
How learning works
▶ Supervised learning Create a dataset with answers, e.g. pictures of
handwritten digits plus their label
▶ There are other forms of learning e.g. unsupervised, which I skip
▶ Split the data into ≈80% training and ≈20% testing data
Idea to keep in mind
How to train students?
There are lectures, exercises etc., the training data
There is a final exam, the testing data
Upon performance, we let them out into the wild
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
How learning works
▶ Forward Run the nn = function on the training data
▶ Loss Calculate the difference “results - answers” (⇒ loss function)
▶ Backward Change the parameters trying to minimize the loss function
▶ Repeat
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
How learning works
▶ Forward Run the nn = function on the training data
▶ Loss Calculate the difference “results - answers” (⇒ loss function)
▶ Backward Change the parameters trying to minimize the loss function
▶ Repeat
Forward
Boils down to a bunch of matrix multiplications
followed by the nonlinear activation e.g. ReLU
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
How learning works
▶ Forward Run the nn = function on the training data
▶ Loss Calculate the difference “results - answers” (⇒ loss function)
▶ Backward Change the parameters trying to minimize the loss function
▶ Repeat
Loss
The difference between real values and predictions
Task Minimize loss function
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
How learning works
▶ Forward Run the nn = function on the training data
▶ Loss Calculate the difference “results - answers” (⇒ loss function)
▶ Backward Change the parameters trying to minimize the loss function
▶ Repeat
Backward
This is running gradient descent on the loss function
Slogan Adjust parameters following the steepest descent
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
How learning works
▶ Forward Run the nn = function on the training data
▶ Loss Calculate the difference “results - answers” (⇒ loss function)
▶ Backward Change the parameters trying to minimize the loss function
▶ Repeat
And what makes it even better:
You can try it yourself
My favorite tool is PyTorch but there are also other methods
Let us see how!
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
What is machine learning?
▶ Task Identify handwritten digits
▶ We can see this as a function in the following way:
▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers
▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282
= 784 entries
▶ The output is a vector with 10 entries
▶ We thus have a function R784
→ R10
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is machine learning?
▶ Task Identify handwritten digits
▶ We can see this as a function in the following way:
▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers
▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282
= 784 entries
▶ The output is a vector with 10 entries
▶ We thus have a function R784
→ R10
Input example
Output example
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is machine learning?
,
▶ Idea Approximate the unknown function R784
→ R10
▶ Neural network = a piecewise linear approximation (matrices + PL maps)
▶ The matrices = a bunch of numbers (weights) and offsets (biases)
▶ The PL maps = usually ReLU
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is machine learning?
Forward
→
Loss
→
Backward
→ → → → ...
▶ Machine learning mantra
▶ Forward = calculate an approximation (start with random inputs)
▶ Loss = compare to real data
▶ Backward = adjust the approximation
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is a neural network (nn)?
▶ NN = a directed graph as above
▶ The task of a nn is to approximate an unknown function
▶ It consist of neurons = entries of vectors, and weights = entries of matrices
Example
Here we have two matrices, a 3-by-1 and a 2-by-3 matrix


w
x
y

 and

a11 a12 a13
a21 a22 a23

plus two bias terms as in y = matrix · x + bias
The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
How learning works
▶ Supervised learning Create a dataset with answers, e.g. pictures of
handwritten digits plus their label
▶ There are other forms of learning e.g. unsupervised, which I skip
▶ Split the data into ≈80% training and ≈20% testing data
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
How learning works
▶ Forward Run the nn = function on the training data
▶ Loss Calculate the difference “results - answers” (⇒ loss function)
▶ Backward Change the parameters trying to minimize the loss function
▶ Repeat
Forward
Boils down to a bunch of matrix multiplications
followed by the nonlinear activation e.g. ReLU
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
How learning works
▶ Forward Run the nn = function on the training data
▶ Loss Calculate the difference “results - answers” (⇒ loss function)
▶ Backward Change the parameters trying to minimize the loss function
▶ Repeat
Loss
The difference between real values and predictions
Task Minimize loss function
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
How learning works
▶ Forward Run the nn = function on the training data
▶ Loss Calculate the difference “results - answers” (⇒ loss function)
▶ Backward Change the parameters trying to minimize the loss function
▶ Repeat
Backward
This is running gradient descent on the loss function
Slogan Adjust parameters following the steepest descent
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
There is still much to do...
The mathematics of AI Or: Learning = forward, loss, backward April 2024 5 / 5
What is machine learning?
▶ Task Identify handwritten digits
▶ We can see this as a function in the following way:
▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers
▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282
= 784 entries
▶ The output is a vector with 10 entries
▶ We thus have a function R784
→ R10
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is machine learning?
▶ Task Identify handwritten digits
▶ We can see this as a function in the following way:
▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers
▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282
= 784 entries
▶ The output is a vector with 10 entries
▶ We thus have a function R784
→ R10
Input example
Output example
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is machine learning?
,
▶ Idea Approximate the unknown function R784
→ R10
▶ Neural network = a piecewise linear approximation (matrices + PL maps)
▶ The matrices = a bunch of numbers (weights) and offsets (biases)
▶ The PL maps = usually ReLU
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is machine learning?
Forward
→
Loss
→
Backward
→ → → → ...
▶ Machine learning mantra
▶ Forward = calculate an approximation (start with random inputs)
▶ Loss = compare to real data
▶ Backward = adjust the approximation
The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
What is a neural network (nn)?
▶ NN = a directed graph as above
▶ The task of a nn is to approximate an unknown function
▶ It consist of neurons = entries of vectors, and weights = entries of matrices
Example
Here we have two matrices, a 3-by-1 and a 2-by-3 matrix


w
x
y

 and

a11 a12 a13
a21 a22 a23

plus two bias terms as in y = matrix · x + bias
The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
How learning works
▶ Supervised learning Create a dataset with answers, e.g. pictures of
handwritten digits plus their label
▶ There are other forms of learning e.g. unsupervised, which I skip
▶ Split the data into ≈80% training and ≈20% testing data
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
How learning works
▶ Forward Run the nn = function on the training data
▶ Loss Calculate the difference “results - answers” (⇒ loss function)
▶ Backward Change the parameters trying to minimize the loss function
▶ Repeat
Forward
Boils down to a bunch of matrix multiplications
followed by the nonlinear activation e.g. ReLU
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
How learning works
▶ Forward Run the nn = function on the training data
▶ Loss Calculate the difference “results - answers” (⇒ loss function)
▶ Backward Change the parameters trying to minimize the loss function
▶ Repeat
Loss
The difference between real values and predictions
Task Minimize loss function
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
How learning works
▶ Forward Run the nn = function on the training data
▶ Loss Calculate the difference “results - answers” (⇒ loss function)
▶ Backward Change the parameters trying to minimize the loss function
▶ Repeat
Backward
This is running gradient descent on the loss function
Slogan Adjust parameters following the steepest descent
The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
Thanks for your attention!
The mathematics of AI Or: Learning = forward, loss, backward April 2024 5 / 5

More Related Content

Similar to The mathematics of AI (machine learning mathematically)

Authentic learning activity
Authentic learning activityAuthentic learning activity
Authentic learning activityobakeng mokotedi
 
040 the whole module
040 the whole module040 the whole module
040 the whole moduleedwin caniete
 
WEKA:Algorithms The Basic Methods
WEKA:Algorithms The Basic MethodsWEKA:Algorithms The Basic Methods
WEKA:Algorithms The Basic Methodsweka Content
 
WEKA: Algorithms The Basic Methods
WEKA: Algorithms The Basic MethodsWEKA: Algorithms The Basic Methods
WEKA: Algorithms The Basic MethodsDataminingTools Inc
 
Introduction to Machine Learning for Java Developers
Introduction to Machine Learning for Java DevelopersIntroduction to Machine Learning for Java Developers
Introduction to Machine Learning for Java DevelopersZoran Sevarac, PhD
 
Technology Lesson Plan Assignment: Quadratice Functions
Technology Lesson Plan Assignment: Quadratice FunctionsTechnology Lesson Plan Assignment: Quadratice Functions
Technology Lesson Plan Assignment: Quadratice Functionsdart11746
 
1.1 Real Number Properties
1.1 Real Number Properties1.1 Real Number Properties
1.1 Real Number Propertiessmiller5
 
DeepLearningLecture.pptx
DeepLearningLecture.pptxDeepLearningLecture.pptx
DeepLearningLecture.pptxssuserf07225
 
Introduction to Machine Learning with Spark
Introduction to Machine Learning with SparkIntroduction to Machine Learning with Spark
Introduction to Machine Learning with Sparkdatamantra
 
Neural Learning to Rank
Neural Learning to RankNeural Learning to Rank
Neural Learning to RankBhaskar Mitra
 
G6 m4-a-lesson 4-t
G6 m4-a-lesson 4-tG6 m4-a-lesson 4-t
G6 m4-a-lesson 4-tmlabuski
 
Deep learning from scratch
Deep learning from scratch Deep learning from scratch
Deep learning from scratch Eran Shlomo
 
Business Mathematics
Business Mathematics Business Mathematics
Business Mathematics Seenleocario
 
Arithmetic instructions
Arithmetic instructionsArithmetic instructions
Arithmetic instructionsLearn By Watch
 
machine_learning.pptx
machine_learning.pptxmachine_learning.pptx
machine_learning.pptxPanchami V U
 
Bahasa Inggris dalam Pembelajaran Matematika
Bahasa Inggris dalam Pembelajaran MatematikaBahasa Inggris dalam Pembelajaran Matematika
Bahasa Inggris dalam Pembelajaran MatematikaNASuprawoto Sunardjo
 

Similar to The mathematics of AI (machine learning mathematically) (20)

Authentic learning activity
Authentic learning activityAuthentic learning activity
Authentic learning activity
 
040 the whole module
040 the whole module040 the whole module
040 the whole module
 
Guided notes
Guided notesGuided notes
Guided notes
 
Unit5: Learning
Unit5: LearningUnit5: Learning
Unit5: Learning
 
WEKA:Algorithms The Basic Methods
WEKA:Algorithms The Basic MethodsWEKA:Algorithms The Basic Methods
WEKA:Algorithms The Basic Methods
 
WEKA: Algorithms The Basic Methods
WEKA: Algorithms The Basic MethodsWEKA: Algorithms The Basic Methods
WEKA: Algorithms The Basic Methods
 
Introduction to Machine Learning for Java Developers
Introduction to Machine Learning for Java DevelopersIntroduction to Machine Learning for Java Developers
Introduction to Machine Learning for Java Developers
 
Technology Lesson Plan Assignment: Quadratice Functions
Technology Lesson Plan Assignment: Quadratice FunctionsTechnology Lesson Plan Assignment: Quadratice Functions
Technology Lesson Plan Assignment: Quadratice Functions
 
1.1 Real Number Properties
1.1 Real Number Properties1.1 Real Number Properties
1.1 Real Number Properties
 
DeepLearningLecture.pptx
DeepLearningLecture.pptxDeepLearningLecture.pptx
DeepLearningLecture.pptx
 
Introduction to Machine Learning with Spark
Introduction to Machine Learning with SparkIntroduction to Machine Learning with Spark
Introduction to Machine Learning with Spark
 
Lesson 1 matrix
Lesson 1 matrixLesson 1 matrix
Lesson 1 matrix
 
Neural Learning to Rank
Neural Learning to RankNeural Learning to Rank
Neural Learning to Rank
 
G6 m4-a-lesson 4-t
G6 m4-a-lesson 4-tG6 m4-a-lesson 4-t
G6 m4-a-lesson 4-t
 
Deep learning from scratch
Deep learning from scratch Deep learning from scratch
Deep learning from scratch
 
Integers
IntegersIntegers
Integers
 
Business Mathematics
Business Mathematics Business Mathematics
Business Mathematics
 
Arithmetic instructions
Arithmetic instructionsArithmetic instructions
Arithmetic instructions
 
machine_learning.pptx
machine_learning.pptxmachine_learning.pptx
machine_learning.pptx
 
Bahasa Inggris dalam Pembelajaran Matematika
Bahasa Inggris dalam Pembelajaran MatematikaBahasa Inggris dalam Pembelajaran Matematika
Bahasa Inggris dalam Pembelajaran Matematika
 

More from Daniel Tubbenhauer

Representation theory of monoidal categories
Representation theory of monoidal categoriesRepresentation theory of monoidal categories
Representation theory of monoidal categoriesDaniel Tubbenhauer
 
Representation theory of algebras
Representation theory of algebrasRepresentation theory of algebras
Representation theory of algebrasDaniel Tubbenhauer
 
Representation theory of monoids
Representation theory of monoidsRepresentation theory of monoids
Representation theory of monoidsDaniel Tubbenhauer
 
Representation theory of monoids and monoidal categories
Representation theory of monoids and monoidal categoriesRepresentation theory of monoids and monoidal categories
Representation theory of monoids and monoidal categoriesDaniel Tubbenhauer
 
Why (categorical) representation theory?
Why (categorical) representation theory?Why (categorical) representation theory?
Why (categorical) representation theory?Daniel Tubbenhauer
 
Some history of quantum groups
Some history of quantum groupsSome history of quantum groups
Some history of quantum groupsDaniel Tubbenhauer
 

More from Daniel Tubbenhauer (11)

Three colors suffice
Three colors sufficeThree colors suffice
Three colors suffice
 
Knots and algebra
Knots and algebraKnots and algebra
Knots and algebra
 
Representation theory of monoidal categories
Representation theory of monoidal categoriesRepresentation theory of monoidal categories
Representation theory of monoidal categories
 
Representation theory of algebras
Representation theory of algebrasRepresentation theory of algebras
Representation theory of algebras
 
Representation theory of monoids
Representation theory of monoidsRepresentation theory of monoids
Representation theory of monoids
 
Representation theory of monoids and monoidal categories
Representation theory of monoids and monoidal categoriesRepresentation theory of monoids and monoidal categories
Representation theory of monoids and monoidal categories
 
Why category theory?
Why category theory?Why category theory?
Why category theory?
 
Why (categorical) representation theory?
Why (categorical) representation theory?Why (categorical) representation theory?
Why (categorical) representation theory?
 
Subfactors in a nutshell
Subfactors in a nutshellSubfactors in a nutshell
Subfactors in a nutshell
 
Temperley-Lieb times four
Temperley-Lieb times fourTemperley-Lieb times four
Temperley-Lieb times four
 
Some history of quantum groups
Some history of quantum groupsSome history of quantum groups
Some history of quantum groups
 

Recently uploaded

GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)Areesha Ahmad
 
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRLKochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRLkantirani197
 
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPirithiRaju
 
Dubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai Young
Dubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai YoungDubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai Young
Dubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai Youngkajalvid75
 
Thyroid Physiology_Dr.E. Muralinath_ Associate Professor
Thyroid Physiology_Dr.E. Muralinath_ Associate ProfessorThyroid Physiology_Dr.E. Muralinath_ Associate Professor
Thyroid Physiology_Dr.E. Muralinath_ Associate Professormuralinath2
 
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryFAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryAlex Henderson
 
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verifiedConnaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 
Bacterial Identification and Classifications
Bacterial Identification and ClassificationsBacterial Identification and Classifications
Bacterial Identification and ClassificationsAreesha Ahmad
 
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑Damini Dixit
 
Conjugation, transduction and transformation
Conjugation, transduction and transformationConjugation, transduction and transformation
Conjugation, transduction and transformationAreesha Ahmad
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learninglevieagacer
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)Areesha Ahmad
 
chemical bonding Essentials of Physical Chemistry2.pdf
chemical bonding Essentials of Physical Chemistry2.pdfchemical bonding Essentials of Physical Chemistry2.pdf
chemical bonding Essentials of Physical Chemistry2.pdfTukamushabaBismark
 
GBSN - Microbiology (Unit 3)
GBSN - Microbiology (Unit 3)GBSN - Microbiology (Unit 3)
GBSN - Microbiology (Unit 3)Areesha Ahmad
 
pumpkin fruit fly, water melon fruit fly, cucumber fruit fly
pumpkin fruit fly, water melon fruit fly, cucumber fruit flypumpkin fruit fly, water melon fruit fly, cucumber fruit fly
pumpkin fruit fly, water melon fruit fly, cucumber fruit flyPRADYUMMAURYA1
 
Forensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfForensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfrohankumarsinghrore1
 
development of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virusdevelopment of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virusNazaninKarimi6
 
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...Silpa
 

Recently uploaded (20)

GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)GBSN - Biochemistry (Unit 1)
GBSN - Biochemistry (Unit 1)
 
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRLKochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
Kochi ❤CALL GIRL 84099*07087 ❤CALL GIRLS IN Kochi ESCORT SERVICE❤CALL GIRL
 
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdfPests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
Pests of cotton_Borer_Pests_Binomics_Dr.UPR.pdf
 
Dubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai Young
Dubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai YoungDubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai Young
Dubai Call Girls Beauty Face Teen O525547819 Call Girls Dubai Young
 
Thyroid Physiology_Dr.E. Muralinath_ Associate Professor
Thyroid Physiology_Dr.E. Muralinath_ Associate ProfessorThyroid Physiology_Dr.E. Muralinath_ Associate Professor
Thyroid Physiology_Dr.E. Muralinath_ Associate Professor
 
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and SpectrometryFAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
FAIRSpectra - Enabling the FAIRification of Spectroscopy and Spectrometry
 
Site Acceptance Test .
Site Acceptance Test                    .Site Acceptance Test                    .
Site Acceptance Test .
 
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verifiedConnaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
 
Bacterial Identification and Classifications
Bacterial Identification and ClassificationsBacterial Identification and Classifications
Bacterial Identification and Classifications
 
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
High Profile 🔝 8250077686 📞 Call Girls Service in GTB Nagar🍑
 
Conjugation, transduction and transformation
Conjugation, transduction and transformationConjugation, transduction and transformation
Conjugation, transduction and transformation
 
Clean In Place(CIP).pptx .
Clean In Place(CIP).pptx                 .Clean In Place(CIP).pptx                 .
Clean In Place(CIP).pptx .
 
Module for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learningModule for Grade 9 for Asynchronous/Distance learning
Module for Grade 9 for Asynchronous/Distance learning
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)
 
chemical bonding Essentials of Physical Chemistry2.pdf
chemical bonding Essentials of Physical Chemistry2.pdfchemical bonding Essentials of Physical Chemistry2.pdf
chemical bonding Essentials of Physical Chemistry2.pdf
 
GBSN - Microbiology (Unit 3)
GBSN - Microbiology (Unit 3)GBSN - Microbiology (Unit 3)
GBSN - Microbiology (Unit 3)
 
pumpkin fruit fly, water melon fruit fly, cucumber fruit fly
pumpkin fruit fly, water melon fruit fly, cucumber fruit flypumpkin fruit fly, water melon fruit fly, cucumber fruit fly
pumpkin fruit fly, water melon fruit fly, cucumber fruit fly
 
Forensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdfForensic Biology & Its biological significance.pdf
Forensic Biology & Its biological significance.pdf
 
development of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virusdevelopment of diagnostic enzyme assay to detect leuser virus
development of diagnostic enzyme assay to detect leuser virus
 
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
Locating and isolating a gene, FISH, GISH, Chromosome walking and jumping, te...
 

The mathematics of AI (machine learning mathematically)

  • 1.
  • 2. What is machine learning? ▶ Task Identify handwritten digits ▶ We can see this as a function in the following way: ▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers ▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282 = 784 entries ▶ The output is a vector with 10 entries ▶ We thus have a function R784 → R10 The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
  • 3. What is machine learning? ▶ Task Identify handwritten digits ▶ We can see this as a function in the following way: ▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers ▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282 = 784 entries ▶ The output is a vector with 10 entries ▶ We thus have a function R784 → R10 Input example Output example The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
  • 4. What is machine learning? ▶ Task Identify handwritten digits ▶ We can see this as a function in the following way: ▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers ▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282 = 784 entries ▶ The output is a vector with 10 entries ▶ We thus have a function R784 → R10 Task – rephrased We have a function R784 → R10 How can we describe this function? The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
  • 5. What is machine learning? ▶ Task Identify handwritten digits ▶ We can see this as a function in the following way: ▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers ▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282 = 784 entries ▶ The output is a vector with 10 entries ▶ We thus have a function R784 → R10 Task – rephrased We have a function R784 → R10 How can we describe this function? Machine/deep learning (today’s topic) tries to answer questions of this type letting a computer detect patterns in data Crucial In ML the computer performs tasks without explicit instructions The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
  • 6. What is machine learning? , ▶ Idea Approximate the unknown function R784 → R10 ▶ Neural network = a piecewise linear approximation (matrices + PL maps) ▶ The matrices = a bunch of numbers (weights) and offsets (biases) ▶ The PL maps = usually ReLU The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
  • 7. What is machine learning? Forward → Loss → Backward → → → → ... ▶ Machine learning mantra ▶ Forward = calculate an approximation (start with random inputs) ▶ Loss = compare to real data ▶ Backward = adjust the approximation The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5
  • 8. What is a neural network (nn)? ▶ NN = a directed graph as above ▶ The task of a nn is to approximate an unknown function ▶ It consist of neurons = entries of vectors, and weights = entries of matrices The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
  • 9. What is a neural network (nn)? ▶ NN = a directed graph as above ▶ The task of a nn is to approximate an unknown function ▶ It consist of neurons = entries of vectors, and weights = entries of matrices Example Here we have two matrices, a 3-by-1 and a 2-by-3 matrix   w x y   and a11 a12 a13 a21 a22 a23 plus two bias terms as in y = matrix · x + bias The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
  • 10. What is a neural network (nn)? ▶ NN = a directed graph as above ▶ The task of a nn is to approximate an unknown function ▶ It consist of neurons = entries of vectors, and weights = entries of matrices Example Here we have four matrices (plus four biases), whose composition gives a map R3 → R4 → R3 → R3 → R2 The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
  • 11. What is a neural network (nn)? ▶ NN = a directed graph as above ▶ The task of a nn is to approximate an unknown function ▶ It consist of neurons = entries of vectors, and weights = entries of matrices Actually... we need nonlinear maps as well, say ReLU applied componentwise Here we have four matrices, whose composition gives a map R3 ReLU◦matrix − − − − − − − → R4 ReLU◦matrix − − − − − − − → R3 ReLU◦matrix − − − − − − − → R3 ReLU◦matrix − − − − − − − → R2 But ignore that for now ReLU doesn’t learn anything, its just brings in nonlinearity The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
  • 12. What is a neural network (nn)?   a1 11 b1 1 a1 12 b1 2 a1 13 b1 3   , a2 11 a2 12 a2 13 b2 1 a2 21 a2 22 a2 23 b2 2 ▶ The ak ij and bk i are the parameters of our nn ▶ k = number of the layer ▶ Deep = many layers = better approximation The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
  • 13. What is a neural network (nn)?   a1 11 b1 1 a1 12 b1 2 a1 13 b1 3   , a2 11 a2 12 a2 13 b2 1 a2 21 a2 22 a2 23 b2 2 ▶ The ak ij and bk i are the parameters of our nn ▶ k = number of the layer ▶ Deep = many layers = better approximation The point Many layers → many parameters These are good for approximating real world problems Examples ResNet-152 with 152. layers (used in transformer models such as ChatGPT) VGG-19 with 19 layers (used in image classification) GoogLeNet with 22 layers (used in face detection) The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
  • 14. What is a neural network (nn)?   a1 11 b1 1 a1 12 b1 2 a1 13 b1 3   , a2 11 a2 12 a2 13 b2 1 a2 21 a2 22 a2 23 b2 2 ▶ The ak ij and bk i are the parameters of our nn ▶ k = number of the layer ▶ Deep = many layers = better approximation Side fact Gaming has improved AI!? A GPU can do e.g. matrix multiplications faster than a CPU and lots of nn run on GPUs The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5
  • 15. How learning works ▶ Supervised learning Create a dataset with answers, e.g. pictures of handwritten digits plus their label ▶ There are other forms of learning e.g. unsupervised, which I skip ▶ Split the data into ≈80% training and ≈20% testing data The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
  • 16. How learning works ▶ Supervised learning Create a dataset with answers, e.g. pictures of handwritten digits plus their label ▶ There are other forms of learning e.g. unsupervised, which I skip ▶ Split the data into ≈80% training and ≈20% testing data Idea to keep in mind How to train students? There are lectures, exercises etc., the training data There is a final exam, the testing data Upon performance, we let them out into the wild The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
  • 17. How learning works ▶ Forward Run the nn = function on the training data ▶ Loss Calculate the difference “results - answers” (⇒ loss function) ▶ Backward Change the parameters trying to minimize the loss function ▶ Repeat The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
  • 18. How learning works ▶ Forward Run the nn = function on the training data ▶ Loss Calculate the difference “results - answers” (⇒ loss function) ▶ Backward Change the parameters trying to minimize the loss function ▶ Repeat Forward Boils down to a bunch of matrix multiplications followed by the nonlinear activation e.g. ReLU The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
  • 19. How learning works ▶ Forward Run the nn = function on the training data ▶ Loss Calculate the difference “results - answers” (⇒ loss function) ▶ Backward Change the parameters trying to minimize the loss function ▶ Repeat Loss The difference between real values and predictions Task Minimize loss function The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
  • 20. How learning works ▶ Forward Run the nn = function on the training data ▶ Loss Calculate the difference “results - answers” (⇒ loss function) ▶ Backward Change the parameters trying to minimize the loss function ▶ Repeat Backward This is running gradient descent on the loss function Slogan Adjust parameters following the steepest descent The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
  • 21. How learning works ▶ Forward Run the nn = function on the training data ▶ Loss Calculate the difference “results - answers” (⇒ loss function) ▶ Backward Change the parameters trying to minimize the loss function ▶ Repeat And what makes it even better: You can try it yourself My favorite tool is PyTorch but there are also other methods Let us see how! The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5
  • 22. What is machine learning? ▶ Task Identify handwritten digits ▶ We can see this as a function in the following way: ▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers ▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282 = 784 entries ▶ The output is a vector with 10 entries ▶ We thus have a function R784 → R10 The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5 What is machine learning? ▶ Task Identify handwritten digits ▶ We can see this as a function in the following way: ▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers ▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282 = 784 entries ▶ The output is a vector with 10 entries ▶ We thus have a function R784 → R10 Input example Output example The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5 What is machine learning? , ▶ Idea Approximate the unknown function R784 → R10 ▶ Neural network = a piecewise linear approximation (matrices + PL maps) ▶ The matrices = a bunch of numbers (weights) and offsets (biases) ▶ The PL maps = usually ReLU The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5 What is machine learning? Forward → Loss → Backward → → → → ... ▶ Machine learning mantra ▶ Forward = calculate an approximation (start with random inputs) ▶ Loss = compare to real data ▶ Backward = adjust the approximation The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5 What is a neural network (nn)? ▶ NN = a directed graph as above ▶ The task of a nn is to approximate an unknown function ▶ It consist of neurons = entries of vectors, and weights = entries of matrices Example Here we have two matrices, a 3-by-1 and a 2-by-3 matrix   w x y   and a11 a12 a13 a21 a22 a23 plus two bias terms as in y = matrix · x + bias The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5 How learning works ▶ Supervised learning Create a dataset with answers, e.g. pictures of handwritten digits plus their label ▶ There are other forms of learning e.g. unsupervised, which I skip ▶ Split the data into ≈80% training and ≈20% testing data The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5 How learning works ▶ Forward Run the nn = function on the training data ▶ Loss Calculate the difference “results - answers” (⇒ loss function) ▶ Backward Change the parameters trying to minimize the loss function ▶ Repeat Forward Boils down to a bunch of matrix multiplications followed by the nonlinear activation e.g. ReLU The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5 How learning works ▶ Forward Run the nn = function on the training data ▶ Loss Calculate the difference “results - answers” (⇒ loss function) ▶ Backward Change the parameters trying to minimize the loss function ▶ Repeat Loss The difference between real values and predictions Task Minimize loss function The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5 How learning works ▶ Forward Run the nn = function on the training data ▶ Loss Calculate the difference “results - answers” (⇒ loss function) ▶ Backward Change the parameters trying to minimize the loss function ▶ Repeat Backward This is running gradient descent on the loss function Slogan Adjust parameters following the steepest descent The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5 There is still much to do... The mathematics of AI Or: Learning = forward, loss, backward April 2024 5 / 5
  • 23. What is machine learning? ▶ Task Identify handwritten digits ▶ We can see this as a function in the following way: ▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers ▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282 = 784 entries ▶ The output is a vector with 10 entries ▶ We thus have a function R784 → R10 The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5 What is machine learning? ▶ Task Identify handwritten digits ▶ We can see this as a function in the following way: ▶ Convert the pictures into grayscale values, e.g. 28 × 28 grid of numbers ▶ Flatten the result into a vector, e.g. 28 × 28 7→ a vector with 282 = 784 entries ▶ The output is a vector with 10 entries ▶ We thus have a function R784 → R10 Input example Output example The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5 What is machine learning? , ▶ Idea Approximate the unknown function R784 → R10 ▶ Neural network = a piecewise linear approximation (matrices + PL maps) ▶ The matrices = a bunch of numbers (weights) and offsets (biases) ▶ The PL maps = usually ReLU The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5 What is machine learning? Forward → Loss → Backward → → → → ... ▶ Machine learning mantra ▶ Forward = calculate an approximation (start with random inputs) ▶ Loss = compare to real data ▶ Backward = adjust the approximation The mathematics of AI Or: Learning = forward, loss, backward April 2024 2 / 5 What is a neural network (nn)? ▶ NN = a directed graph as above ▶ The task of a nn is to approximate an unknown function ▶ It consist of neurons = entries of vectors, and weights = entries of matrices Example Here we have two matrices, a 3-by-1 and a 2-by-3 matrix   w x y   and a11 a12 a13 a21 a22 a23 plus two bias terms as in y = matrix · x + bias The mathematics of AI Or: Learning = forward, loss, backward April 2024 π / 5 How learning works ▶ Supervised learning Create a dataset with answers, e.g. pictures of handwritten digits plus their label ▶ There are other forms of learning e.g. unsupervised, which I skip ▶ Split the data into ≈80% training and ≈20% testing data The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5 How learning works ▶ Forward Run the nn = function on the training data ▶ Loss Calculate the difference “results - answers” (⇒ loss function) ▶ Backward Change the parameters trying to minimize the loss function ▶ Repeat Forward Boils down to a bunch of matrix multiplications followed by the nonlinear activation e.g. ReLU The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5 How learning works ▶ Forward Run the nn = function on the training data ▶ Loss Calculate the difference “results - answers” (⇒ loss function) ▶ Backward Change the parameters trying to minimize the loss function ▶ Repeat Loss The difference between real values and predictions Task Minimize loss function The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5 How learning works ▶ Forward Run the nn = function on the training data ▶ Loss Calculate the difference “results - answers” (⇒ loss function) ▶ Backward Change the parameters trying to minimize the loss function ▶ Repeat Backward This is running gradient descent on the loss function Slogan Adjust parameters following the steepest descent The mathematics of AI Or: Learning = forward, loss, backward April 2024 4 / 5 Thanks for your attention! The mathematics of AI Or: Learning = forward, loss, backward April 2024 5 / 5