europython - machine learning for dummies with python
TRANSCRIPT
![Page 1: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/1.jpg)
Machine Learning
for dummieswith Python
EUROPYTHONJavier Arias
@javier_arilos
![Page 2: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/2.jpg)
One day in your life
July 2016
![Page 3: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/3.jpg)
One day in your life
Time to leave the office
![Page 4: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/4.jpg)
One day in your life
Tesla autopilot
![Page 5: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/5.jpg)
One day in your life
Playing music
![Page 6: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/6.jpg)
One day in your life
Your photos organized
![Page 7: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/7.jpg)
One day in your life
Machine Learning is here, it is everywhere andit is going to stay
![Page 8: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/8.jpg)
About this presentation
Why Machine Learning (ML) matters
A journey on Machine Learning
Some ML technologies and resources
Some basic ML concepts, with code samples
![Page 9: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/9.jpg)
Machine Learning is the next big thing
![Page 10: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/10.jpg)
Are machines already intelligent?
![Page 11: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/11.jpg)
Image-net challenge
2015: machines outperform people
![Page 12: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/12.jpg)
Chess
1997: Deepblue defeats Kasparov
![Page 13: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/13.jpg)
Game of Go
2016: AlphaGo wins world champion Lee Sedol
![Page 14: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/14.jpg)
![Page 15: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/15.jpg)
The journey
![Page 16: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/16.jpg)
Learning about ML
MOOC - Massive Open Online Courses
Contents by the best universities and companies
Udacity, Coursera, EdX
![Page 17: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/17.jpg)
Udacity - Intro to Machine Learning
Pattern Recognition for Fun and Profit
- Very well organized contents- Python + sklearn- Free- At your own pace
![Page 18: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/18.jpg)
Udacity - Intro to Machine Learning
Pattern Recognition for Fun and Profit
![Page 19: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/19.jpg)
Udacity - Intro to Machine Learning
Pattern Recognition for Fun and Profit
![Page 20: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/20.jpg)
What is Machine Learning?
![Page 21: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/21.jpg)
Solving a complex problem
somethingfeatures (data)
prediction
![Page 22: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/22.jpg)
First approach, programming
tell the computer what to do in very tiny steps
![Page 23: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/23.jpg)
programming does not scale for very complex problems...
First approach, programming
![Page 24: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/24.jpg)
Machine Learning
show the computer some real world data
the algorithm will learn from it
![Page 25: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/25.jpg)
Machine Learning, implications
we can train computers to do things we
do not know how to do
![Page 26: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/26.jpg)
![Page 27: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/27.jpg)
ML example: character recognition
Not-MNIST dataset
Thousands of 28x28 grayscale images with labels
![Page 28: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/28.jpg)
features x 1000s labels x 1000s
F G F J
ML step 1: get samples (training data)
![Page 29: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/29.jpg)
ML step 2: choose an algorithm
Linear regressionSupport Vector Mach.k-MeansDecision TreesRandom ForestsNeural networksConvolutional NNNaive Bayes
![Page 30: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/30.jpg)
ML step 3: train your algorithm
features x 1000s labels x 1000sML algorithm
F G F J
![Page 31: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/31.jpg)
ML, last step: getting predictions
ML algorithmfeatures (data)
prediction
D
![Page 32: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/32.jpg)
Tricky Question
How good are our predictions?
![Page 33: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/33.jpg)
The Tools
![Page 34: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/34.jpg)
The Tools: Python
● Opensource
● Expressive
● Interpreted, dynamically typed
● Widely used many different problems
● Batteries included: Notebook, Libraries
![Page 35: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/35.jpg)
The Tools: sklearn
● Opensource, Python
● Wonderful documentation
● Support to full ML lifecycle: ○ Feature engineering○ Algorithms○ Validation○ Datasets
![Page 36: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/36.jpg)
A summary of ML process
● Get features (with labels)
● Choose and configure an algorithm
● Train your algorithm
● Do predictions
● Validate your results
![Page 37: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/37.jpg)
train your model
tr_ds, _, tr_lbl, _ = train_test_split(dataset, labels,
train_size=size,
random_state=17)
clf = LogisticRegression()
clf.fit(tr_ds, tr_lbl) # fit with train dataset and train labels
train_ds test_ds
dataset
![Page 38: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/38.jpg)
make predictions
pred = clf.predict(test_dataset)
How good are our predictions?
![Page 39: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/39.jpg)
accuracy
test_predicions = clf.predict(test_dataset)
acc = accuracy_score(test_labels, test_predictions)
![Page 40: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/40.jpg)
89% accuracy
![Page 41: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/41.jpg)
Improving prediction results
Training data
Algorithm + config
![Page 42: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/42.jpg)
![Page 43: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/43.jpg)
Udacity - Deep Learning
Take machine Learning to the next level
ML branch based on algorithms that use multiple processing layers
● By Google
● Python and Tensorflow
● No wine for the moment :-(
![Page 44: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/44.jpg)
The Tools: TensorFlow
● Opensource, Python
● Deep Learning
● Data flow graphs.○ Nodes: mathematical operations○ Edges: Tensors, multidimensional arrays
![Page 45: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/45.jpg)
Simplest Neural Network
weight
bias
SOFTMAX
X Y PREDweight
bias
LAYER 1 LAYER 2
* + relu * + softmax
![Page 46: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/46.jpg)
Deep Learning as a chain of operations
![Page 47: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/47.jpg)
Let’s recap
![Page 48: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/48.jpg)
![Page 49: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/49.jpg)
![Page 50: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/50.jpg)
![Page 51: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/51.jpg)
![Page 52: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/52.jpg)
![Page 53: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/53.jpg)
![Page 54: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/54.jpg)
![Page 55: Europython - Machine Learning for dummies with Python](https://reader035.vdocuments.site/reader035/viewer/2022081722/58a1e0801a28abb6678b70e9/html5/thumbnails/55.jpg)
Thank you for your attention