SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie The mathematics of AI (machine learning mathematically)

040 the whole module
040 the whole module040 the whole module
040 the whole module
edwin caniete
 
Technology Lesson Plan Assignment: Quadratice Functions
Technology Lesson Plan Assignment: Quadratice FunctionsTechnology Lesson Plan Assignment: Quadratice Functions
Technology Lesson Plan Assignment: Quadratice Functions
dart11746
 
G6 m4-a-lesson 4-t
G6 m4-a-lesson 4-tG6 m4-a-lesson 4-t
G6 m4-a-lesson 4-t
mlabuski
 
Bahasa Inggris dalam Pembelajaran Matematika
Bahasa Inggris dalam Pembelajaran MatematikaBahasa Inggris dalam Pembelajaran Matematika
Bahasa Inggris dalam Pembelajaran Matematika
NASuprawoto Sunardjo
 

Ähnlich wie 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
 

Mehr von Daniel Tubbenhauer

Mehr von 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
 

Kürzlich hochgeladen

CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
anilsa9823
 
Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disks
Sérgio Sacani
 
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Sérgio Sacani
 
DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSS
LeenakshiTyagi
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
RohitNehra6
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
PirithiRaju
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Sérgio Sacani
 

Kürzlich hochgeladen (20)

Physiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptxPhysiochemical properties of nanomaterials and its nanotoxicity.pptx
Physiochemical properties of nanomaterials and its nanotoxicity.pptx
 
Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )Recombination DNA Technology (Nucleic Acid Hybridization )
Recombination DNA Technology (Nucleic Acid Hybridization )
 
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
❤Jammu Kashmir Call Girls 8617697112 Personal Whatsapp Number 💦✅.
 
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service  🪡
CALL ON ➥8923113531 🔝Call Girls Kesar Bagh Lucknow best Night Fun service 🪡
 
Formation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disksFormation of low mass protostars and their circumstellar disks
Formation of low mass protostars and their circumstellar disks
 
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
Discovery of an Accretion Streamer and a Slow Wide-angle Outflow around FUOri...
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
 
DIFFERENCE IN BACK CROSS AND TEST CROSS
DIFFERENCE IN  BACK CROSS AND TEST CROSSDIFFERENCE IN  BACK CROSS AND TEST CROSS
DIFFERENCE IN BACK CROSS AND TEST CROSS
 
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls AgencyHire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
Hire 💕 9907093804 Hooghly Call Girls Service Call Girls Agency
 
Botany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdfBotany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdf
 
Biopesticide (2).pptx .This slides helps to know the different types of biop...
Biopesticide (2).pptx  .This slides helps to know the different types of biop...Biopesticide (2).pptx  .This slides helps to know the different types of biop...
Biopesticide (2).pptx .This slides helps to know the different types of biop...
 
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceuticsPulmonary drug delivery system M.pharm -2nd sem P'ceutics
Pulmonary drug delivery system M.pharm -2nd sem P'ceutics
 
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdfPests of cotton_Sucking_Pests_Dr.UPR.pdf
Pests of cotton_Sucking_Pests_Dr.UPR.pdf
 
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroidsHubble Asteroid Hunter III. Physical properties of newly found asteroids
Hubble Asteroid Hunter III. Physical properties of newly found asteroids
 
Isotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on IoIsotopic evidence of long-lived volcanism on Io
Isotopic evidence of long-lived volcanism on Io
 
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
 
Animal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptxAnimal Communication- Auditory and Visual.pptx
Animal Communication- Auditory and Visual.pptx
 
Green chemistry and Sustainable development.pptx
Green chemistry  and Sustainable development.pptxGreen chemistry  and Sustainable development.pptx
Green chemistry and Sustainable development.pptx
 
GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)GBSN - Microbiology (Unit 2)
GBSN - Microbiology (Unit 2)
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C P
 

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