O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Predictive Analytics with TensorFlow

Book Description

Accomplish the power of data in your business by building advanced predictive modelling applications with Tensorflow.

About This Book

  • A quick guide to gain hands-on experience with deep learning in different domains such as digit/image classification, and texts
  • Build your own smart, predictive models with TensorFlow using easy-to-follow approach mentioned in the book
  • Understand deep learning and predictive analytics along with its challenges and best practices

Who This Book Is For

This book is intended for anyone who wants to build predictive models with the power of TensorFlow from scratch. If you want to build your own extensive applications which work, and can predict smart decisions in the future then this book is what you need!

What You Will Learn

  • Get a solid and theoretical understanding of linear algebra, statistics, and probability for predictive modeling
  • Develop predictive models using classification, regression, and clustering algorithms
  • Develop predictive models for NLP
  • Learn how to use reinforcement learning for predictive analytics
  • Factorization Machines for advanced recommendation systems
  • Get a hands-on understanding of deep learning architectures for advanced predictive analytics
  • Learn how to use deep Neural Networks for predictive analytics
  • See how to use recurrent Neural Networks for predictive analytics
  • Convolutional Neural Networks for emotion recognition, image classification, and sentiment analysis

In Detail

Predictive analytics discovers hidden patterns from structured and unstructured data for automated decision-making in business intelligence.

This book will help you build, tune, and deploy predictive models with TensorFlow in three main sections. The first section covers linear algebra, statistics, and probability theory for predictive modeling.

The second section covers developing predictive models via supervised (classification and regression) and unsupervised (clustering) algorithms. It then explains how to develop predictive models for NLP and covers reinforcement learning algorithms. Lastly, this section covers developing a factorization machines-based recommendation system.

The third section covers deep learning architectures for advanced predictive analytics, including deep neural networks and recurrent neural networks for high-dimensional and sequence data. Finally, convolutional neural networks are used for predictive modeling for emotion recognition, image classification, and sentiment analysis.

Style and approach

TensorFlow, a popular library for machine learning, embraces the innovation and community-engagement of open source, but has the support, guidance, and stability of a large corporation.

