10 THINGS
EVERY PHP DEVELOPER
SHOULD KNOW ABOUT
MACHINE LEARNING
Fill in the gaps and squash hype around M.L.
Build the case for using it now.
And provide easy ways to get started.
TODAY’S GOALS
Background
#1: What it is
#2: It’s taking over
#3: How it works
#4: Different approaches
#5: Where it’s used
#6: How to get started
OUR JOURNEY
Code
#7: Recommendations
#8: Content analysis
#9: Computer speech
#10: Computer vision
INTRODUCTIONS
ABOUT ME
chris.mohritz@10xeffect.com
● Lifelong entrepreneur
● Deep technology background (strategy, not developer)
● Using A.I. (machine learning) in business since 2009
● Opening a startup accelerator in Vegas
HOW I GOT STARTED
Apache
Mahout
(Decision Forest)
Behavior
prediction
Suite of
mobile apps
Determine most relevant (highest-converting)
sales offer to present to each individual user —
and the best (highest-converting) time to
present it.
circa 2009
Will the current user buy “Madden NFL” right now?
WHAT IS A DECISION FOREST?
is male?
is age
> 16?
is Y app
installed?
is X app
installed?
end
has used >
30 days?
was X
function
used?
was Y
function
used?
no
yes
no
yes
no
yes
no
yes
end
(better ways to do this now)
no
yes
end
do it
#1: WHAT IS IT?
“Field of study that
gives computers the
ability to learn without
being explicitly
programmed.”
~ Arthur Samuel, 1959
MACHINE LEARNING IS...
analyticsvidhya.com/blog/2015/07/difference-machine-learning-statistical-modeling
Training your computer to do stuff,
just like you would train a pet.
IN OTHER WORDS...
SIMILAR TO HOW WE LEARN
Data System Output
Model
Question Answer
Emotions
Mindset
Algorithm
The reference data pattern
(decision-making stuff)
Process the computer uses
to ‘learn’ the model
The model is built from
historical data Training data
Life experience
Perspective
Algoritm
AT THE END OF THE DAY...
It’s all pattern recognition.
#2: WHY SHOULD I CARE?
SOFTWARE IS EATING THE
WORLD
Everything is becoming code.
Software automates, simplifies, and
accelerates business.
BUT...
Someone needs to write the code/logic.
THE TRADITIONAL WAY
Handwritten logic.
If / Then / Else
THE PROBLEM
Complex situations require
complex2
software logic.
THE SOLUTION
Trained logic using historical data.
Model
tripID hasEggs eggsBough
t
milkBought
1 1 6 1
2 0 0 2
3 1 6 1
4 1 8 1
5 0 0 1
6 1 6 1
7 0 0 3
0011001101011101
0101100111010
11001001101
Stored as a
mathematical
model.
Finds patterns in
the data.
WHAT IT LOOKS LIKE
console.aws.amazon.com/machinelearning/home?region=us-east-1#/datasources
M.L. IS EATING THE SOFTWARE
All applications are becoming “smart” — with
unprecedented complexity in logic.
Machine learning automates, simplifies, and
accelerates software.
ENDLESS OPPORTUNITIES
Everything mankind has ever invented — including all
software apps — will be reinvented using A.I.
A QUICK NOTE...
In the near future, A.I. be writing it’s own code.
#3: HOW DOES IT WORK?
STILL A MURKY LANDSCAPE
Artificial Intelligence
Machine Understanding (?)
Pattern recognition
Classification
Prediction
Can only do one thing
Brute-force approach
Autonomous decisions
Universally applicable
Intuition approach
Google DeepMind
Amazon Machine Learning
Natural language processing
Computer vision
Optimization
IBM Watson
Classic learning
Multi-tiered
deep learning
neural networks
Deep learning
neural network
Explicit ProgrammingHandwritten
Machine Learning
logiccomplexity
IT’S ALL CLASSIFICATION
via: wjscheirer.com
“Features”
Points of differentiation within the data.
How would you teach a
child to recognize the
differences?
● Distance between eyes
● Width of nose
● Shape of cheekbones
● etc.
HOW DOES IT CLASSIFY?
“Probability”
Each potential
answer gets a
numeric
probability
calculated for it.
Higher
probability
means greater
confidence.
HOW DOES IT MAKE DECISIONS?
● Supervised learning — Labeled training data
● Unsupervised learning — Unlabeled training data
● Transfer learning — Applying aspects across
models
● Reinforcement learning — Reward-based training
TRAINING
gym.openai.com
#4: WHAT ARE THE DIFFERENT
APPROACHES?
REMEMBER...
Data System Output
Model
Question Answer
Emotions
Mindset
Algorithm
The reference data pattern
(decision-making stuff)
Process the computer uses
to ‘learn’ the model
The model is built from
historical data Training data
Life experience
Perspective
Algoritm
Who wants to be a
data scientist?
ENDLESS ALGORITHMS
docs.microsoft.com/en-us/azure/machine-learning/machine-learning-algorithm-choice
machinelearningmastery.com/a-tour-of-machine-learning-algorithms
No “hidden”
layers
“CLASSIC” LEARNING
playground.tensorflow.org
1-2 “hidden”
layers
“SHALLOW” LEARNING
playground.tensorflow.org
>2 “hidden”
layers
“DEEP” LEARNING
playground.tensorflow.org
(SIMPLE) NEURAL NETWORK
Each layer performs a
discrete function
≥ 1 input
neurons
≥ 1 output
neurons
≥ 1 hidden layers
Output “fires” if all
weighted inputs sum
to a set “threshold”
Each connection applies a
“weighted” influence on
the receiving neuron
Layers build on each other
(iterative)
Each input can
be a separate
“feature”
Each neuron takes in
multiple inputs
Hidden layers can’t directly
“see” or act on outside world
cs231n.github.io/neural-networks-1
HOW MUCH IS A HOUSE WORTH?
Decisions based on combinations.
3 bedrooms
37 years old
1450 ft2
$191,172
Is it “old” or “historic?”
Is it “small” or “open floor plan?”
$32,108 per bedroom
$64,251 per acre
Need a lower weight for “old”
Apply initial
abstractions
Set values
cs231n.github.io/neural-networks-1
#5: WHERE IS IT USED?
ENDLESS USES
● Classifying DNA sequences
● Economics
● Fraud detection
● Medical diagnosis
● Search engines
● Speech recognition
● Job search
● Spam filtering
● Risk prediction
● Visual product search
● Create art / music
● Industrial design
● Image caption generation
● Facial recognition
● Colorization of b&w images
● Adding sound to silent movies
● Language translation
● Image editing
● Vehicle navigation
● Error detection
IN THE WILD
Recommender
(pick from list)
Classifier
(binary)
Visual
recognition
(deep learning)
#6: WHERE SHOULD I START?
● You don’t need a supercomputer
● You don’t need to write a ton of code
● You don’t need to invest massive amounts of time
● You don’t need a data science degree
● You don’t need to be a math whiz
● You don’t need mountains of data
MYTH BUSTING
IT’S EASIER THAN YOU THINK
Forget theory, just do it.
● Amazon Artificial Intelligence
● Google Cloud Machine Learning
● Microsoft Cognitive Services
● IBM Watson *
● DiffBot
* - PHP library is 3rd-party
SaaS OPTIONS
● TensorFlow *
● Amazon DSSTNE *
● H2O *
● PredictionIO
● Apache Mahout
● Scikit Learn
● Caffe *
OPEN SOURCE OPTIONS
● Microsoft CNTK *
● Torch *
● Theano *
● MXnet *
● Chainer *
● Keras *
● Neon *
* ANN / Deep learning
● archive.ics.uci.edu/ml
● deeplearning.net/datasets
● mldata.org
● grouplens.org/datasets
● cs.toronto.edu/~kriz/cifar.html
● cs.cornell.edu/people/pabo/movie-review-data
● yann.lecun.com/exdb/mnist (handwriting)
● kdnuggets.com/datasets/index.html (long list)
● image-net.org (competition)
OPEN SOURCE DATASETS
#7: RECOMMENDATIONS
A CUSTOMER-DRIVEN WORLD
Today, consumers control the brand-customer
relationship. They choose when and how they interact.
Brands need to create attractive experiences that
draw consumers in — through highly relevant
communications and products.
PRODUCTS
CONTENT
ENDLESS APPLICATIONS
● Visitors who viewed this product also viewed
● Visitors who viewed this product ultimately bought
● You might also like
● Recently viewed
● Trending in category
● Site-wide top sellers
● Customer also bought
● Other customers who bought this product also bought
● Items viewed with items in your cart
● Top sellers from your recent categories on homepage
RECOMMENDATIONS API
microsoft.com/cognitive-services/en-us/recommendations-api
Recommendations
Build
FBT Build
Model Application
Training
Catalog
Training
Usage
HOW IT WORKS
Related item
recommendations
Recommendations API
Frequently bought together
recommendations
PLAN PLAN LIMITS PRICE
Free 10,000 calls / mo Free
S1 Standard 100,000 calls / mo
$75 / mo
(overage at $0.75 / 1000 calls)
S2 Standard 1,000,000 calls / mo
$500 / mo
(overage at $0.75 / 1000 calls)
S3 Standard
10,000,000 calls / mo
(overage at $0.75 per 1K calls)
$2,500 / mo
(overage at $0.75 / 1000 calls)
S4 Standard 50,000,000 calls/mo
$5,000 / mo
(overage at $0.75 / 1000 calls)
PRICING
Catalog
Usage
TRAINING DATA
Guide: gigaom.com/2017/02/08/building-a-recommendation-engine-using-microsoft-azure
Code: github.com/10xNation/microsoft-recommendation-engine
DEMO
#8: CONTENT ANALYSIS
IBM WATSON NATURAL LANGUAGE
UNDERSTANDING
ibm.com/watson/developercloud/natural-language-understanding.html
● Code: github.com/10xNation/ibm-watson-natural-language-understanding-php
● GUI: natural-language-understanding-demo.mybluemix.net
#9: COMPUTER SPEECH
AMAZON POLLY
console.aws.amazon.com/polly/home
Code: github.com/10xNation/amazon-polly-demo-php
#10: COMPUTER VISION
GOOGLE CLOUD VISION
cloud.google.com/vision
Guide: gigaom.com/2017/02/06/harnessing-visual-data-using-google-cloud
Code:
github.com/GoogleCloudPlatform/php-docs-samples/tree/master/vision/api
CLOSING
Intro blog posts:
● Artificial Intelligence 101 (the big picture)
● Machine Learning 101 (what you’ll actually use)
New ‘How to Apply A.I. in Your Business’ blog series:
● Voice-Powered Products w/ Amazon Alexa
● Predictive Social Media w/ IBM Watson(live)
● Image Recognition w/ Google Cloud
● Recommendation Engine w/ Microsoft Azure
GO DEEPER
THANK YOU
chris.mohritz@10xeffect.com

