SlideShare una empresa de Scribd logo
1 de 28
Descargar para leer sin conexión
Nov 18, 2017
Sofia
var title = “Machine Learning with JS”;
var info = {
name: “Ivelin Andreev”,
otherOptional: “Demistifying ML and
Bringing it to the Browser”
};
Nov 18, 2017
agenda();
• Why ML with JavaScript?
• JavaScript on the ML Map?
• Introduction to Machine Learning
• Introduction to Neural Networks
• Computer Vision with DNN
• JavaScript ML libraries
• Demo (DeepLearn.js)
Nov 18, 2017
Software Architect @
15 years professional experience
.NET Web Development MCPD
External Expert Horizon 2020
External Expert Eurostars-Eureka & IFD
Business Interests
Web Development, SOA, Integration
Security & Performance Optimization
IoT, Computer Intelligence
Contact
ivelin.andreev@icb.bg
www.linkedin.com/in/ivelin
www.slideshare.net/ivoandreev
Who is in front of you?
Nov 18, 2017
ML could be used for …
• Predictive maintenance
• Is it likely that the machine will break?
• Based on sensor readings
• Forest fire prediction
• Is it likely that a fire will start
• Based on environment parameters
• Automated teller machine replenishment
• How to optimize ATM replenishment
• Based on historical data for transactions?
• Spear phishing identification
• Is a web site likely to be phishing
• Based on URL and HTTP response
Nov 18, 2017
Why ML in the Browser?
• It is possible 
• You feel comfortable with JS
• You want to operate offline
• You want to avoid installing on customer computer
• Customers are paranoiac about sending data to a cloud
The Downside…
• JS is a dependency mess
o left-pad in 2016
o OWASP recommend inspection of
dependencies
Nov 18, 2017
Main ML Market Players
Azure ML BigML Amazon ML Google
Prediction
IBM Watson ML
Flexibility High High Low Low Low
Usability High Med High Low High
Training time Low Low High Med High
Accuracy (AUC) High High High Med High
Cloud/
On-premises
+/- +/+ +/- +/- +/-
Algorithms Classification
Regression
Clustering
Anomaly detect
Recommendations
Classification
Regression
Clustering
Anomaly
Recommend
Classification
Regression
Classification
Regression
Semantic mining
Hypothesis rank
Regression
Customizations Model parameters
R-script
Evaluation support
Own models
C#, R, Node.js
Few parameters
Nov 18, 2017
Pricing?
Azure ML BigML Amazon ML Google
Prediction
IBM Watson
ML
Model Building $1.00 / h
$10.00 / user / month
$30 - $10’000
/ month
$0.42 / h $0.002 / MB $0.45 / h
$10.00 / service
Retraining
(per 1000)
$0.50 - N/A $0.05 -
Prediction
(per 1000)
$0.50 - $0.10 $0.50 $0.50
Compute
(per hour)
$2.00 - $0.42 - -
Free Usage 1’000 / month
2h compute
Dataset Size
Max 16MB
N/A 10’000/month 5’000 / month
5h compute
Notes Private
deployment
$55’000 / year
Shutdown
April 30, 2018
Cloud ML Engine
(TensorFlow)
Nov 18, 2017
ML is not Black Magic
Nov 18, 2017
Do you need Math to work with ML?
• Answer: It is not required, but would definitely help 
• Data Science is what is really necessary
Processes and methods for extracting relations and knowledge from data
• Working around Math
• Select the right algorithm
• Use cheat-sheets instead
• Choose parameter settings
• Experiment
• Use parameter-sweep
• Identify underfitting and overfitting
• Compare training and validation scores
Nov 18, 2017
I selected an appropriate
ML algorithm but…
why my ML model fails?
Nov 18, 2017
ML Decision Tree
Is it an ML task?
No, use another
solution
Is it correctML
scenario?
No, try another
scenario
Is suitable model
identified?
Do you have
enough data?
Is the model overly
complicated?
Correctfeatures
used?
Performed feature
engineering?
Proper evaluation
metrics?
Good evaluation
set?
Nov 18, 2017
Neural Networks &
Deep Learning
• Neural-Networks are
considereduniversal
function approximators
• They can compute and
learn any function
Nov 18, 2017
• Human vision
o Start percepting light
o Light transferred to electro-chem signals
o Brain neural networks are activated (thinking, memories, feelings)
o Low level patterns recognized (nose, eyes, ears)
o Combined in higher order patterns (animal, fish, male/female)
o Classification - labeling the subject in words (dog, cat, trout)
• Computer Vision
o How do you do that for a computer?
o What are ears and how to describe them?
o How they look from different angles?
• DNN key use is as Classifiers
• Feature extraction - pattern recognition
How Computer Vision Works
Nov 18, 2017
Neural Network Architecture
• Nodes, organized in layers, with weighted connections
o Acyclic directed graph
• Layers
o Input (1), Output (1)
o Shallow - 1 hidden layer
o Deep – multiple hidden layers
• Artificial Neuron Model
Nov 18, 2017
DNN Training
• 5-stage Process of Supervised Training
o Create a training dataset (X)
o Feed data X to DNN model
o Determine loss (difference between target and predictions)
o Optimize and calculate loss gradient (how fast we are moving towards target)
o Adjust weights of DNN
Nov 18, 2017
Artificial Neuron Activation
• Calculates weighted sum of inputs
• Adds bias (function shift)
• Decides whether it shall be
activated
Natural Questions
• Why do we have so many?
• Why some work better than other?
• Which one to use ?
Nov 18, 2017
Activation Functions
• Goal
• Convert input -> output signal
• Output signal is input to next layer
• Approximate target function faster
• Samples
• ReLu, PReLu – good to start with
• TanH and Sigmoid – outdated
• Softmax – output layer, classification
• Linear func – output layer,
regression
Nov 18, 2017
How does a CNN work?
• Convolution
• Non-Linearity (i.e. PReLU)
• Pooling (Downsample)
• Fully connected (Classify)
• Dropout (Overfitting prevention)
Convolution PoolingEdge detect
filter
Nov 18, 2017
Оne stands out …
• DeepLearn.js
JavaScript Libraries for ML
Discontinued
• ConvNet.js
• Machine_Learning
Actively Maintained
• Synaptic.js
• ml.js
• Neataptic.js
• Tensor Fire
Nov 18, 2017
Deeplearn.js
• Announced August 11th, 2017 by
• WebGL optimized JS library for ML running in browser
• Open source library in TypeScript
• Can train models and run pre-trained model
• API mimics
• Runs only on Google Chrome
• Future improvements
o Import trained models from Tensorflow
o Add support from other browsers
Nov 18, 2017
Tensors
• Math object from Linear Algebra
• Universal standard of modern ML
o General format that could be used for any data
• Examples
o A single image is 3D tensor
o An array of images 4D tensor (samples, width, heights, rgb)
• What is the size as a tensor for 1 min FHD video?
o 60sec*25FPS*1920W*1280H*3RGB = 10.5 GB
o 1000 videos require data reduction
Nov 18, 2017
DeepLearn.js Terms
• Tensor Type (int, float)
o float32 only supported
• Tensor Shape
o Size of dimension
• Tensor Rank
o Number of dimensions
• Graph – represents the target calculations
• Session – contains training runtime state
• Tensor data types
o Tensor – reference to Graph object with the properties above
o NDArray – internal implementation that supports GPU via textures
o number[] – JavaScript array to input to DeepLearn.js (interoperability)
Tensor Type Shape Rank
Scalar: 3.0 float [] 0
Vector: (1, 5, -2) int [3] 1
2x2 Matrix int [2, 2] 2
Nov 18, 2017
Avoiding Performance Issues
• Blocking UI Thread
WebGLRenderingContext.readPixels()
o WebGL downloads NDArrays from texture to the CPU
o UI thread is blocked while waiting GPU to finish execution
NDArray.data() returns promise<Float32Array>
o Calls readPixels() when the GPU process has completed
• Memory Leaks
o When WebGL textures go out of scope, they don’t get cleaned up
o NDArray must be manually disposed later
o Texture memory leaks cause serious performance issues
const math = new NDArrayMathGPU();
math.scope((keep, track) => { //Function closure declaration
const b = Scalar.new(3); //Texture leak. Math does not know about “b”
const a = track(Scalar.new(3)); //CORRECT
});
Nov 18, 2017
Understanding the Demo
Nov 18, 2017
The Datasets
MNIST
• A series of handwritten numbers
• 60’000 labeled images
• 28px*28px*1color (grey scale)
• Standard training DS
• >99% accuracy could be achieved
Fashion MNIST
CIFAR-10
Nov 18, 2017
Optimization Functions
• Determine how fast algorithm converges to goal while
learning properly.
• Minimize the loss function
• 1st order functions
o SGD, Momentum
o Adagrad, Adadelta, Adam
• 2nd order functions
o More sensitive
o Slower to compute
o Rarely used in practice
A good optimization algorithm makes the difference
between good results in minutes, hours, and days.
Nov 18, 2017
Takeaways
• Machine Learning
o Evaluating model performance
o ML algorithms by use case
• Artificial Neural Networks
o Intuitive Explanation of Convolutional Neural Networks
o Stanford Lectures on Convolutional Neural Networks
o Biginners guide to Convolutional Neural Networks
o Understanding activation functions
o Activation functions, which is better
• Deeplearn.js
o API Reference
Nov 18, 2017
Thanks to our Sponsors:
General Sponsor:
Gold Sponsors:
Technological Partner:
Hosting Partner:
In-Kind Partner:
Silver Sponsors:

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Utilizing additional information in factorization methods (research overview,...
Utilizing additional information in factorization methods (research overview,...Utilizing additional information in factorization methods (research overview,...
Utilizing additional information in factorization methods (research overview,...
 
Automatic machine learning (AutoML) 101
Automatic machine learning (AutoML) 101Automatic machine learning (AutoML) 101
Automatic machine learning (AutoML) 101
 
Strata London - Deep Learning 05-2015
Strata London - Deep Learning 05-2015Strata London - Deep Learning 05-2015
Strata London - Deep Learning 05-2015
 
Online Machine Learning: introduction and examples
Online Machine Learning:  introduction and examplesOnline Machine Learning:  introduction and examples
Online Machine Learning: introduction and examples
 
MLlib and Machine Learning on Spark
MLlib and Machine Learning on SparkMLlib and Machine Learning on Spark
MLlib and Machine Learning on Spark
 
Azure Machine Learning
Azure Machine LearningAzure Machine Learning
Azure Machine Learning
 
Generative Models for General Audiences
Generative Models for General AudiencesGenerative Models for General Audiences
Generative Models for General Audiences
 
COCOA: Communication-Efficient Coordinate Ascent
COCOA: Communication-Efficient Coordinate AscentCOCOA: Communication-Efficient Coordinate Ascent
COCOA: Communication-Efficient Coordinate Ascent
 
Deep Learning Introduction - WeCloudData
Deep Learning Introduction - WeCloudDataDeep Learning Introduction - WeCloudData
Deep Learning Introduction - WeCloudData
 
Machine Learning: An introduction โดย รศ.ดร.สุรพงค์ เอื้อวัฒนามงคล
Machine Learning: An introduction โดย รศ.ดร.สุรพงค์  เอื้อวัฒนามงคลMachine Learning: An introduction โดย รศ.ดร.สุรพงค์  เอื้อวัฒนามงคล
Machine Learning: An introduction โดย รศ.ดร.สุรพงค์ เอื้อวัฒนามงคล
 
Feature Engineering - Getting most out of data for predictive models - TDC 2017
Feature Engineering - Getting most out of data for predictive models - TDC 2017Feature Engineering - Getting most out of data for predictive models - TDC 2017
Feature Engineering - Getting most out of data for predictive models - TDC 2017
 
Automated Machine Learning (Auto ML)
Automated Machine Learning (Auto ML)Automated Machine Learning (Auto ML)
Automated Machine Learning (Auto ML)
 
Face recognition and deep learning โดย ดร. สรรพฤทธิ์ มฤคทัต NECTEC
Face recognition and deep learning  โดย ดร. สรรพฤทธิ์ มฤคทัต NECTECFace recognition and deep learning  โดย ดร. สรรพฤทธิ์ มฤคทัต NECTEC
Face recognition and deep learning โดย ดร. สรรพฤทธิ์ มฤคทัต NECTEC
 
Machine Learning for (JVM) Developers
Machine Learning for (JVM) DevelopersMachine Learning for (JVM) Developers
Machine Learning for (JVM) Developers
 
AutoML lectures (ACDL 2019)
AutoML lectures (ACDL 2019)AutoML lectures (ACDL 2019)
AutoML lectures (ACDL 2019)
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Le Machine Learning de A à Z
Le Machine Learning de A à ZLe Machine Learning de A à Z
Le Machine Learning de A à Z
 
Data exploration validation and sanitization
Data exploration validation and sanitizationData exploration validation and sanitization
Data exploration validation and sanitization
 
Evolving a Medical Image Similarity Search
Evolving a Medical Image Similarity SearchEvolving a Medical Image Similarity Search
Evolving a Medical Image Similarity Search
 
QBIC
QBICQBIC
QBIC
 

Similar a Machine Learning with JavaScript

Slides galvin-widjaja
Slides galvin-widjajaSlides galvin-widjaja
Slides galvin-widjaja
CodePolitan
 
"Performing Multiple Perceptual Tasks With a Single Deep Neural Network," a P...
"Performing Multiple Perceptual Tasks With a Single Deep Neural Network," a P..."Performing Multiple Perceptual Tasks With a Single Deep Neural Network," a P...
"Performing Multiple Perceptual Tasks With a Single Deep Neural Network," a P...
Edge AI and Vision Alliance
 
Big Data in 200 km/h | AWS Big Data Demystified #1.3
Big Data in 200 km/h | AWS Big Data Demystified #1.3  Big Data in 200 km/h | AWS Big Data Demystified #1.3
Big Data in 200 km/h | AWS Big Data Demystified #1.3
Omid Vahdaty
 

Similar a Machine Learning with JavaScript (20)

Joker'14 Java as a fundamental working tool of the Data Scientist
Joker'14 Java as a fundamental working tool of the Data ScientistJoker'14 Java as a fundamental working tool of the Data Scientist
Joker'14 Java as a fundamental working tool of the Data Scientist
 
Designing Artificial Intelligence
Designing Artificial IntelligenceDesigning Artificial Intelligence
Designing Artificial Intelligence
 
Prepare your data for machine learning
Prepare your data for machine learningPrepare your data for machine learning
Prepare your data for machine learning
 
The Data Science Process - Do we need it and how to apply?
The Data Science Process - Do we need it and how to apply?The Data Science Process - Do we need it and how to apply?
The Data Science Process - Do we need it and how to apply?
 
Artificial Intelligence in practice - Gerbert Kaandorp - Codemotion Amsterdam...
Artificial Intelligence in practice - Gerbert Kaandorp - Codemotion Amsterdam...Artificial Intelligence in practice - Gerbert Kaandorp - Codemotion Amsterdam...
Artificial Intelligence in practice - Gerbert Kaandorp - Codemotion Amsterdam...
 
AWS Summit 2013 | India - Big Data Analytics, Abhishek Sinha
AWS Summit 2013 | India - Big Data Analytics, Abhishek SinhaAWS Summit 2013 | India - Big Data Analytics, Abhishek Sinha
AWS Summit 2013 | India - Big Data Analytics, Abhishek Sinha
 
A Look at TensorFlow.js
A Look at TensorFlow.jsA Look at TensorFlow.js
A Look at TensorFlow.js
 
Slides galvin-widjaja
Slides galvin-widjajaSlides galvin-widjaja
Slides galvin-widjaja
 
"Performing Multiple Perceptual Tasks With a Single Deep Neural Network," a P...
"Performing Multiple Perceptual Tasks With a Single Deep Neural Network," a P..."Performing Multiple Perceptual Tasks With a Single Deep Neural Network," a P...
"Performing Multiple Perceptual Tasks With a Single Deep Neural Network," a P...
 
Big Data in 200 km/h | AWS Big Data Demystified #1.3
Big Data in 200 km/h | AWS Big Data Demystified #1.3  Big Data in 200 km/h | AWS Big Data Demystified #1.3
Big Data in 200 km/h | AWS Big Data Demystified #1.3
 
Deep Learning Applications to Satellite Imagery
Deep Learning Applications to Satellite ImageryDeep Learning Applications to Satellite Imagery
Deep Learning Applications to Satellite Imagery
 
DLD meetup 2017, Efficient Deep Learning
DLD meetup 2017, Efficient Deep LearningDLD meetup 2017, Efficient Deep Learning
DLD meetup 2017, Efficient Deep Learning
 
The Frontier of Deep Learning in 2020 and Beyond
The Frontier of Deep Learning in 2020 and BeyondThe Frontier of Deep Learning in 2020 and Beyond
The Frontier of Deep Learning in 2020 and Beyond
 
Neural networks with python
Neural networks with pythonNeural networks with python
Neural networks with python
 
Using Deep Learning to do Real-Time Scoring in Practical Applications - 2015-...
Using Deep Learning to do Real-Time Scoring in Practical Applications - 2015-...Using Deep Learning to do Real-Time Scoring in Practical Applications - 2015-...
Using Deep Learning to do Real-Time Scoring in Practical Applications - 2015-...
 
Monitoring Big Data Systems - "The Simple Way"
Monitoring Big Data Systems - "The Simple Way"Monitoring Big Data Systems - "The Simple Way"
Monitoring Big Data Systems - "The Simple Way"
 
Readinggroup xiang 24112016
Readinggroup xiang 24112016Readinggroup xiang 24112016
Readinggroup xiang 24112016
 
Chainer OpenPOWER developer congress HandsON 20170522_ota
Chainer OpenPOWER developer congress HandsON 20170522_otaChainer OpenPOWER developer congress HandsON 20170522_ota
Chainer OpenPOWER developer congress HandsON 20170522_ota
 
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech TalksA Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
 
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech TalksA Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
A Deeper Dive into Apache MXNet - March 2017 AWS Online Tech Talks
 

Más de Ivo Andreev

Más de Ivo Andreev (20)

Cybersecurity and Generative AI - for Good and Bad vol.2
Cybersecurity and Generative AI - for Good and Bad vol.2Cybersecurity and Generative AI - for Good and Bad vol.2
Cybersecurity and Generative AI - for Good and Bad vol.2
 
Architecting AI Solutions in Azure for Business
Architecting AI Solutions in Azure for BusinessArchitecting AI Solutions in Azure for Business
Architecting AI Solutions in Azure for Business
 
Cybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and BadCybersecurity Challenges with Generative AI - for Good and Bad
Cybersecurity Challenges with Generative AI - for Good and Bad
 
JS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AIJS-Experts - Cybersecurity for Generative AI
JS-Experts - Cybersecurity for Generative AI
 
How do OpenAI GPT Models Work - Misconceptions and Tips for Developers
How do OpenAI GPT Models Work - Misconceptions and Tips for DevelopersHow do OpenAI GPT Models Work - Misconceptions and Tips for Developers
How do OpenAI GPT Models Work - Misconceptions and Tips for Developers
 
OpenAI GPT in Depth - Questions and Misconceptions
OpenAI GPT in Depth - Questions and MisconceptionsOpenAI GPT in Depth - Questions and Misconceptions
OpenAI GPT in Depth - Questions and Misconceptions
 
Cutting Edge Computer Vision for Everyone
Cutting Edge Computer Vision for EveryoneCutting Edge Computer Vision for Everyone
Cutting Edge Computer Vision for Everyone
 
Collecting and Analysing Spaceborn Data
Collecting and Analysing Spaceborn DataCollecting and Analysing Spaceborn Data
Collecting and Analysing Spaceborn Data
 
Collecting and Analysing Satellite Data with Azure Orbital
Collecting and Analysing Satellite Data with Azure OrbitalCollecting and Analysing Satellite Data with Azure Orbital
Collecting and Analysing Satellite Data with Azure Orbital
 
Language Studio and Custom Models
Language Studio and Custom ModelsLanguage Studio and Custom Models
Language Studio and Custom Models
 
CosmosDB for IoT Scenarios
CosmosDB for IoT ScenariosCosmosDB for IoT Scenarios
CosmosDB for IoT Scenarios
 
Forecasting time series powerful and simple
Forecasting time series powerful and simpleForecasting time series powerful and simple
Forecasting time series powerful and simple
 
Azure security guidelines for developers
Azure security guidelines for developers Azure security guidelines for developers
Azure security guidelines for developers
 
Autonomous Machines with Project Bonsai
Autonomous Machines with Project BonsaiAutonomous Machines with Project Bonsai
Autonomous Machines with Project Bonsai
 
Global azure virtual 2021 - Azure Lighthouse
Global azure virtual 2021 - Azure LighthouseGlobal azure virtual 2021 - Azure Lighthouse
Global azure virtual 2021 - Azure Lighthouse
 
Flux QL - Nexgen Management of Time Series Inspired by JS
Flux QL - Nexgen Management of Time Series Inspired by JSFlux QL - Nexgen Management of Time Series Inspired by JS
Flux QL - Nexgen Management of Time Series Inspired by JS
 
Azure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challengesAzure architecture design patterns - proven solutions to common challenges
Azure architecture design patterns - proven solutions to common challenges
 
Industrial IoT on Azure
Industrial IoT on AzureIndustrial IoT on Azure
Industrial IoT on Azure
 
The Power of Auto ML and How Does it Work
The Power of Auto ML and How Does it WorkThe Power of Auto ML and How Does it Work
The Power of Auto ML and How Does it Work
 
Flying a Drone with JavaScript and Computer Vision
Flying a Drone with JavaScript and Computer VisionFlying a Drone with JavaScript and Computer Vision
Flying a Drone with JavaScript and Computer Vision
 

Último

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Último (20)

The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 

Machine Learning with JavaScript

  • 1. Nov 18, 2017 Sofia var title = “Machine Learning with JS”; var info = { name: “Ivelin Andreev”, otherOptional: “Demistifying ML and Bringing it to the Browser” };
  • 2. Nov 18, 2017 agenda(); • Why ML with JavaScript? • JavaScript on the ML Map? • Introduction to Machine Learning • Introduction to Neural Networks • Computer Vision with DNN • JavaScript ML libraries • Demo (DeepLearn.js)
  • 3. Nov 18, 2017 Software Architect @ 15 years professional experience .NET Web Development MCPD External Expert Horizon 2020 External Expert Eurostars-Eureka & IFD Business Interests Web Development, SOA, Integration Security & Performance Optimization IoT, Computer Intelligence Contact ivelin.andreev@icb.bg www.linkedin.com/in/ivelin www.slideshare.net/ivoandreev Who is in front of you?
  • 4. Nov 18, 2017 ML could be used for … • Predictive maintenance • Is it likely that the machine will break? • Based on sensor readings • Forest fire prediction • Is it likely that a fire will start • Based on environment parameters • Automated teller machine replenishment • How to optimize ATM replenishment • Based on historical data for transactions? • Spear phishing identification • Is a web site likely to be phishing • Based on URL and HTTP response
  • 5. Nov 18, 2017 Why ML in the Browser? • It is possible  • You feel comfortable with JS • You want to operate offline • You want to avoid installing on customer computer • Customers are paranoiac about sending data to a cloud The Downside… • JS is a dependency mess o left-pad in 2016 o OWASP recommend inspection of dependencies
  • 6. Nov 18, 2017 Main ML Market Players Azure ML BigML Amazon ML Google Prediction IBM Watson ML Flexibility High High Low Low Low Usability High Med High Low High Training time Low Low High Med High Accuracy (AUC) High High High Med High Cloud/ On-premises +/- +/+ +/- +/- +/- Algorithms Classification Regression Clustering Anomaly detect Recommendations Classification Regression Clustering Anomaly Recommend Classification Regression Classification Regression Semantic mining Hypothesis rank Regression Customizations Model parameters R-script Evaluation support Own models C#, R, Node.js Few parameters
  • 7. Nov 18, 2017 Pricing? Azure ML BigML Amazon ML Google Prediction IBM Watson ML Model Building $1.00 / h $10.00 / user / month $30 - $10’000 / month $0.42 / h $0.002 / MB $0.45 / h $10.00 / service Retraining (per 1000) $0.50 - N/A $0.05 - Prediction (per 1000) $0.50 - $0.10 $0.50 $0.50 Compute (per hour) $2.00 - $0.42 - - Free Usage 1’000 / month 2h compute Dataset Size Max 16MB N/A 10’000/month 5’000 / month 5h compute Notes Private deployment $55’000 / year Shutdown April 30, 2018 Cloud ML Engine (TensorFlow)
  • 8. Nov 18, 2017 ML is not Black Magic
  • 9. Nov 18, 2017 Do you need Math to work with ML? • Answer: It is not required, but would definitely help  • Data Science is what is really necessary Processes and methods for extracting relations and knowledge from data • Working around Math • Select the right algorithm • Use cheat-sheets instead • Choose parameter settings • Experiment • Use parameter-sweep • Identify underfitting and overfitting • Compare training and validation scores
  • 10. Nov 18, 2017 I selected an appropriate ML algorithm but… why my ML model fails?
  • 11. Nov 18, 2017 ML Decision Tree Is it an ML task? No, use another solution Is it correctML scenario? No, try another scenario Is suitable model identified? Do you have enough data? Is the model overly complicated? Correctfeatures used? Performed feature engineering? Proper evaluation metrics? Good evaluation set?
  • 12. Nov 18, 2017 Neural Networks & Deep Learning • Neural-Networks are considereduniversal function approximators • They can compute and learn any function
  • 13. Nov 18, 2017 • Human vision o Start percepting light o Light transferred to electro-chem signals o Brain neural networks are activated (thinking, memories, feelings) o Low level patterns recognized (nose, eyes, ears) o Combined in higher order patterns (animal, fish, male/female) o Classification - labeling the subject in words (dog, cat, trout) • Computer Vision o How do you do that for a computer? o What are ears and how to describe them? o How they look from different angles? • DNN key use is as Classifiers • Feature extraction - pattern recognition How Computer Vision Works
  • 14. Nov 18, 2017 Neural Network Architecture • Nodes, organized in layers, with weighted connections o Acyclic directed graph • Layers o Input (1), Output (1) o Shallow - 1 hidden layer o Deep – multiple hidden layers • Artificial Neuron Model
  • 15. Nov 18, 2017 DNN Training • 5-stage Process of Supervised Training o Create a training dataset (X) o Feed data X to DNN model o Determine loss (difference between target and predictions) o Optimize and calculate loss gradient (how fast we are moving towards target) o Adjust weights of DNN
  • 16. Nov 18, 2017 Artificial Neuron Activation • Calculates weighted sum of inputs • Adds bias (function shift) • Decides whether it shall be activated Natural Questions • Why do we have so many? • Why some work better than other? • Which one to use ?
  • 17. Nov 18, 2017 Activation Functions • Goal • Convert input -> output signal • Output signal is input to next layer • Approximate target function faster • Samples • ReLu, PReLu – good to start with • TanH and Sigmoid – outdated • Softmax – output layer, classification • Linear func – output layer, regression
  • 18. Nov 18, 2017 How does a CNN work? • Convolution • Non-Linearity (i.e. PReLU) • Pooling (Downsample) • Fully connected (Classify) • Dropout (Overfitting prevention) Convolution PoolingEdge detect filter
  • 19. Nov 18, 2017 Оne stands out … • DeepLearn.js JavaScript Libraries for ML Discontinued • ConvNet.js • Machine_Learning Actively Maintained • Synaptic.js • ml.js • Neataptic.js • Tensor Fire
  • 20. Nov 18, 2017 Deeplearn.js • Announced August 11th, 2017 by • WebGL optimized JS library for ML running in browser • Open source library in TypeScript • Can train models and run pre-trained model • API mimics • Runs only on Google Chrome • Future improvements o Import trained models from Tensorflow o Add support from other browsers
  • 21. Nov 18, 2017 Tensors • Math object from Linear Algebra • Universal standard of modern ML o General format that could be used for any data • Examples o A single image is 3D tensor o An array of images 4D tensor (samples, width, heights, rgb) • What is the size as a tensor for 1 min FHD video? o 60sec*25FPS*1920W*1280H*3RGB = 10.5 GB o 1000 videos require data reduction
  • 22. Nov 18, 2017 DeepLearn.js Terms • Tensor Type (int, float) o float32 only supported • Tensor Shape o Size of dimension • Tensor Rank o Number of dimensions • Graph – represents the target calculations • Session – contains training runtime state • Tensor data types o Tensor – reference to Graph object with the properties above o NDArray – internal implementation that supports GPU via textures o number[] – JavaScript array to input to DeepLearn.js (interoperability) Tensor Type Shape Rank Scalar: 3.0 float [] 0 Vector: (1, 5, -2) int [3] 1 2x2 Matrix int [2, 2] 2
  • 23. Nov 18, 2017 Avoiding Performance Issues • Blocking UI Thread WebGLRenderingContext.readPixels() o WebGL downloads NDArrays from texture to the CPU o UI thread is blocked while waiting GPU to finish execution NDArray.data() returns promise<Float32Array> o Calls readPixels() when the GPU process has completed • Memory Leaks o When WebGL textures go out of scope, they don’t get cleaned up o NDArray must be manually disposed later o Texture memory leaks cause serious performance issues const math = new NDArrayMathGPU(); math.scope((keep, track) => { //Function closure declaration const b = Scalar.new(3); //Texture leak. Math does not know about “b” const a = track(Scalar.new(3)); //CORRECT });
  • 25. Nov 18, 2017 The Datasets MNIST • A series of handwritten numbers • 60’000 labeled images • 28px*28px*1color (grey scale) • Standard training DS • >99% accuracy could be achieved Fashion MNIST CIFAR-10
  • 26. Nov 18, 2017 Optimization Functions • Determine how fast algorithm converges to goal while learning properly. • Minimize the loss function • 1st order functions o SGD, Momentum o Adagrad, Adadelta, Adam • 2nd order functions o More sensitive o Slower to compute o Rarely used in practice A good optimization algorithm makes the difference between good results in minutes, hours, and days.
  • 27. Nov 18, 2017 Takeaways • Machine Learning o Evaluating model performance o ML algorithms by use case • Artificial Neural Networks o Intuitive Explanation of Convolutional Neural Networks o Stanford Lectures on Convolutional Neural Networks o Biginners guide to Convolutional Neural Networks o Understanding activation functions o Activation functions, which is better • Deeplearn.js o API Reference
  • 28. Nov 18, 2017 Thanks to our Sponsors: General Sponsor: Gold Sponsors: Technological Partner: Hosting Partner: In-Kind Partner: Silver Sponsors: