Auto-Keras, or How You can Create a Deep Learning Model in 4 Lines of Code

Auto-Keras is an open source software library for automated machine learning. Auto-Keras provides functions to automatically search for architecture and hyperparameters of deep learning models.
By Favio Vazquez, Principal
c
comments

Automated machine learning is the new kid in town, and it’s here to stay. It is helping us create better and better models with easy to use and great API’s. Here I’ll talk to you about Auto-Keras, the new package for AutoML with Keras. There’s a surprise in the end ;).

Before starting, a great quote by Matthew Mayo about what AutoML is not:

AutoML is not automated

Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano. It was developed with a focus on enabling fast experimentation. Being able to go from idea to result with the least possible delay is key to doing good research.

This was created by François Chollet and was the first serious step for making Deep Learning easy for the masses.

TensorFlow has a Python API which is not that hard, but Keras made really easy to get into Deep Learning for lots of people. It should be noted that Keras is now officially a part of Tensorflow:

Module: tf.contrib.keras | TensorFlow

Great. Now we know what is Keras and AutoML, let’s combine them. Auto-Keras is an open source software library for automated machine learning. Auto-Keras provides functions to automatically search for architecture and hyperparameters of deep learning models.

 
Installation

pip install autokeras


 
Usage

For the usage I’m going to use an example they have on their web. But first let’s compare how we can do the same with different tools. I’ll use the famous and sometimes hated MNIST dataset.

MNIST is a simple computer vision dataset. It consists of images of handwritten digits like these:

It also includes labels for each image, telling us which digit it is.

 
MNIST on TensorFlow using Eager execution:

Resources:

  • tensorflow/models - Models and examples built with TensorFlow
  • Eager Execution | TensorFlow - While eager execution makes development and debugging more interactive, TensorFlow graph execution has advantages for…

Not so easy, but very well explained in the example. TensorFlow is not meant to be the easiest tool for deep learning, but a fast an reliable one. With eager execution the code is much more readable.

 
MNIST with PyTorch:

Resources:

  • pytorch/examples - A set of examples around pytorch in Vision, Text, Reinforcement Learning, etc.

 
MNIST with Keras:

Resources:

  • keras-team/keras - Deep Learning for humans

You can see that until now the Keras is the simpler package for running this example. It’s a great package with awesome features to got from zero to a model in just minutes.

But now, the cherry on the cake.

 
MNIST with Auto-Keras:

Yep, that is all. Pretty simple right? You just need an ImageClassifier, then fit the data and evaluate it. You have a final_fit there too, and it’s running a final training after found the best architecture.

For now you have the ImageClassifier, the BayesianSearcher, a Graph module, a PreProcessor, a LayerTransformer, a NetTransformer, a ClassifierGenerator and some utilities. This is an evolving package, please take a look at the creators disclaimer:

Please note that this is a pre-release version of the Auto-Keras which is still undergoing final testing before its official release. The website, its software and all content found on it are provided on an “as is” and “as available” basis. Auto-Keras does notgive any warranties, whether express or implied, as to the suitability or usability of the website, its software or any of its content. Auto-Keras will not be liable for any loss, whether such loss is direct, indirect, special or consequential, suffered by any party as a result of their use of the libraries or content. Any usage of the libraries is done at the user’s own risk and the user will be solely responsible for any damage to any computer system or loss of data that results from such activities. Should you encounter any bugs, glitches, lack of functionality or other problems on the website, please let us know immediately so we can rectify these accordingly. Your help in this regard is greatly appreciated.

Either way is an amazing package that is very useful and it will be in the future. For more on AutoML and packages see this:

  • AutoML - BOHB combines the benefits of both Bayesian Optimization and HyperBand, in order to achieve the best of both worlds…
  • The Current State of Automated Machine Learning - Automated Machine Learning (AutoML) has become a topic of considerable interest over the past year...
  • Using AutoML to Generate Machine Learning Pipelines with TPOT
    - Thus far in this series of posts we have: This post will take a different approach to constructing pipelines

Oh! If you want an even simple way for doing AutoML and Deep Learning without coding at all check out Deep Cognition and my posts on it:

  • Deep Learning made easy with Deep Cognition - This past month I had the luck to meet the founders of DeepCognition.ai. Deep Cognition breaks the significant barrier…
  • A video walkthrough of Deep Cognition - Hi everyone! In this article I’ll share with you several videos that will walk you through Deep Cognition’s Platform…
  • Deep Learning with a Little Help from My Friends -
    When you are start in a new field, the best it’s to start with good company, friends or a good community that can…

And now for the final surprise! If you got here, I think you are interested in learning new things. I joined my friend Matthew Dancho in the amazing field of creating courses for people that want to become data scientists. For now we have a full R course so if you are an R lover this is for you. Right now I’m creating right the Python counterpart, so if you want to know more about that, please visit here.

Business-Science University will take you through the entire Data-Science-for-Business process of solving problems with data science, using machine learning to create interactive applications, and distributing solutions within your organization.

 
Bio: Favio Vazquez is a physicist and computer engineer working on data Science and Computational Cosmology. He has a passion for science, philosophy, programming, and music. Right now he is working on data science, machine learning and big data as the Principal data Scientist at Oxxo. Also, he is the creator of Ciencia y Datos, a data Science publication in Spanish. He loves new challenges, working with a good team and having interesting problems to solve. He is part of Apache Spark collaboration, helping in MLlib, Core and the Documentation. He loves applying his knowledge and expertise in science, data analysis, visualization, and automatic learning to help the world become a better place.

Original. Reposted with permission.