1 / 34

Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In Python | Edureka

** AI & Deep Learning Training: https://www.edureka.co/ai-deep-learning-with-tensorflow ** ) <br>This Edureka Tutorial on "Keras Tutorial" (Deep Learning Blog Series: https://goo.gl/4zxMfU) provides you a quick and insightful tutorial on the working of Keras along with an interesting use-case! We will be checking out the following topics: <br><br>Agenda: <br>What is Keras? <br>Who makes Keras? <br>Who uses Keras? <br>What Makes Keras special? <br>Working principle of Keras <br>Keras Models <br>Understanding Execution <br>Implementing a Neural Network <br>Use-Case with Keras <br>Coding in Colaboratory <br>Session in a minute <br><br>Check out our Deep Learning blog series: https://bit.ly/2xVIMe1 <br>Check out our complete Youtube playlist here: https://bit.ly/2OhZEpz <br><br>Follow us to never miss an update in the future. <br><br>Instagram: https://www.instagram.com/edureka_learning/ <br>Facebook: https://www.facebook.com/edurekaIN/ <br>Twitter: https://twitter.com/edurekain <br>LinkedIn: https://www.linkedin.com/company/edureka

EdurekaIN
Download Presentation

Keras Tutorial For Beginners | Creating Deep Learning Models Using Keras In Python | Edureka

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  2. Agenda What is Keras? Contributors for Keras Keras Models Implementing a Neural Network Use-Case Summary AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  3. What Is Keras? Official high-level API of TensorFlow! Copyright © 2017, edureka and/or its affiliates. All rights reserved. Copyright © 2018, edureka and/or its affiliates. All rights reserved.

  4. What Is Keras? Deep Learning Library Keras - Modular • High-level Neural Network API • Runs on top of TensorFlow, Theano or CNTK. • Building models is as simple as stacking layers and connecting graphs. High Performance Open Source • Actively developed by contributors across the world! • Good amount of documentation • High performing API used to specify and train differentiable programs. AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  5. Who Makes Keras? Who are the contributors and backers? Copyright © 2018, edureka and/or its affiliates. All rights reserved. AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  6. Who Makes Keras? 4800+ Contributors 250,000 Keras developers > 2x Year-on-year growth Start-ups Good amount of traction AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  7. Who Uses Keras? Let’s check out the industry traction! Copyright © 2018, edureka and/or its affiliates. All rights reserved. AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  8. Industry Traction And more..! AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  9. What Makes Keras Special? Highlights from one of the top Deep Learning libraries! Copyright © 2018, edureka and/or its affiliates. All rights reserved. AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  10. What Makes Keras Special? 6 Fast prototyping Focus on user experience 7 Runs seamlessly on CPU and GPU Large adoption in the industry 8 Freedom to design any architecture Multi-backend, multi-platform 4 9 Research community Simple to get started 5 10 Easy production of models Easy to grasp all concepts AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  11. Keras User Experience Easy to Learn & Easy to Use • More productive • Try more ideas than your competition • Helps you win competitions API Designed for Humans • Keras follows best practices for reducing cognitive load 1 • Offers consistent and simple APIs High Flexibility • Keras integrates with lower-level Deep Learning languages like TensorFlow 3 4 • Implement anything which was built in base language. Not Designed for Machines 2 • Minimizes number of user actions required for common use cases • Provides clear feedback upon user error AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  12. Multi-Backend & Multi-Platform {code} Development Run The Code Producing Models Develop in Python, R • CPU • TF-Serving • GPU acceleration (WebKeras, Keras.js) • Android (TF, TF Lite) • iOS (Native CoreML) • Raspberry Pi Run the code with: • TensorFlow • CNTK • Theano • MXNet • NVIDIA GPU • AMD GPU • TPU • Etc.. 01 02 03 AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  13. Working Principle Of Keras Let’s take a quick look at the basics of Keras’ backend Copyright © 2018, edureka and/or its affiliates. All rights reserved. AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  14. Working Principle – Backend Computational Graphs Expressing complex expressions as a combination of simple operations 01 Useful for calculating derivatives during backpropagation 02 Easier to implement distributed computation 03 Just specify the inputs, outputs and make sure the graph is connected 04 • e = c*d where, “c = a+b” and “d = b+1” • So, e = (a+b)*(b+1) As easy as that! • Here “a” ,“b” are inputs AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  15. Keras Models There are 2 major models that Keras offers! Copyright © 2018, edureka and/or its affiliates. All rights reserved. AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  16. Keras Models Sequential Model • Linear stack of layers • Useful for building simple models • Simple classification network • Encoder – Decoder models • The model we all know and love! • Treat each layer as object that feeds into the next. AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  17. Keras Models Functional Model • Like playing with Lego bricks • Good for 95% of use cases Multi-input, multi-output and arbitrary static graph topologies 01 Multi – input and Multi – output models 02 Complex models which forks into 2 or more branches 03 Models with shared (Weights) layers 04 AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  18. Keras Models Functional Model (Domain Adaption) • Train on Domain A and Test on Domain B • Results in poor performance on test set • The data are from different domains Solution: Adapt the model to both the domains We will be looking at a very interesting use case using the functional model in the upcoming slides AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  19. Understanding Execution There are 2 types of execution! Copyright © 2018, edureka and/or its affiliates. All rights reserved. AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  20. Execution – Two Types Deferred (symbolic) Eager ( imperative) • We use Python to build a computation graph first • Here, the Python runtime is the execution runtime • The compiled graph then gets executed later • It is similar to execution with Numpy On the whole • Symbolic tensors don’t have a value in the Python code (yet) • Eager tensors have a value in the Python code • With eager execution, value-dependent dynamic topologies (tree-RNNs) can be used. AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  21. Implementing a Neural Network There are 5 major steps to implement our own Neural Network with Keras! Copyright © 2018, edureka and/or its affiliates. All rights reserved. AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  22. Implementing A Neural Network 5. Train and Evaluate Model 1. Prepare Input • Preparing the input and specify the input dimension (size) • Train the model based on the training data • Test the model on the dataset with the testing data • Images, videos, text and audio 2. Define the ANN Model • Define the model architecture and build the computational graph 4. Loss Function • Specify the Inputs, Outputs of the computational graph (model) and the Loss function • Sequential or Functional Style 3. Optimizers • MLP, CNN, RNN • MSE, Cross Entropy, Hinge Specify the optimizer and configure the learning process • • SGD, RMSprop, Adam AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  23. Use-Case With Keras Let’s check out an interesting Wine Classifier use-case! Copyright © 2018, edureka and/or its affiliates. All rights reserved. AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  24. Use Case – Problem Statement “Predicting the price of wine with the Keras Functional API and TensorFlow” Building a wide and deep network using Keras (tf.Keras) to predict the price of wine from its description • This problem is well suited for wide & deep learning • It involves text input and there isn’t any correlation between a wine’s description and its price Predict the price of a bottle of wine just from its description and variety? AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  25. Use Case – Model A lot of Keras models are built using the Sequential model API BUT Wide models are models with sparse feature vectors or vectors with mostly zero values Let’s try to solve our use-case with the Functional API The Sequential API is the best way to get started with Keras Because it lets you easily define models as a stack of layers The Functional API allows for more flexibility and is best suited for models with multiple inputs or combined models Multi-layer deep networks do well on tasks like image or speech recognition A good use-case for the Functional API is implementing a wide and deep network in Keras! AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  26. Use Case – Dataset The overall goal is to create a model that can identify the variety, winery and location of a wine based on a description This dataset offers some great opportunities for sentiment analysis and other text related predictive models DATASET Country Region_2 1 7 Description Taster Name 2 8 Taster Twitter Handle Designation 3 9 Title Points 4 10 Variety Price 5 11 Winery Region_1 6 12 AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  27. Use Case – Sample Description: • Powerful vanilla scents rise from the glass, but the fruit, even in this difficult vintage, comes out immediately. • It’s tart and sharp, with a strong herbal component, and the wine snaps into focus quickly with fruit, acid, tannin, herb and vanilla in equal proportion. • Firm and tight, still quite young, this wine needs decanting and/or further bottle age to show its best. Variety: Pinot Noir Prediction: Price — $45 AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  28. Use Case – Prerequisites AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  29. Use Case – Prerequisites Here are all the imports we’ll need to build this model! Test presence of TensorFlow by printing the version Download the data and convert it to a Pandas Data Frame AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  30. Use Case – Let’s See Code! Google Colaboratory AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  31. Session In A Minute What is Keras? Contributors Specialty of Keras Keras Models Implementing a Neural Network Use-Case Implementation AI & Deep Learning Training www.edureka.co/ai-deep-learning-with-tensorflow

  32. Copyright © 2018, edureka and/or its affiliates. All rights reserved.

More Related