Machine Learning
w/Python
Andrew Schwabe, 10 January 2018
Founder, Saigon A.I.
CEO, Formotiv
About Andrew
We are hiring!
 Talk to me after the presentation for more info
What is Machine Learning?
 Machine learning is the study of how a computer can learn without being
explicitly programmed.
- Arthur Samuel 1959
 ML helps computers make data-driven decisions
 Predict results
 Classify unknown or new data
 There are MANY algorithms for ML
A.I. vs. Machine Learning vs. Data Science
A.I. compared to Machine Learning
 ML:
 Self driving car uses ML to create the MOST DIRECT route from A to B
 A.I.
 Self driving car sees an accident that slows traffic, and decides to change the
route, even though it the distance is further
 Note: A.I. uses a lot of ML for its data and decisions
Supervised vs. Unsupervised Learning
 Supervised Learning
 You have a data set with known results, and you “train” your ML model to
recognize and predict data that “looks like” your data set
 Example: ”Learning” from a book or online video
 Used for: Classification and Regression
 Unsupervised Learning
 Your ML model observes new data and makes its own conclusions by looking for
patterns
 Example: Learning a new sport by watching people play
 Used for: Clustering and Association
Classification, Regression
 Classification
 Is an email message SPAM or not ?
 What kind of animal is it?
 What disease does a patient have?
 (finite number of possible results)
 Regression
 What will the stock price be tomorrow ?
 What will house price be in 6 months?
 (a predicted numeric value)
Clustering, Association
 Clustering
 Find the different age groups that buy 3-in-1 Café
 Marketing research
 Association
 People who bought 3-in-1 Café usually also buy what products ?
 Netflix
Best Programming Language for ML ?
 Universities, research and big companies use PYTHON
 Java, Lisp, Prolog, and c++ are also popular for developers
 Data scientists use R, SSAS, Weka and others
Python!
 Numpy
 Library for managing large arrays of data
 Pandas
 Library for data structure analysis (wraps numpy)
 Scipy
 Library with many tools for maths, science, data analysis and ML
These are the packages you need to install to use the sample code
How does ML actually work?
 Simple Example 1: Cats vs Dogs
 Is this good enough to train an ML model? Will predictions be accurate ?
 Usually you have to convert text like “has fur” to a numeric representation,
like has fur = 1, and does not have fur = 0
x1 x2 x3 y
4 legs Has fur Has tail dog
4 legs Has fur Has tail cat
4 legs Has fur Has tail dog
How does ML actually work?
 Simple Example 1: Cats vs Dogs
 More data needed ? More columns needed ?
 Most important metric: accuracy for prediction
 Some ML algorithms work better for different data sets
x1 x2 x3 x4 x5 y
4 legs Has fur Has tail big bark dog
4 legs Has fur Has tail small meow cat
4 legs Has fur Has tail small bark dog
How does ML actually work?
 Simple Example 1: Classification Tree
Fisher’s Iris Data Set Example
 Classic data set
 Only 150 records
Advanced ML Example
 Reinforcement Learning
 Predictions for Bitcoin and other cryptocurrency
What is Reinforcement Learning?
Which way to turn? Rewards:
+1
-100
+10
+20
Many Future Uses of ML
 Food tech with global warming
 Growing food
 Fish and farm animals
 Internet of Things (IoT)
 Cybersecurity
 Medical analysis and treatment
 Smart cars and Robotics
 Voice control
 Games
Good resources
 https://machinelearningmastery.com/machine-learning-in-python-step-by-
step/
 https://www.datacamp.com/community/tutorials/pandas-tutorial-
dataframe-python
 https://github.com/rougier/numpy-tutorial
 https://www.scipy.org/getting-started.html
Thank you!
 Follow me on:
 Facebook - fb.me/andrew.schwabe
 Twitter – aschwabe
 I will post this presentation and some sample code on Facebook and twitter

