Machine Learning for Java Developers
in 45 Minutes
Why, How and Whoa!
Session CON2977 — WEDNESDAY Oct 4, 2017 8:30am - 9:15am PT
Speakers
Zoran Severac@neuroph
AI ResearcherUniv of Belgrade, Serbia
JC, NetBeans Dream Team
Frank Greco@frankgreco
ChairNYJavaSIG - NY Java User Group
JC, Cloud/Mobile Architect
GoalTo explain what Machine Learning is, why it’s important and
show Java Developers how to create your own ML apps
What is Machine Learning (ML)● A Type (Subclass) of Artificial Intelligence (AI)
● A System that Learns and Improves its Predictions
○ For Example: Gmail - “flag this as spam” or “not spam”
● Not Just Big Data 2.0
○ Big Data is about Traditional Data Analytics and Visualization Tools
○ >50% Big Data Projects fail - focus is on data gathering/prep/architecture, not on analysis
● ML is more Dynamic than just Data Analytics
● Machines can find Patterns and create ML models much faster than Humans
What Problem does ML Solve?
Chess has simple rules.64 Squares16 Attackers/Defenders per sideWell-defined moves
Rules are easy to describe.Straightforward to program.
Visual Recognition (an ML example)Requires deeper thoughtPotentially subjective
Rules are very hard to describe.Much harder to program.Early AI/ML systems failed partially due to “hard-coded” rules.
Chess
Chihuahua or Muffin?
Many Applications are Hard to CodeMany applications are not explicitly programmable…Machines can automate the correlations and model building...
Handwriting translation
Autonomous Driving
Face recognition
http://vision.ics.uci.edu/images/fun/IMG_1183_augmented_reality_faces1.jpg
We are Familiar with Deterministic Solutions
Input Output
Same Input gives us the Same OutputSame Input gives us the Same OutputSame Input gives us the Same Output
…
But We’re Not Used to Non-Deterministic Solutions
Output1InputInputInputInput
InputInputInputImput
InputInputInputInputt
Output2
Output3
Lots of Noisy Datasets Sensors, voice, images, video Many variables with noisy data
Probabilistic Outputs Uncertainty, noisy data, randomness, statistical, different contexts, etc.
ModelA Model
B
ModelC Model
D
Problem Definition
Determine Target Metrics
Data Prep
Train Model
Test Model
Deploy
Parse/Filter the Data
Observe Patterns / Learn
Predict
Basic WorkFlow of
ML-Infused App
Data Scientists
Data Engineers
Recommendations
Fraud detection
Targeted ads
Hacker detection
Customer support patterns
Smart oil rig
ML is already heavily used
Use Cases for Visual Recognition alone…
Ensure positioning of assembly products Travel and retail suggestions
Track logos on social media Visual compliance or deterioration
Google's CEO, Sundar Pichai - his company is betting big on advances in artificial intelligence (AI) and machine learning in the coming years.https://goo.gl/f36inE
Tim Cook from Apple - "Today, machine learning drives improvement in countless features across our products”. https://goo.gl/ZETMiv
CEO Satya Nadella – at Microsoft’s Ignite conference talked about his vision for how deep learning and AI will transform the company. https://goo.gl/XuIp4H
But Didn’t We Try This Already?
Yes… But AI had overly broad scope
“Intelligent agents, first-order logic, knowledge ontologies, probabilistic reasoning, learning theory, NLP, robotics,…”
Quiz When was the first “AI” conference? 1972? 1985? 1955? 1999? 2001?
Punch cards weren’t even invented in 1955!
What Happened?Cool research but funding was erratic due to lofty goals and missed milestones.
A “boil the ocean” approach
Computing resources weren’t yet capable…
Now they are...
Artificial Intelligence
Machine Learning
Deep Learning
A type of algorithm(s) that allows a machine to emulate aspects of intelligent human behavior
A type of AI that allows a machine to learn from experience/data
A type of ML that uses powerful computing resources and advanced neural networks to more-accurately solve non-linear, highly-dimensional problems with large
amounts of data (eg, vis rec)
Software vs. Humans
Jeopardy2011
Chess 1997 Go 2016
Software vs. Humans
https://research.fb.com/wp-content/uploads/2016/11/deepface-closing-the-gap-to-human-level-performance-in-face-verification.pdf?
Software vs. Humans – It doesn’t stop there
http://www.eetimes.com/author.asp?section_id=36&doc_id=1331264&
New Approaches to Hardware Addresses Dark Silicon
https://drive.google.com/file/d/0Bx4hafXDDq2EMzRNcy1vSUxtcEk/view
At least 15x-30x faster than GPU/CPUs for ML
applications
Why Project Panama (Java API for Native Libs) is Extremely Important!
Who Are the Big Players with Engines/Services?
Popular Java Toolkits (small subset)
Oryx 2VisRec JSR #381¹
How Should a Java Developer Get Started?
Basic Terminology● Machine learning gives "computers the ability to learn without being explicitly
programmed.” https://en.wikipedia.org/wiki/Machine_learning● Data set - set of data that represent specific problem we’re trying to solve● Model - A data structure that consists of various parameters and methods that
transform inputs into outputs. Includes some kind of training procedure.● Training, learning procedure, adjusts model parameters based on the data set
in order to solve/learn specific problem (learn data set)● Performance measure - metric that is used to tell how good model has
learned the data.
Types of Machine Learning● Supervised
● Unsupervised
● Reinforcement
Supervised Learning● Learns from examples that provide inputs and target/desired outputs● It can learn input-output mapping● Learning is based on iteratively feeding inputs into model,
and minimising the error between the actual and target output (cost function)
Linear Regression● Find the line that best fits the relationship between the input
variables (x) and the output variables (y)
● Assumes linear dependency between variables (a simple
straight line) y = slope * x+ intercept ● Example: Estimate number of bugs depending on
development time, number of developers, number of meetings, number of managers in the team, deadline etc.
● For better results remove correlated data and noise● Used for regression problems● What if dependency is not linear?
Image from https://en.wikipedia.org/wiki/Linear_regression
Logistic Regression/Binary Classification● Same as Linear Regression, just fits a data to the
logistic function: y=1/(1+e^-x))● Used for binary classification problems
(spam/not spam)
https://en.wikipedia.org/wiki/Logistic_regression
But what if we don’t assume a type of dependency?
Evolution of Neural Networks● Adaline - Linear Regression● Perceptron - Logistic Regression● Multi Layer Perceptron and Backpropagation - Complex Unknown Function● Convolutional Neural Networks and Deep Learning
Neural network / Deep Learning● Multi Layer Perceptron - a directed
graph in which each unit performs logistic regression.
● Learns using Back Propagation algorithm which is also an error function minimization.
● Can be used for both Classification and Regression problems
● Number of layers/Neurons● Activation Function (Sigmoid, Tanh, ReLU)● Error Function (MSE, CE)
Questions and Comments?Pending JSR #381 - VisRec https://jcp.org/en/jsr/detail?id=381
● Github Repo - https://github.com/sevarac/VisualRecognitionApi● Wiki - https://github.com/sevarac/VisualRecognitionApi/wiki ● Mailing list - https://groups.io/g/visrec/
http://www.tcs.com/SiteCollectionDocuments/White%20Papers/Machine-Learning-Analytics-in-Manufacturing-0714-1.pdf