24st October 2017
Machine learning crash course
Questions to answer
1. What is meant by “machine learning” and “deep learning”?
2. Is deep learning with neural networks the best solution for
most problems now days or what else is there to use?
3. How much theory do I need to get started with my app or
service?
4. How do I get from idea to trained and deployed model? …
and things to consider
1 - Machine learning and deep learning
Machine learning is a way to make advanced statistical models using
math. It’s a way to make a computer guess.
Machine learning models are fantastic with access to good data.
However machine learning models can’t perform magic.
Garbage in = Garbage out
Type of learning Description Example uses
Supervised learning Modelling an specified
target/output variable. Each
example is “labelled”.
Classification (into categories) or
regression (on a numerical target).
Predict if a person will default on
their loan. Model the sale price of
an apartment.
Unsupervised learning No target/control signal. Find
structure in data. Clustering.
Divide movies or bands into
genres from user data.
Semi-supervised learning Mix of the above. Only part of
input data is labelled.
As for supervised learning but
with incomplete labeling.
Reinforcement learning A system explores its
environment, takes actions and
receives rewards. No explicit
control signal. Learning by doing.
Teach software to play a game
(checkers, Atari Breakout, …)
Active learning Techniques to select the training
examples that the algorithm could
learn the most from at a given
time.
As for supervised learning but
trying to optimize the learning
process.
Types of machine learning
Deep learning is a subset of ML
“Deep learning” is just a
rebranding of “neural networks”!
These in turn are just systems for
fitting an output to an input by
repeatedly applying linear
transformations to the inputs until
they match the outputs.
Basic idea of neural networks
The input data, your data points, are assigned to input
“nodes” in an input “layer”.
These are connected with weights to a “hidden” layer,
which in turn is connected to the next hidden layer, or the
output layer.
The values in the input layer are multiplied by a weight
and the resulting products are summed to give an
“activation value” in the hidden (or output) layer.
In the output layer, the activations are compared to the
desired activations, and the weights are adjusted based
on how big the mismatch is. This is the “learning” part.
Deep learning just means many layers like this plus
maybe more complicated patterns in how the weights are
connected to inputs.
Decision trees Linear or logistic regression
Classical ML methods
Random forests
Decision tree ensembles
Gaussian process regression (good at
handling uncertainty)
Lasso regression (looking for simple
models)
Elaborations on classical ML methods
2 - What does deep learning do well (better)?
What deep learning does well
Object recognition in images
What deep learning does well
Neural machine translation
Recurrent neural networks, sequence modelling
Self-learning for games
AlphaGo + AlphaGo Zero
Pure learning approach (no
heuristics)
Applications: Image captioning
Applications: style transfer
Style transfer
Applications where you probably don’t need deep learning
• “Tabular data”, i.e., you have a table with rows and columns, where
the variables (columns) are a mix of numerical and categorical
variables – often standard methods are enough
• You have a small number of training examples (e.g. a couple of
hundred or less)
• When you want to create an easily interpretable model or just make
a quick sanity check
• Often, end users are more interested in understanding which
variables are important rather than the model’s accuracy
… in other words, you will quite often not need it.
3 - How much theory do I need?
How much math do I need?
Of course it is better to know some math/theory but frankly, it is probably sufficient to have some
intuition on how each method works.
If you know your maths, it is easier to implement models from papers or your own models, but existing
frameworks are enough to do a lot already. There has never been a better time to get into machine
learning!
- Incredible amounts of tutorials on e.g. Github and Medium
- MOOCs:
Andrew Ng, Coursera and deeplearning.ai
Jeremy Howard, Fast.ai
cognitiveclass.ai
- Software frameworks such as scikit-learn for Python
DSX tutorials & articles https://apsportal.ibm.com/community
A way to practice: online contests
§ Largest online predictive modeling competition
platform
§ Founded 2010. Acquired by Google 2016
§ Companies or organizations define problems and
provide data; users compete for the best score. The
winner gets a money prize or in some case a job offer
• The leaderboard is motivating
• You can learn a lot from the discussion board
• Useful to learn and try out new techniques
• Learn not to overfit
Meetups
4 - How to go from idea to trained & deployed model?
Understand the goal.
What do you want to be able to predict or understand?
Can it be measured in a good way?
Do you have the data necessary to model it?
Actionability.
What is the next step if you get a good predictive model? Can you use it?
Are the variables that you use such that they can be easily adjusted?
Will end users be able to act on the results?
Data quality.
Can you extract the data in a good way?
Are the data complete? Are there missing/suspicious values?
Training data size and shape.
Do you have enough examples for training compared to the number of
variables (dimensions)? Do you have “wide” or “long” data?
Checklist for a machine learning idea
Process
Tools: open-source vs. proprietary
Open source
Proprietary
Data science tools
Project collaboration
Notebooks
Model deployment
scikit-learn
Tensorflow
Keras
caret
Mlbench
Shiny
Deploying machine learning models
Easiest way? – Watson ML (today’s demo), or equivalents on Azure (Microsoft), CloudML
(Google), ECS (Amazon) …
Tensorflow (as some others) has built-in serving capabilities (Tensorflow Serving).
Do-it-yourself web servers – often done using Flask (Python web server framework), or for
language-independent model deployment, OpenScoring (uses PMML).
For non-production-grade deployment, can use Shiny (R web app library), or Python
equivalents (Plotly) Dash, Bokeh, (IBM) PixieDust.
Yhat - https://www.yhat.com/products/scienceops - commercial model deployment
solution that hooks directly into R or Python
What was not covered in this talk
• Visualisation and exploratory data analysis (including dynamic
data exploration apps)
• Details on how different ML models work
• Case studies
Maybe next time? J
30