Python Machine Learning January 2018 - Ho Chi Minh City

  • 1.
    Machine Learning w/Python Andrew Schwabe,10 January 2018 Founder, Saigon A.I. CEO, Formotiv
  • 2.
  • 3.
    We are hiring! Talk to me after the presentation for more info
  • 5.
    What is MachineLearning?  Machine learning is the study of how a computer can learn without being explicitly programmed. - Arthur Samuel 1959  ML helps computers make data-driven decisions  Predict results  Classify unknown or new data  There are MANY algorithms for ML
  • 6.
    A.I. vs. MachineLearning vs. Data Science
  • 7.
    A.I. compared toMachine Learning  ML:  Self driving car uses ML to create the MOST DIRECT route from A to B  A.I.  Self driving car sees an accident that slows traffic, and decides to change the route, even though it the distance is further  Note: A.I. uses a lot of ML for its data and decisions
  • 8.
    Supervised vs. UnsupervisedLearning  Supervised Learning  You have a data set with known results, and you “train” your ML model to recognize and predict data that “looks like” your data set  Example: ”Learning” from a book or online video  Used for: Classification and Regression  Unsupervised Learning  Your ML model observes new data and makes its own conclusions by looking for patterns  Example: Learning a new sport by watching people play  Used for: Clustering and Association
  • 9.
    Classification, Regression  Classification Is an email message SPAM or not ?  What kind of animal is it?  What disease does a patient have?  (finite number of possible results)  Regression  What will the stock price be tomorrow ?  What will house price be in 6 months?  (a predicted numeric value)
  • 10.
    Clustering, Association  Clustering Find the different age groups that buy 3-in-1 Café  Marketing research  Association  People who bought 3-in-1 Café usually also buy what products ?  Netflix
  • 11.
    Best Programming Languagefor ML ?  Universities, research and big companies use PYTHON  Java, Lisp, Prolog, and c++ are also popular for developers  Data scientists use R, SSAS, Weka and others
  • 12.
    Python!  Numpy  Libraryfor managing large arrays of data  Pandas  Library for data structure analysis (wraps numpy)  Scipy  Library with many tools for maths, science, data analysis and ML These are the packages you need to install to use the sample code
  • 13.
    How does MLactually work?  Simple Example 1: Cats vs Dogs  Is this good enough to train an ML model? Will predictions be accurate ?  Usually you have to convert text like “has fur” to a numeric representation, like has fur = 1, and does not have fur = 0 x1 x2 x3 y 4 legs Has fur Has tail dog 4 legs Has fur Has tail cat 4 legs Has fur Has tail dog
  • 14.
    How does MLactually work?  Simple Example 1: Cats vs Dogs  More data needed ? More columns needed ?  Most important metric: accuracy for prediction  Some ML algorithms work better for different data sets x1 x2 x3 x4 x5 y 4 legs Has fur Has tail big bark dog 4 legs Has fur Has tail small meow cat 4 legs Has fur Has tail small bark dog
  • 15.
    How does MLactually work?  Simple Example 1: Classification Tree
  • 17.
    Fisher’s Iris DataSet Example  Classic data set  Only 150 records
  • 18.
    Advanced ML Example Reinforcement Learning  Predictions for Bitcoin and other cryptocurrency
  • 19.
  • 20.
    Which way toturn? Rewards: +1 -100 +10 +20
  • 21.
    Many Future Usesof ML  Food tech with global warming  Growing food  Fish and farm animals  Internet of Things (IoT)  Cybersecurity  Medical analysis and treatment  Smart cars and Robotics  Voice control  Games
  • 22.
    Good resources  https://machinelearningmastery.com/machine-learning-in-python-step-by- step/ https://www.datacamp.com/community/tutorials/pandas-tutorial- dataframe-python  https://github.com/rougier/numpy-tutorial  https://www.scipy.org/getting-started.html
  • 23.
    Thank you!  Followme on:  Facebook - fb.me/andrew.schwabe  Twitter – aschwabe  I will post this presentation and some sample code on Facebook and twitter