10 Things Every PHP Developer Should Know About Machine Learning

  • 1.
    10 THINGS EVERY PHPDEVELOPER SHOULD KNOW ABOUT MACHINE LEARNING
  • 2.
    Fill in thegaps and squash hype around M.L. Build the case for using it now. And provide easy ways to get started. TODAY’S GOALS
  • 3.
    Background #1: What itis #2: It’s taking over #3: How it works #4: Different approaches #5: Where it’s used #6: How to get started OUR JOURNEY Code #7: Recommendations #8: Content analysis #9: Computer speech #10: Computer vision
  • 4.
  • 5.
    ABOUT ME chris.mohritz@10xeffect.com ● Lifelongentrepreneur ● Deep technology background (strategy, not developer) ● Using A.I. (machine learning) in business since 2009 ● Opening a startup accelerator in Vegas
  • 6.
    HOW I GOTSTARTED Apache Mahout (Decision Forest) Behavior prediction Suite of mobile apps Determine most relevant (highest-converting) sales offer to present to each individual user — and the best (highest-converting) time to present it. circa 2009
  • 7.
    Will the currentuser buy “Madden NFL” right now? WHAT IS A DECISION FOREST? is male? is age > 16? is Y app installed? is X app installed? end has used > 30 days? was X function used? was Y function used? no yes no yes no yes no yes end (better ways to do this now) no yes end do it
  • 8.
  • 9.
    “Field of studythat gives computers the ability to learn without being explicitly programmed.” ~ Arthur Samuel, 1959 MACHINE LEARNING IS... analyticsvidhya.com/blog/2015/07/difference-machine-learning-statistical-modeling
  • 10.
    Training your computerto do stuff, just like you would train a pet. IN OTHER WORDS...
  • 11.
    SIMILAR TO HOWWE LEARN Data System Output Model Question Answer Emotions Mindset Algorithm The reference data pattern (decision-making stuff) Process the computer uses to ‘learn’ the model The model is built from historical data Training data Life experience Perspective Algoritm
  • 12.
    AT THE ENDOF THE DAY... It’s all pattern recognition.
  • 13.
  • 14.
    SOFTWARE IS EATINGTHE WORLD Everything is becoming code. Software automates, simplifies, and accelerates business.
  • 15.
    BUT... Someone needs towrite the code/logic.
  • 16.
    THE TRADITIONAL WAY Handwrittenlogic. If / Then / Else
  • 17.
    THE PROBLEM Complex situationsrequire complex2 software logic.
  • 18.
    THE SOLUTION Trained logicusing historical data. Model tripID hasEggs eggsBough t milkBought 1 1 6 1 2 0 0 2 3 1 6 1 4 1 8 1 5 0 0 1 6 1 6 1 7 0 0 3 0011001101011101 0101100111010 11001001101 Stored as a mathematical model. Finds patterns in the data.
  • 19.
    WHAT IT LOOKSLIKE console.aws.amazon.com/machinelearning/home?region=us-east-1#/datasources
  • 20.
    M.L. IS EATINGTHE SOFTWARE All applications are becoming “smart” — with unprecedented complexity in logic. Machine learning automates, simplifies, and accelerates software.
  • 21.
    ENDLESS OPPORTUNITIES Everything mankindhas ever invented — including all software apps — will be reinvented using A.I.
  • 22.
    A QUICK NOTE... Inthe near future, A.I. be writing it’s own code.
  • 23.
    #3: HOW DOESIT WORK?
  • 24.
    STILL A MURKYLANDSCAPE Artificial Intelligence Machine Understanding (?) Pattern recognition Classification Prediction Can only do one thing Brute-force approach Autonomous decisions Universally applicable Intuition approach Google DeepMind Amazon Machine Learning Natural language processing Computer vision Optimization IBM Watson Classic learning Multi-tiered deep learning neural networks Deep learning neural network Explicit ProgrammingHandwritten Machine Learning logiccomplexity
  • 25.
  • 26.
    “Features” Points of differentiationwithin the data. How would you teach a child to recognize the differences? ● Distance between eyes ● Width of nose ● Shape of cheekbones ● etc. HOW DOES IT CLASSIFY?
  • 27.
    “Probability” Each potential answer getsa numeric probability calculated for it. Higher probability means greater confidence. HOW DOES IT MAKE DECISIONS?
  • 28.
    ● Supervised learning— Labeled training data ● Unsupervised learning — Unlabeled training data ● Transfer learning — Applying aspects across models ● Reinforcement learning — Reward-based training TRAINING gym.openai.com
  • 29.
    #4: WHAT ARETHE DIFFERENT APPROACHES?
  • 30.
    REMEMBER... Data System Output Model QuestionAnswer Emotions Mindset Algorithm The reference data pattern (decision-making stuff) Process the computer uses to ‘learn’ the model The model is built from historical data Training data Life experience Perspective Algoritm
  • 31.
    Who wants tobe a data scientist? ENDLESS ALGORITHMS docs.microsoft.com/en-us/azure/machine-learning/machine-learning-algorithm-choice machinelearningmastery.com/a-tour-of-machine-learning-algorithms
  • 32.
  • 33.
  • 34.
  • 35.
    (SIMPLE) NEURAL NETWORK Eachlayer performs a discrete function ≥ 1 input neurons ≥ 1 output neurons ≥ 1 hidden layers Output “fires” if all weighted inputs sum to a set “threshold” Each connection applies a “weighted” influence on the receiving neuron Layers build on each other (iterative) Each input can be a separate “feature” Each neuron takes in multiple inputs Hidden layers can’t directly “see” or act on outside world cs231n.github.io/neural-networks-1
  • 36.
    HOW MUCH ISA HOUSE WORTH? Decisions based on combinations. 3 bedrooms 37 years old 1450 ft2 $191,172 Is it “old” or “historic?” Is it “small” or “open floor plan?” $32,108 per bedroom $64,251 per acre Need a lower weight for “old” Apply initial abstractions Set values cs231n.github.io/neural-networks-1
  • 37.
    #5: WHERE ISIT USED?
  • 38.
    ENDLESS USES ● ClassifyingDNA sequences ● Economics ● Fraud detection ● Medical diagnosis ● Search engines ● Speech recognition ● Job search ● Spam filtering ● Risk prediction ● Visual product search ● Create art / music ● Industrial design ● Image caption generation ● Facial recognition ● Colorization of b&w images ● Adding sound to silent movies ● Language translation ● Image editing ● Vehicle navigation ● Error detection
  • 39.
    IN THE WILD Recommender (pickfrom list) Classifier (binary) Visual recognition (deep learning)
  • 40.
  • 41.
    ● You don’tneed a supercomputer ● You don’t need to write a ton of code ● You don’t need to invest massive amounts of time ● You don’t need a data science degree ● You don’t need to be a math whiz ● You don’t need mountains of data MYTH BUSTING
  • 42.
    IT’S EASIER THANYOU THINK Forget theory, just do it.
  • 43.
    ● Amazon ArtificialIntelligence ● Google Cloud Machine Learning ● Microsoft Cognitive Services ● IBM Watson * ● DiffBot * - PHP library is 3rd-party SaaS OPTIONS
  • 44.
    ● TensorFlow * ●Amazon DSSTNE * ● H2O * ● PredictionIO ● Apache Mahout ● Scikit Learn ● Caffe * OPEN SOURCE OPTIONS ● Microsoft CNTK * ● Torch * ● Theano * ● MXnet * ● Chainer * ● Keras * ● Neon * * ANN / Deep learning
  • 45.
    ● archive.ics.uci.edu/ml ● deeplearning.net/datasets ●mldata.org ● grouplens.org/datasets ● cs.toronto.edu/~kriz/cifar.html ● cs.cornell.edu/people/pabo/movie-review-data ● yann.lecun.com/exdb/mnist (handwriting) ● kdnuggets.com/datasets/index.html (long list) ● image-net.org (competition) OPEN SOURCE DATASETS
  • 46.
  • 47.
    A CUSTOMER-DRIVEN WORLD Today,consumers control the brand-customer relationship. They choose when and how they interact. Brands need to create attractive experiences that draw consumers in — through highly relevant communications and products.
  • 48.
  • 49.
  • 50.
    ENDLESS APPLICATIONS ● Visitorswho viewed this product also viewed ● Visitors who viewed this product ultimately bought ● You might also like ● Recently viewed ● Trending in category ● Site-wide top sellers ● Customer also bought ● Other customers who bought this product also bought ● Items viewed with items in your cart ● Top sellers from your recent categories on homepage
  • 51.
  • 52.
    Recommendations Build FBT Build Model Application Training Catalog Training Usage HOWIT WORKS Related item recommendations Recommendations API Frequently bought together recommendations
  • 53.
    PLAN PLAN LIMITSPRICE Free 10,000 calls / mo Free S1 Standard 100,000 calls / mo $75 / mo (overage at $0.75 / 1000 calls) S2 Standard 1,000,000 calls / mo $500 / mo (overage at $0.75 / 1000 calls) S3 Standard 10,000,000 calls / mo (overage at $0.75 per 1K calls) $2,500 / mo (overage at $0.75 / 1000 calls) S4 Standard 50,000,000 calls/mo $5,000 / mo (overage at $0.75 / 1000 calls) PRICING
  • 54.
  • 55.
  • 56.
  • 57.
    IBM WATSON NATURALLANGUAGE UNDERSTANDING ibm.com/watson/developercloud/natural-language-understanding.html ● Code: github.com/10xNation/ibm-watson-natural-language-understanding-php ● GUI: natural-language-understanding-demo.mybluemix.net
  • 58.
  • 59.
  • 60.
  • 61.
    GOOGLE CLOUD VISION cloud.google.com/vision Guide:gigaom.com/2017/02/06/harnessing-visual-data-using-google-cloud Code: github.com/GoogleCloudPlatform/php-docs-samples/tree/master/vision/api
  • 62.
  • 63.
    Intro blog posts: ●Artificial Intelligence 101 (the big picture) ● Machine Learning 101 (what you’ll actually use) New ‘How to Apply A.I. in Your Business’ blog series: ● Voice-Powered Products w/ Amazon Alexa ● Predictive Social Media w/ IBM Watson(live) ● Image Recognition w/ Google Cloud ● Recommendation Engine w/ Microsoft Azure GO DEEPER
  • 64.