Reader small image

You're reading from  Mastering Predictive Analytics with scikit-learn and TensorFlow

Product typeBook
Published inSep 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781789617740
Edition1st Edition
Languages
Right arrow
Author (1)
Alvaro Fuentes
Alvaro Fuentes
author image
Alvaro Fuentes

Alvaro Fuentes is a senior data scientist with a background in applied mathematics and economics. He has more than 14 years of experience in various analytical roles and is an analytics consultant at one of the ‘Big Three' global management consulting firms, leading advanced analytics projects in different industries like banking, technology, and consumer goods. Alvaro is also an author and trainer in analytics and data science and has published courses and books, such as 'Become a Python Data Analyst' and 'Hands-On Predictive Analytics with Python'. He has also taught data science and related topics to thousands of students both on-site and online through different platforms such as Springboard, Simplilearn, Udemy, and BSG Institute, among others.
Read more about Alvaro Fuentes

Right arrow

Introduction to Artificial Neural Networks and TensorFlow

In this chapter, we will give an introduction to artificial neural networks (ANNs), which are basically computational models inspired by living brains, and perceptrons, which are the building blocks for ANNs. We will also talk about all of the elements to consider when building a deep neural network model. Then, we will talk about TensorFlow, which is the library that we will use to create these deep neural network models. Finally, we will talk about the core concepts that we need to understand about TensorFlow in order to use these library concepts, such as variables, placeholders, sessions, graphs, and others that are essential for using this library.

The following are the topics that will be covered as we progress:

  • Introduction to ANNs
  • Elements of a deep neural network
  • Installation of and introduction to TensorFlow
  • ...

Introduction to ANNs

ANNs are biologically inspired computational models that can be used to train a computer to perform a task using data. These models are part of the broad category of machine learning models. The distinction between these models and others is that these models are based on a collection of connected units called artificial neurons.

There are many types of ANNs and, in this book, we will use one specific type, which is called the multilayer perceptron (MLP). Please note that there are a lot more variations of ANNs. These are machine learning models and we can use them for classification and regression tasks, but we can actually extend these models and apply them to other very specific tasks such as computer vision, speech recognition, and machine translation. These models are the basis of the exciting and growing field of deep learning, which has been really...

Elements of a deep neural network model

The motivation for deep neural networks (DNNs) is similar, and the question here is, instead of using one single hidden layer, what if we use many hidden layers? So in that case, our model will look similar to the following:

Here, we have the same input layer. However, in this case, we will have many hidden layers and the output layer will stay the same. The key thing here is the hidden part of the network, the hidden layers; instead of having just one, we have many hidden layers and this is called a DNN.

Deep learning

Deep learning is a set of machine learning models based on neural networks and the associated techniques to train such models using data. There are many deep learning...

Introduction to TensorFlow

TensorFlow is an open source software library for numerical computation using data flow graphs. The concept of a computational graph is very important in TensorFlow and was specially designed for creating deep learning models. This library allows developers to deploy computations to one or more CPUs or GPUs in a desktop, a server, or even in mobile devices. This library was originally developed by researchers and engineers working at Google. It was open sourced in 2015 and, since then, it has become one of the major libraries in the machine learning world.

TensorFlow provides multiple APIs, and they can be categorized into the following two broad types:

  • Low level: Also known as TensorFlow Core, this is the lowest-level API. This API gives us complete programming control and is aimed at researchers and users who need a high degree of flexibility when...

Core concepts in TensorFlow

There are some major concepts that we need to understand before actually using the tensorflow library. The following are the concepts that we will cover in this book:

  • Tensors
  • Computational graphs
  • Sessions
  • Variables
  • Placeholders
  • Constants

Tensors

A tensor is the central unit of data in TensorFlow. A tensor consists of a set of primitive values shaped into an array of any number of dimensions. It is basically a multidimensional array similar to a NumPy array. The number of dimensions defines the rank of a tensor. Let's see some of the following examples:

  • 3: If we have a single number, the tensor will be considered a rank 0 tensor. This can be a scalar with shape[].
  • [2., 2., 1.]: If we have...

Summary

In this chapter, we talked about ANNs, deep learning, and the elements of a deep learning model. We then installed TensorFlow and learned about the core concepts that we use in TensorFlow.

In the next chapter, we will perform predictive analytics with TensorFlow and deep learning.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering Predictive Analytics with scikit-learn and TensorFlow
Published in: Sep 2018Publisher: PacktISBN-13: 9781789617740
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Alvaro Fuentes

Alvaro Fuentes is a senior data scientist with a background in applied mathematics and economics. He has more than 14 years of experience in various analytical roles and is an analytics consultant at one of the ‘Big Three' global management consulting firms, leading advanced analytics projects in different industries like banking, technology, and consumer goods. Alvaro is also an author and trainer in analytics and data science and has published courses and books, such as 'Become a Python Data Analyst' and 'Hands-On Predictive Analytics with Python'. He has also taught data science and related topics to thousands of students both on-site and online through different platforms such as Springboard, Simplilearn, Udemy, and BSG Institute, among others.
Read more about Alvaro Fuentes