ML crash course

  • 1.
    24st October 2017 Machinelearning crash course
  • 2.
    Questions to answer 1.What is meant by “machine learning” and “deep learning”? 2. Is deep learning with neural networks the best solution for most problems now days or what else is there to use? 3. How much theory do I need to get started with my app or service? 4. How do I get from idea to trained and deployed model? … and things to consider
  • 3.
    1 - Machinelearning and deep learning
  • 4.
    Machine learning isa way to make advanced statistical models using math. It’s a way to make a computer guess. Machine learning models are fantastic with access to good data. However machine learning models can’t perform magic. Garbage in = Garbage out
  • 5.
    Type of learningDescription Example uses Supervised learning Modelling an specified target/output variable. Each example is “labelled”. Classification (into categories) or regression (on a numerical target). Predict if a person will default on their loan. Model the sale price of an apartment. Unsupervised learning No target/control signal. Find structure in data. Clustering. Divide movies or bands into genres from user data. Semi-supervised learning Mix of the above. Only part of input data is labelled. As for supervised learning but with incomplete labeling. Reinforcement learning A system explores its environment, takes actions and receives rewards. No explicit control signal. Learning by doing. Teach software to play a game (checkers, Atari Breakout, …) Active learning Techniques to select the training examples that the algorithm could learn the most from at a given time. As for supervised learning but trying to optimize the learning process. Types of machine learning
  • 6.
    Deep learning isa subset of ML “Deep learning” is just a rebranding of “neural networks”! These in turn are just systems for fitting an output to an input by repeatedly applying linear transformations to the inputs until they match the outputs.
  • 7.
    Basic idea ofneural networks The input data, your data points, are assigned to input “nodes” in an input “layer”. These are connected with weights to a “hidden” layer, which in turn is connected to the next hidden layer, or the output layer. The values in the input layer are multiplied by a weight and the resulting products are summed to give an “activation value” in the hidden (or output) layer. In the output layer, the activations are compared to the desired activations, and the weights are adjusted based on how big the mismatch is. This is the “learning” part. Deep learning just means many layers like this plus maybe more complicated patterns in how the weights are connected to inputs.
  • 8.
    Decision trees Linearor logistic regression Classical ML methods
  • 9.
    Random forests Decision treeensembles Gaussian process regression (good at handling uncertainty) Lasso regression (looking for simple models) Elaborations on classical ML methods
  • 10.
    2 - Whatdoes deep learning do well (better)?
  • 11.
    What deep learningdoes well Object recognition in images
  • 12.
    What deep learningdoes well Neural machine translation Recurrent neural networks, sequence modelling
  • 13.
  • 14.
    AlphaGo + AlphaGoZero Pure learning approach (no heuristics)
  • 15.
  • 16.
  • 17.
    Applications where youprobably don’t need deep learning • “Tabular data”, i.e., you have a table with rows and columns, where the variables (columns) are a mix of numerical and categorical variables – often standard methods are enough • You have a small number of training examples (e.g. a couple of hundred or less) • When you want to create an easily interpretable model or just make a quick sanity check • Often, end users are more interested in understanding which variables are important rather than the model’s accuracy … in other words, you will quite often not need it.
  • 18.
    3 - Howmuch theory do I need?
  • 19.
    How much mathdo I need? Of course it is better to know some math/theory but frankly, it is probably sufficient to have some intuition on how each method works. If you know your maths, it is easier to implement models from papers or your own models, but existing frameworks are enough to do a lot already. There has never been a better time to get into machine learning! - Incredible amounts of tutorials on e.g. Github and Medium - MOOCs: Andrew Ng, Coursera and deeplearning.ai Jeremy Howard, Fast.ai cognitiveclass.ai - Software frameworks such as scikit-learn for Python DSX tutorials & articles https://apsportal.ibm.com/community
  • 21.
    A way topractice: online contests § Largest online predictive modeling competition platform § Founded 2010. Acquired by Google 2016 § Companies or organizations define problems and provide data; users compete for the best score. The winner gets a money prize or in some case a job offer
  • 22.
    • The leaderboardis motivating • You can learn a lot from the discussion board • Useful to learn and try out new techniques • Learn not to overfit
  • 23.
  • 24.
    4 - Howto go from idea to trained & deployed model?
  • 25.
    Understand the goal. Whatdo you want to be able to predict or understand? Can it be measured in a good way? Do you have the data necessary to model it? Actionability. What is the next step if you get a good predictive model? Can you use it? Are the variables that you use such that they can be easily adjusted? Will end users be able to act on the results? Data quality. Can you extract the data in a good way? Are the data complete? Are there missing/suspicious values? Training data size and shape. Do you have enough examples for training compared to the number of variables (dimensions)? Do you have “wide” or “long” data? Checklist for a machine learning idea
  • 26.
  • 27.
    Tools: open-source vs.proprietary Open source Proprietary Data science tools Project collaboration Notebooks Model deployment scikit-learn Tensorflow Keras caret Mlbench Shiny
  • 28.
    Deploying machine learningmodels Easiest way? – Watson ML (today’s demo), or equivalents on Azure (Microsoft), CloudML (Google), ECS (Amazon) … Tensorflow (as some others) has built-in serving capabilities (Tensorflow Serving). Do-it-yourself web servers – often done using Flask (Python web server framework), or for language-independent model deployment, OpenScoring (uses PMML). For non-production-grade deployment, can use Shiny (R web app library), or Python equivalents (Plotly) Dash, Bokeh, (IBM) PixieDust. Yhat - https://www.yhat.com/products/scienceops - commercial model deployment solution that hooks directly into R or Python
  • 29.
    What was notcovered in this talk • Visualisation and exploratory data analysis (including dynamic data exploration apps) • Details on how different ML models work • Case studies Maybe next time? J
  • 30.