Google TensorFlow. Artificial Intelligence Made Easy(ier)

In this article I will explain what the real live neural network solving real problems could look like. And what options and tools you have for consideration when building your neural network model. I will also tell you a bit about Google’s ninja-chips developed to aid Machine Learning problems.

I’ve chosen Google based stack built around its TensorFlow framework. I think we can all agree there is no match to Google in mining and analysing big data. Finally at the very end I will help you execute your very first, basic network training, evaluation and prediction code!

Artificial Intelligence and Machine Learning

But before we dig into examples of what you can do with TensorFlow let us get some basic terminology straight. The whole field of Machine Learning falls under the AI category of computing. Machine Learning is basically using algorithms and data sets to help computer systems solve specific problems like (but not limited to) classification and predictions. The groups of algorithms we use in Machine Learning are called Neural Networks. If a particular neural network consists of more than one layer (more than one algorithm set) then we are talking about deep neural network (this is what we referee to when we talk about deep learning). So: AI > Machine_Learning > Deep_Learning > Magic.py

With the help of TensorFlow and other available frameworks, Machine Learning can help solve a lot of problems, some of which are:

  • Natural Language Processing
  • Categorizing bodies of text or images
  • Product recommendation
  • Medical diagnosis
  • Financial analysis
  • Fraud detection
  • Customer segmentation
  • Predictive maintenance

Languages for Data Science

The languages of choice for the data science community are R and Python. While R is easier to start with even for non-technical individuals, Python is more complete and more suitable to integrate in real life solutions. Whatever you can do in Python, you can do in R, due to their extensible list of packages. Here I will focus on Python as it allows us to orchestrate all the frameworks and libraries we need to better utilize the power of Machine Learning systems.

Machine Learning problems are basically anything that can be “solved” by finding features and patterns in large data sets representing a particular problem domain. Once you establish that your problems fall under Machine Learning solvable category, you need to pick the technology and while there are a lot out there available I would recommend going for the most popular ones as you will simply find more libraries and experts using them. As I said there are several options out there but due to benefits I will show you next, TensorFlow will often be your best bet for any medium to high complexity problems.

One particular benefit of using TensorFlow is the fact that you can use it on majority of hardware platforms including Microsoft’s and Amazon’s cloud solutions. Choosing TensorFlow also gives you access to the huge knowledge base including TensorFlow project website guides, guide tutorials, tutorials toolsets and a massive support for features and algorithms. One of such great features/modules worth mentioning would have to be TPU’s.

Google’s Ninja chips

TPU’s are Google’s Ninja chips which are build to aid Machine Learning problems. TPU’s (Tensor Processing Units) were built by Google to solve performance limitations of classical CPU-GPU systems. This is what is powering Google AI projects like Google assistant, search, translate and more!

Google's Ninja chip
Source: https://cloud.google.com/blog/products/gcp/google-supercharges-machine-learning-tasks-with-custom-chip

Additionally, if you are fairly new to Machine Learning, or you simply want to test some ideas or prototype a network quickly, you can and should use Keras. It’s a High Level API that operates on top of TensorFlow and uses it as its processing engine. You can mix Keras and pure tensor flow easily, so don’t worry about starting out with Keras. You can always replace it with TensorFlow code when you are ready or when you need something more complex that Keras doesn’t allow you to do.

So at this point we know it’s worth using TensorFlow because it’s more or less a standard in the Machine Learning. Keras usually goes in pair with TensorFlow to help to abstract away some complexities. This makes it easier to start working with neural networks. Another great tool you could employ to accompany TensorFlow and Keras is Scikit-Learn.

What is Scikit-Learn?

It’s very popular in academic circles and very easy to use. It also contains a great knowledge base helping to understand and visualize many problems and concepts involved in Machine Learning. Also its fairly easy to use Keras models in Scikit-Learn which is very helpful, especially at the beginning. You will find a lot of great examples and tutorials build within Scikit-Learn.

Once you are ready and aware of your main options, let’s start with some practical exercise! A lot of examples and tutorials will use one of 2 great tools: Jupyter Notebook and a Google’s CoLaboratory which is actually built on top of Jupyter Notebook. These are basically interactive documents. They allow mixing text and images with interactive Console-Cells that will actually allow you to execute code and see some output in the Notebook itself.

With the help of notebooks you can create interactive articles showing and explaining how particular techniques or Machine Learning enabled code works. You can (and should) read more about Google CoLaboratory. Wherever in the articles (even the “welcome” one I linked here) you see a little [ ] and some code. Don’t be afraid of hovering over this [ ] and pressing play. The code will be executed on a real machine in the cloud!

Common problems with ML

What comes next is a link to a basic image classification problem – one of hello worlds to the neural network modelling – we are talking about classification when we are trying to assign a set of data to a category like type of clothing. Another common ML problem you may hear about is regression which is on a very basic level, predicting values based on previous values. In there you will see the most common steps that data scientists have to make solving machine learning problems:

  • Pre-processing the data
  • Setting up network model
  • Compiling the model
  • Training and evaluating the model

colab.research.google.com/github/tensorflow/docs/blob/master/site/en/tutorials/keras/basic_classification.ipynb

While you digest this hello world example I’ll be working on 2 new notebooks showing a bit more complex examples. Like analysis of the Deep Q Network able to play Atari games on a super human level with the powers of Reinforced Learning! But for now do enjoy the basic classification example and as always leave your thoughts in the comments.

Tags: ,