Skip to Main Content
Hands-On Artificial Intelligence for Beginners
book

Hands-On Artificial Intelligence for Beginners

by David Dindi, Patrick D. Smith
October 2018
Beginner content levelBeginner
362 pages
9h 32m
English
Packt Publishing
Content preview from Hands-On Artificial Intelligence for Beginners

Implementation of DDPG

This section will show you how to implement the actor-critic architecture using TensorFlow. The code structure is almost the same as the DQN implementation that was shown in the previous chapter.

The ActorNetwork is a simple MLP that takes the observation state as its input:

class ActorNetwork:        def __init__(self, input_state, output_dim, hidden_layers, activation=tf.nn.relu):                self.x = input_state        self.output_dim = output_dim        self.hidden_layers = hidden_layers        self.activation = activation                with tf.variable_scope('actor_network'):            self.output = self._build()            self.vars = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES,                                           tf.get_variable_scope().name)            def _build(self):                layer = self.x init_b = tf.constant_initializer(0.01) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Artificial Intelligence and Machine Learning Fundamentals

Artificial Intelligence and Machine Learning Fundamentals

Zsolt Nagy

Publisher Resources

ISBN: 9781788991063Supplemental Content