SlideShare a Scribd company logo
1 of 22
Download to read offline
1
AUTOMATING WORKFLOWS IN AI PROJECTS
JAIDEV DESHPANDE, SENIOR DATA SCIENTIST /@jaidevd
DEEP LEARNING HAS BECOME CHEAPER*
*NOT CHEAP ENOUGH FOR REPETITIVE MISTAKES
THE BIG IDEA
“FAIL FAST. EITHER DO THE RIGHT THING OR
STOP.”
“WHY DO COMPUTERS STOP AND WHAT CAN BE DONE ABOUT IT?”
JIM GRAY (1985)
4
WHAT’S SUCCESS OR FAILURE IN DEEP LEARNING?
● Neural networks should learn
● Neural networks should learn well
● Neural networks should generalize well
WHAT KEEPS A NETWORK FROM DOING ALL THAT?
● The Fundamental Theorem of Statistical Learning: or the
inherent inseparability of data
● The Bias-Variance tradeoff: The inherent property of
least squares systems that plagues all supervised
learning tasks
● No Free Lunch Theorem: All models are, on average,
equally bad!
6
THE TYPICAL CYCLE
7
THE TYPICAL CYCLE
8
THE TYPICAL CYCLE
INTRODUCING TEST DRIVEN DEEPLEARNING
DEVELOPMENT
10
SANITY CHECKS CAN BE APPLIED TO:
● The training data
○ Well conditioned problem
○ Redundancy or bias / variance in datasets
○ Stratified train/dev splits
● Training heuristics
○ Reasonable optimizers with learning rates
○ Batch sizes
○ Shuffled training samples
● The model architecture
○ Number of layers
○ Layer arrangement and ordering
● Layers
○ Weight initializations
○ Activations
○ Regularization
● Losses & metrics
○ Consistency across epochs
○ Avoidable bias
Don’t bother
training if
too many of
these checks
fail!
11
BOOKKEEPING FOR DEEP LEARNING EXPERIMENTS
● Don’t repeat yourself
● Keep track of metrics across experiments
● Efficient hyperparameter grid search
● Searching for models
● Transfer Learning - you might already have a model for a
given problem, only trained on a different dataset
INTRODUCING KEPLER - A SMART JOURNAL
FOR DEEP LEARNING EXPERIMENTS
HTTPS://GITHUB.COM/JAIDEVD/KEPLER
13
DEEP LEARNING EFFORT
14
KEPLER - A SMART JOURNAL FOR DEEP LEARNING EXPERIMENTS
● Like an IDE, organize models into projects
● Each project has experiments
● An experiment consists of a single training / validation session,
contains
○ Configuration of the model used
○ Basic statistics on the training / validation data like number of features,
samples, etc
○ Error curves
○ Metadata like datetime, path to the related files, etc
● A “check” system (like PEP8) which warns the user at different
stages of the project about various inconsistencies in the model
● A simple search engine for models
● A grid search manager - DRY when doing hyperparameter
search
● A verbose logger that logs all events in all projects
15
SOME OF THE CHECKS IN KEPLER
16
$ cat model.py
import keras
from sklearn.datasets import load_digits
digits = load_digits()
X = digits['data']
y = keras.utils.to_categorical(digits['target'])
model = keras.models.Sequential([
keras.layers.Dense(32, input_shape=(64,)),
keras.layers.Activation('sigmoid'),
keras.layers.Dense(10),
keras.layers.Activation('sigmoid')
])
model.compile(loss='categorical_crossentropy',
optimizer=keras.optimizers.SGD())
$ kepler init
Welcome to Kepler!
$ ipython
>>> from model import *
>>> from kepler import ModelInspector
>>> with ModelInspector(model=model) as mi:
... mi.fit(X, y, epochs=5)
KEPLER EXAMPLES
17
KEPLER EXAMPLES
/Users/jaidevd/src/kepler/kepler/checks.py:51: UserWarning: K102: Training data is not
shuffled. This may slow training down.
warnings.warn(self.code + ": " + self.msg)
/Users/jaidevd/src/kepler/kepler/checks.py:51: UserWarning: K301: Training samples are
correlated. There may be redundancy in the data.
warnings.warn(self.code + ": " + self.msg)
/Users/jaidevd/src/kepler/kepler/checks.py:51: UserWarning: K302: There might be
duplicate training samples.
warnings.warn(self.code + ": " + self.msg)
/Users/jaidevd/src/kepler/kepler/checks.py:51: UserWarning: K303: Training data not
normalized.
warnings.warn(self.code + ": " + self.msg)
Epoch 1/5
1797/1797 [==============================] - 0s 148us/step - loss: 2.3471
Epoch 2/5
1797/1797 [==============================] - 0s 35us/step - loss: 2.2209
Epoch 3/5
1797/1797 [==============================] - 0s 35us/step - loss: 2.1414
Epoch 4/5
1797/1797 [==============================] - 0s 37us/step - loss: 2.0842
Epoch 5/5
1797/1797 [==============================] - 0s 37us/step - loss: 2.0339
18
KEPLER EXAMPLES
$ ipython
>>> from model import *
>>> from kepler import ModelInspector
>>> with ModelInspector(model=model) as mi:
... mi.fit(X, y, epochs=5)
...
There are 1 models similar to this one.
Would you like to see their graphs? [Y/n] : y
Enter location for saving graphs [~/.kepler/models/tf_logs]:
>>>
Graphs written to /Users/jaidevd/.kepler/models/tf_logs
Please point Tensorboard to /Users/jaidevd/.kepler/models/tf_logs
Continue training? [Y/n] : n
>>> exit()
$ tensorboard --logdir ~/.kepler/models/tf_logs
TensorBoard 1.12.0 at http://localhost:6006 (Press CTRL+C to quit)
19
KEPLER EXAMPLES
THE KEPLER PHILOSOPHY
1. RIGOROUSLY INSPECT MODELS AND DETECT
INTERNAL INCONSISTENCIES
2. LOG EVERYTHING
3. DON’T REPEAT YOURSELF
21
TECH DETAILS
● Fully written in Python
● So far, supports only Keras with a Tensorflow backend
● Models are guaranteed remain untouched
● Well tested but not well documented :-(
● Beta release scheduled for Q2 2019
● Bug reports & pull requests welcome!
22
THANK YOU!
/@jaidevd
/@jaidevd
deshpande.jaidev@gmail.com

More Related Content

Recently uploaded

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Featured

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 

Featured (20)

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

Automating AI Workflows

  • 1. 1 AUTOMATING WORKFLOWS IN AI PROJECTS JAIDEV DESHPANDE, SENIOR DATA SCIENTIST /@jaidevd
  • 2. DEEP LEARNING HAS BECOME CHEAPER* *NOT CHEAP ENOUGH FOR REPETITIVE MISTAKES THE BIG IDEA
  • 3. “FAIL FAST. EITHER DO THE RIGHT THING OR STOP.” “WHY DO COMPUTERS STOP AND WHAT CAN BE DONE ABOUT IT?” JIM GRAY (1985)
  • 4. 4 WHAT’S SUCCESS OR FAILURE IN DEEP LEARNING? ● Neural networks should learn ● Neural networks should learn well ● Neural networks should generalize well
  • 5. WHAT KEEPS A NETWORK FROM DOING ALL THAT? ● The Fundamental Theorem of Statistical Learning: or the inherent inseparability of data ● The Bias-Variance tradeoff: The inherent property of least squares systems that plagues all supervised learning tasks ● No Free Lunch Theorem: All models are, on average, equally bad!
  • 9. INTRODUCING TEST DRIVEN DEEPLEARNING DEVELOPMENT
  • 10. 10 SANITY CHECKS CAN BE APPLIED TO: ● The training data ○ Well conditioned problem ○ Redundancy or bias / variance in datasets ○ Stratified train/dev splits ● Training heuristics ○ Reasonable optimizers with learning rates ○ Batch sizes ○ Shuffled training samples ● The model architecture ○ Number of layers ○ Layer arrangement and ordering ● Layers ○ Weight initializations ○ Activations ○ Regularization ● Losses & metrics ○ Consistency across epochs ○ Avoidable bias Don’t bother training if too many of these checks fail!
  • 11. 11 BOOKKEEPING FOR DEEP LEARNING EXPERIMENTS ● Don’t repeat yourself ● Keep track of metrics across experiments ● Efficient hyperparameter grid search ● Searching for models ● Transfer Learning - you might already have a model for a given problem, only trained on a different dataset
  • 12. INTRODUCING KEPLER - A SMART JOURNAL FOR DEEP LEARNING EXPERIMENTS HTTPS://GITHUB.COM/JAIDEVD/KEPLER
  • 14. 14 KEPLER - A SMART JOURNAL FOR DEEP LEARNING EXPERIMENTS ● Like an IDE, organize models into projects ● Each project has experiments ● An experiment consists of a single training / validation session, contains ○ Configuration of the model used ○ Basic statistics on the training / validation data like number of features, samples, etc ○ Error curves ○ Metadata like datetime, path to the related files, etc ● A “check” system (like PEP8) which warns the user at different stages of the project about various inconsistencies in the model ● A simple search engine for models ● A grid search manager - DRY when doing hyperparameter search ● A verbose logger that logs all events in all projects
  • 15. 15 SOME OF THE CHECKS IN KEPLER
  • 16. 16 $ cat model.py import keras from sklearn.datasets import load_digits digits = load_digits() X = digits['data'] y = keras.utils.to_categorical(digits['target']) model = keras.models.Sequential([ keras.layers.Dense(32, input_shape=(64,)), keras.layers.Activation('sigmoid'), keras.layers.Dense(10), keras.layers.Activation('sigmoid') ]) model.compile(loss='categorical_crossentropy', optimizer=keras.optimizers.SGD()) $ kepler init Welcome to Kepler! $ ipython >>> from model import * >>> from kepler import ModelInspector >>> with ModelInspector(model=model) as mi: ... mi.fit(X, y, epochs=5) KEPLER EXAMPLES
  • 17. 17 KEPLER EXAMPLES /Users/jaidevd/src/kepler/kepler/checks.py:51: UserWarning: K102: Training data is not shuffled. This may slow training down. warnings.warn(self.code + ": " + self.msg) /Users/jaidevd/src/kepler/kepler/checks.py:51: UserWarning: K301: Training samples are correlated. There may be redundancy in the data. warnings.warn(self.code + ": " + self.msg) /Users/jaidevd/src/kepler/kepler/checks.py:51: UserWarning: K302: There might be duplicate training samples. warnings.warn(self.code + ": " + self.msg) /Users/jaidevd/src/kepler/kepler/checks.py:51: UserWarning: K303: Training data not normalized. warnings.warn(self.code + ": " + self.msg) Epoch 1/5 1797/1797 [==============================] - 0s 148us/step - loss: 2.3471 Epoch 2/5 1797/1797 [==============================] - 0s 35us/step - loss: 2.2209 Epoch 3/5 1797/1797 [==============================] - 0s 35us/step - loss: 2.1414 Epoch 4/5 1797/1797 [==============================] - 0s 37us/step - loss: 2.0842 Epoch 5/5 1797/1797 [==============================] - 0s 37us/step - loss: 2.0339
  • 18. 18 KEPLER EXAMPLES $ ipython >>> from model import * >>> from kepler import ModelInspector >>> with ModelInspector(model=model) as mi: ... mi.fit(X, y, epochs=5) ... There are 1 models similar to this one. Would you like to see their graphs? [Y/n] : y Enter location for saving graphs [~/.kepler/models/tf_logs]: >>> Graphs written to /Users/jaidevd/.kepler/models/tf_logs Please point Tensorboard to /Users/jaidevd/.kepler/models/tf_logs Continue training? [Y/n] : n >>> exit() $ tensorboard --logdir ~/.kepler/models/tf_logs TensorBoard 1.12.0 at http://localhost:6006 (Press CTRL+C to quit)
  • 20. THE KEPLER PHILOSOPHY 1. RIGOROUSLY INSPECT MODELS AND DETECT INTERNAL INCONSISTENCIES 2. LOG EVERYTHING 3. DON’T REPEAT YOURSELF
  • 21. 21 TECH DETAILS ● Fully written in Python ● So far, supports only Keras with a Tensorflow backend ● Models are guaranteed remain untouched ● Well tested but not well documented :-( ● Beta release scheduled for Q2 2019 ● Bug reports & pull requests welcome!