KDnuggets Home » News » 2018 » Aug » Tutorials, Overviews » Auto-Keras, or How You can Create a Deep Learning Model in 4 Lines of Code ( 18:n32 )

Silver BlogAuto-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.



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 data science. While there is undoubtedly overlap, machine learning is but one of many tools in the data science toolkit, and its use does not actually factor in to all data science tasks. For example, if prediction will be part of a given data science task, machine learning will be a useful component; however, machine learning may not play in to a descriptive analytics task at all.

Ok so, what is automated machine learning then? In simple words is a way of automating the tasks of (https://www.automl.org/automl/):

  • Preprocess and clean the data.
  • Select and construct appropriate features.
  • Select an appropriate model family.
  • Optimize model hyperparameters.
  • Postprocess machine learning models.
  • Critically analyze the results obtained.

Now that we are clear on what is AutoML now, what is Keras?

Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlowCNTK, 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:

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:

 
MNIST with Keras:

Resources:

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:

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:

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.

Related:


Sign Up