Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Artificial Intelligence for Beginners

You're reading from   Hands-On Artificial Intelligence for Beginners An introduction to AI concepts, algorithms, and their implementation

Arrow left icon
Product type Paperback
Published in Oct 2018
Publisher Packt
ISBN-13 9781788991063
Length 362 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
David Dindi David Dindi
Author Profile Icon David Dindi
David Dindi
Patrick D. Smith Patrick D. Smith
Author Profile Icon Patrick D. Smith
Patrick D. Smith
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. The History of AI FREE CHAPTER 2. Machine Learning Basics 3. Platforms and Other Essentials 4. Your First Artificial Neural Networks 5. Convolutional Neural Networks 6. Recurrent Neural Networks 7. Generative Models 8. Reinforcement Learning 9. Deep Learning for Intelligent Agents 10. Deep Learning for Game Playing 11. Deep Learning for Finance 12. Deep Learning for Robotics 13. Deploying and Maintaining AI Applications 14. Other Books You May Enjoy

Constructing a basic agent

The simplest way to construct an artificial assistant with TensorFlow is to use a sequence-to-sequence (Seq2Seq) model, which we learned in the chapter on RNNs.

While originally developed for neural machine translation, we can adjust this model to act as an intelligent chatbot for our own purposes. We'll create the brain behind our assistant as a Python class called IntelligentAssistant. Then, we'll create the training and chatting functions for our assistant:

  1. First, let's start with our standard imports and initialize our variables. Take special note of the mask variable here; masks are placeholders that allow us to handle variable-length inputs in our network:
import numpy as np
import tensorflow as tf

class IntelligentAssistant:
''' The "Brain" behind our assistant '''

def __init__(self, forwardPass...
lock icon The rest of the chapter is locked
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.
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 $19.99/month. Cancel anytime
Banner background image