Table of Contents

  1. Predictive Analytics with TensorFlow
    1. Table of Contents
    2. Predictive Analytics with TensorFlow
    3. Credits
    4. About the Author
    5. Acknowledgments
    6. About the Reviewers
    7. www.PacktPub.com
      1. eBooks, discount offers, and more
        1. Why subscribe?
    8. Customer Feedback
    9. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    10. 1. Basic Python and Linear Algebra for Predictive Analytics
      1. A basic introduction to predictive analytics
        1. Why predictive analytics?
        2. Working principles of a predictive model
      2. A bit of linear algebra
        1. Programming linear algebra
      3. Installing and getting started with Python
        1. Installing on Windows
        2. Installing Python on Linux
        3. Installing and upgrading PIP (or PIP3)
        4. Installing Python on Mac OS
        5. Installing packages in Python
      4. Getting started with Python
        1. Python data types
        2. Using strings in Python
        3. Using lists in Python
        4. Using tuples in Python
        5. Using dictionary in Python
        6. Using sets in Python
        7. Functions in Python
        8. Classes in Python
      5. Vectors, matrices, and graphs
        1. Vectors
        2. Matrices
          1. Matrix addition
          2. Matrix subtraction
            1. Multiplying two matrices
          3. Finding the determinant of a matrix
        3. Finding the transpose of a matrix
        4. Solving simultaneous linear equations
        5. Eigenvalues and eigenvectors
      6. Span and linear independence
      7. Principal component analysis
      8. Singular value decomposition
        1. Data compression in a predictive model using SVD
      9. Predictive analytics tools in Python
      10. Summary
    11. 2. Statistics, Probability, and Information Theory for Predictive Modeling
      1. Using statistics in predictive modeling
        1. Statistical models
          1. Parametric versus nonparametric model
            1. Parametric predictive models
            2. Nonparametric predictive models
        2. Population and sample
          1. Random sampling
          2. Expectation
        3. Central limit theorem
          1. Skewness and data distribution
        4. Standard deviation and variance
          1. Covariance and correlation
        5. Interquartile, range, and quartiles
        6. Hypothesis testing
          1. Chi-square tests
          2. Chi-square independence test
      2. Basic probability for predictive modeling
        1. Probability and the random variables
        2. Generating random numbers and setting the seed
        3. Probability distributions
          1. Marginal probability
          2. Conditional probability
        4. The chain rule of conditional probability
        5. Independence and conditional independence
        6. Bayes' rule
      3. Using information theory in predictive modeling
        1. Self-information
          1. Mutual information
        2. Entropy
          1. Shannon entropy
          2. Joint entropy
          3. Conditional entropy
          4. Information gain
        3. Using information theory
        4. Using information theory in Python
      4. Summary
    12. 3. From Data to Decisions – Getting Started with TensorFlow
      1. Taking decisions based on data - Titanic example
        1. Data value chain for making decisions
        2. From disaster to decision – Titanic survival example
      2. General overview of TensorFlow
      3. Installing and configuring TensorFlow
        1. Installing TensorFlow on Linux
          1. Installing Python and nVidia driver
            1. Installing NVIDIA CUDA
            2. Installing NVIDIA cuDNN v5.1+
            3. Installing the libcupti-dev library
            4. Installing TensorFlow
              1. Installing TensorFlow with native pip
              2. Installing with virtualenv
        2. Installing TensorFlow from source
        3. Testing your TensorFlow installation
      4. TensorFlow computational graph
      5. TensorFlow programming model
      6. Data model in TensorFlow
        1. Tensors
        2. Rank
        3. Shape
        4. Data type
        5. Variables
        6. Fetches
        7. Feeds and placeholders
      7. TensorBoard
        1. How does TensorBoard work?
      8. Getting started with TensorFlow – linear regression and beyond
        1. Source code for the linear regression
      9. Summary
    13. 4. Putting Data in Place - Supervised Learning for Predictive Analytics
      1. Supervised learning for predictive analytics
      2. Linear regression - revisited
        1. Problem statement
        2. Using linear regression for movie rating prediction
      3. From disaster to decision - Titanic example revisited
        1. An exploratory analysis of the Titanic dataset
        2. Feature engineering
        3. Logistic regression for survival prediction
          1. Using TensorFlow contrib
        4. Linear SVM for survival prediction
        5. Ensemble method for survival prediction: random forest
        6. A comparative analysis
      4. Summary
    14. 5. Clustering Your Data - Unsupervised Learning for Predictive Analytics
      1. Unsupervised learning and clustering
      2. Using K-means for predictive analytics
        1. How K-means works
        2. Using K-means for predicting neighborhoods
      3. Predictive models for clustering audio files
      4. Using kNN for predictive analytics
        1. Working principles of kNN
        2. Implementing a kNN-based predictive model
      5. Summary
    15. 6. Predictive Analytics Pipelines for NLP
      1. NLP analytics pipelines
        1. Using text analytics
      2. Transformers and estimators
        1. Standard transformer
        2. Estimator transformer
        3. StopWordsRemover
        4. N-gram
      3. Using BOW for predictive analytics
        1. Bag-of-words
        2. The problem definition
        3. The dataset description and exploration
        4. Spam prediction using LR and BOW with TensorFlow
      4. TF-IDF model for predictive analytics
        1. How to compute TF, IDF, and TFIDF?
        2. Implementing a TF-IDF model for spam prediction
      5. Using Word2vec for sentiment analysis
        1. Continuous bag-of-words
        2. Continuous skip-gram
        3. Using CBOW for word embedding and model building
          1. CBOW model building
          2. Reusing the CBOW for predicting sentiment
      6. Summary
    16. 7. Using Deep Neural Networks for Predictive Analytics
      1. Deep learning for better predictive analytics
      2. Artificial Neural Networks
      3. Deep Neural Networks
        1. DNN architectures
      4. Multilayer perceptrons
        1. Training an MLP
        2. Using MLPs
      5. DNN performance analysis
      6. Fine-tuning DNN hyperparameters
        1. Number of hidden layers
        2. Number of neurons per hidden layer
        3. Activation functions
        4. Weight and biases initialization
        5. Regularization
      7. Using multilayer perceptrons for predictive analytics
        1. Dataset description
        2. Preprocessing
        3. A TensorFlow implementation of MLP
      8. Deep belief networks
        1. Restricted Boltzmann Machines
        2. Construction of a simple DBN
          1. Unsupervised Pretraining
      9. Using deep belief networks for predictive analytics
      10. Summary
    17. 8. Using Convolutional Neural Networks for Predictive Analytics
      1. CNNs and the drawbacks of regular DNNs
      2. CNN architecture
      3. Convolutional operations
        1. Applying convolution operations in TensorFlow
      4. Pooling layer and padding operations
        1. Applying subsampling operations in TensorFlow
      5. Tuning CNN hyperparameters
      6. CNN-based predictive model for sentiment analysis
        1. Exploring movie and product review datasets
        2. Using CNN for predictive analytics about movie reviews
      7. CNN model for emotion recognition
        1. Dataset description
        2. CNN architecture design
        3. Testing the model on your own image
        4. Using complex CNN for predictive analytics
        5. Dataset description
      8. CNN predictive model for image classification
      9. Summary
    18. 9. Using Recurrent Neural Networks for Predictive Analytics
      1. RNN architecture
        1. Contextual information and the architecture of RNNs
          1. BRNNs
          2. LSTM networks
          3. GRU cell
      2. Using BRNN for image classification
      3. Implementing an RNN for spam prediction
      4. Developing a predictive model for time series data
        1. Description of the dataset
        2. Preprocessing and exploratory analysis
        3. LSTM predictive model
        4. Model evaluation
      5. An LSTM predictive model for sentiment analysis
        1. Network design
        2. LSTM model training
        3. Visualizing through TensorBoard
        4. LSTM model evaluation
      6. Summary
    19. 10. Recommendation Systems for Predictive Analytics
      1. Recommendation systems
        1. Collaborative filtering approaches
        2. Content-based filtering approaches
        3. Hybrid recommendation systems
        4. Model-based collaborative filtering
      2. Collaborative filtering approach for movie recommendations
        1. The utility matrix
        2. Dataset description
          1. Ratings data
          2. Movies data
          3. User data
        3. Exploratory analysis of the dataset
        4. Implementing a movie recommendation engine
          1. Training the model with available ratings
          2. Inferencing the saved model
          3. Generating a user-item table
          4. Clustering similar movies
          5. Movie rating prediction by users
          6. Finding the top K movies
          7. Predicting top K similar movies
          8. Computing the user-user similarity
        5. Evaluating the recommendation system
      3. Factorization machines for recommendation systems
        1. Factorization machines
          1. The cold start problem in recommendation systems
        2. Problem definition and formulation
        3. Dataset description
        4. Preprocessing
        5. Implementing an FM model
      4. Improved factorization machines for predictive analytics
        1. Neural factorization machines
          1. Dataset description
          2. Using NFM for movie recommendations
            1. Model training
            2. Model evaluation
      5. Summary
    20. 11. Using Reinforcement Learning for Predictive Analytics
      1. Reinforcement learning
      2. Reinforcement learning in predictive analytics
      3. Notation, policy, and utility in RL
        1. Policy
        2. Utility
      4. Developing a multiarmed bandit's predictive model
      5. Developing a stock price predictive model
      6. Summary
    21. Index