E IGENOPTION D ISCOVERY THROUGH THE D EEP S UCCESSOR R EPRESENTATION
A BSTRACT
Options in reinforcement learning allow agents to hierarchically decompose a task into subtasks, having the potential to speed up learning and planning.
However, autonomously learning effective sets of options is still a major challenge in the ﬁeld.
In this paper we focus on the recently introduced idea of using representation learning methods to guide the option discovery process.
Speciﬁcally, we look at eigenoptions , options obtained from representations that encode diffusive information ﬂow in the environment.
We extend the existing algorithms for eigenoption discovery to settings with stochastic transitions and in which handcrafted features are not available.
We propose an algorithm that discovers eigenoptions while learning non-linear state representations from raw pixels.
It exploits recent successes in the deep reinforcement learning literature and the equivalence between proto-value functions and the successor representation.
We use traditional tabular domains to provide intuition about our approach and Atari 2600 games to demonstrate its potential.
I NTRODUCTION
Sequential decision making usually involves planning, acting, and learning about temporally extended courses of actions over different time scales.
In the reinforcement learning framework, options are a well-known formalization of the notion of actions extended in time; and they have been shown to speed up learning and planning when appropriately deﬁned ( e.g. , Brunskill & Li, 2014;
Guo et al., 2017; Solway et al., 2014).
In spite of that, autonomously identifying good options is still an open problem.
This problem is known as the problem of option discovery.
Option discovery has received ample attention over many years, with varied solutions being proposed ( e.g. , Bacon et al., 2017; S¸imsek & Barto, 2004; Daniel et al., 2016; Florensa et al., 2017;
Konidaris & Barto, 2009; Mankowitz et al., 2016; McGovern & Barto, 2001).
Recently, Machado et al. (2017) and Vezhnevets et al.
(2017) proposed the idea of learning options that traverse directions of a latent representation of the environment.
In this paper we further explore this idea.
More speciﬁcally, we focus on the concept of eigenoptions (Machado et al., 2017), options learned using a model of diffusive information ﬂow in the environment.
They have been shown to improve agents’ performance by reducing the expected number of time steps a uniform random policy needs in order to traverse the state space.
Eigenoptions are deﬁned in terms of proto-value functions (PVFs;
Mahadevan, 2005), basis functions learned from the environment’s underlying state-transition graph.
PVFs and eigenoptions have been deﬁned and thoroughly evaluated in the tabular case.
Currently, eigenoptions can be used in environments where it is infeasible to enumerate states only when a linear representation of these states is known beforehand .
In this paper we extend the notion of eigenoptions to stochastic environments with non-enumerated states, which are commonly approximated by feature representations.
Despite methods that learn representations generally being more ﬂexible, more scalable, and often leading to better performance, current algorithms for eigenoption discovery cannot be combined with representation learn- ing.
We introduce an algorithm that is capable of discovering eigenoptions while learning representations.
The learned representations implicitly approximate the model of diffusive information ﬂow (hereafter abbreviated as the DIF model) in the environment.
We do so by exploiting the equivalence between PVFs and the successor representation (SR; Dayan, 1993).
Notably, by using the SR we also start to be able to deal with stochastic transitions naturally, a limitation of previous algorithms.
We evaluate our algorithm in a tabular domain as well as on Atari 2600 games.
We use the tabular domain to provide intuition about our algorithm and to compare it to the algorithms in the literature.
Our evaluation in Atari 2600 games provides promising evidence of the applicability of our algorithm in a setting in which a representation of the agent’s observation is learned from raw pixels.
B ACKGROUND
In this section we discuss the reinforcement learning setting, the options framework, and the set of options known as eigenoptions.
We also discuss the successor representation, which is the main concept used in the proposed algorithm.
2. R EINFORCEMENT L EARNING AND O PTIONS
We consider the reinforcement learning (RL) problem in which a learning agent interacts with an unknown environment in order to maximize a reward signal.
RL is often formalized as a Markov decision process (MDP), described as a 5-tuple: (cid:104) S , A , p, r, γ (cid:105) .
At time t the agent is in state s t ∈ S where it takes action a t ∈ A that leads to the next state s t +1 ∈ S according to the transition probability kernel p ( s (cid:48) | s, a ) .
The agent also observes a reward R t +1 generated by the function r : S ×
A → R .
The agent’s goal is to learn a policy π : S ×
A → [0 , 1] that maximizes the expected discounted return G t .
=
E π,p (cid:2) (cid:80) ∞ k =
γ k R t + k +1 | s t (cid:3) , where γ ∈ [0 , 1] is the discount factor.
In this paper we are interested in the class of algorithms that determine the agent’s policy by being greedy with respect to estimates of value functions; either w.r.t.
the state value v π ( s ) , or w.r.t.
the state-action value function q π ( s, a ) .
Formally, v π ( s ) =
E π,p [ G t | s ] = (cid:80) a π ( a | s ) q π
( s, a ) .
Notice that in large problems these estimates have to be approximated because it is infeasible to learn a value for each state-action pair.
This is generally done by parameterizing q π ( s, a ) with a set of weights θ such that q ( s, a, θ ) ≈ q π
( s, a ) .
Currently, neural networks are the most successful parametrization approach in the ﬁeld ( e.g. , Mnih et al., 2015; Tesauro, 1995).
One of the better known instantiations of this idea is the algorithm called Deep Q-network (DQN; Mnih et al., 2015), which uses a neural network to estimate state-action value functions from raw pixels.
Options (Sutton et al., 1999) are our main topic of study.
They are temporally extended actions that allow us to represent courses of actions.
An option ω ∈ Ω is a 3-tuple ω =
(cid:104)I ω , π ω , T ω (cid:105) where
I ω
⊆ S denotes the option’s initiation set, π ω : S ×
A → [0 , 1] denotes the option’s policy, and
T ω ⊆ S denotes the option’s termination set.
We consider the call-and-return option execution model in which a meta-policy µ : S → Ω dictates the agent’s behavior (notice A ⊆ Ω ).
After the agent decides to follow option ω from a state in I ω , actions are selected according to π ω until the agent reaches a state in T ω .
We are interested in learning I ω , π ω , and T ω from scratch.
2. P ROTO - VALUE F UNCTIONS AND E IGENOPTIONS
Eigenoptions are options that maximize eigenpurposes r e i , intrinsic reward functions obtained from the DIF model (Machado et al., 2017).
Formally,
[Equation]
where φ ( · ) denotes a feature representation of a given state ( e.g. , one-hot encoding in the tabular case) and e denotes an eigenvector encoding the DIF model at a speciﬁc timescale.
Each intrinsic reward function, deﬁned by the eigenvector being used, incentivizes the agent to traverse a different latent dimension of the state space.
In the tabular case, the algorithms capable of learning eigenoptions encode the DIF model through the combinatorial graph Laplacian L = D − 1 /
( D − W ) D − 1 / 2 , where W is the graph’s weight matrix and D is the diagonal matrix whose entries are the row sums of W .
The weight matrix is a square matrix where the ij -th entry represents the connection between states i and j .
Notice that this approach does not naturally deal with stochastic or unidirectional transitions because W is generally deﬁned as a symmetric adjacency matrix.
Importantly, the eigenvectors of L are also known as proto-value functions (PVFs; Mahadevan, 2005; Mahadevan & Maggioni, 2007).
In settings in which states cannot be enumerated, the DIF model is represented through a matrix of transitions T , with row i encoding the transition vector φ ( s t ) − φ ( s t − 1 ) , where φ ( · ) denotes a ﬁxed linear feature representation known beforehand ( i can be different from t if transitions are observed more than once).
Machado et al.
(2017) justiﬁes this sampling strategy with the fact that, in the tabular case, if every transition is sampled once , the right eigenvectors of matrix T converge to PVFs.
Because transitions are added only once, regardless of their frequency, this algorithm is not well suited to stochastic environments.
In this paper we introduce an algorithm that naturally deals with stochasticity and that does not require φ ( · ) to be known beforehand.
Our algorithm learns the environment’s DIF model while learning a representation of the environment from raw pixels.
2. T HE S UCCESSOR R EPRESENTATION
The successor representation (SR; Dayan, 1993) determines state generalization by how similar its successor states are.
It is deﬁned to be the expected future occupancy of state s (cid:48) given the agent’s policy is π and its starting state is s .
It can be seen as deﬁning state similarity in terms of time.
See
Figure 1 for an example.
The Euclidean distance between state A and state C is smaller than the
Euclidean distance between state A and state
B. However, if one considers the gray tiles to be walls, an agent in state A can reach state B much quicker than state
C. The SR captures this distinction, ensuring that state A is more similar to state B than it is to state C.
Let 1 {·} denote the indicator function, the SR, Ψ π ( s, s (cid:48) ) , is formally deﬁned, for γ < 1 , as :
[Equation]
This expectation can be estimated from samples with temporal-difference error (Sutton, 1988):
[Equation]
where η is the step-size.
In the limit, the SR converges to Ψ π
=
( I − γT π ) − 1 .
This lets us decompose the value function into the product between the SR and the immediate reward (Dayan, 1993):
[Equation]
The SR is directly related to several other ideas in the ﬁeld.
It can be seen as the dual approach to dynamic programming and to value-function based methods in reinforcement learning (Wang et al., 2007).
Moreover, the eigenvectors generated from its eigendecomposition are equivalent to proto-value functions (Stachenfeld et al., 2014; 2017) and to slow feature analysis (Sprekeler, 2011).
Alg.
1 Eigenoption discovery through the ˆΨ ← L EARN R EPRESENTATION () E ← E XTRACT E IGENPURPOSES ( ˆΨ ) for each eigepurpose e i ∈
E do (cid:104)I e i , π e i , T e i (cid:105) ← L EARN E IGENOPTION ( e i ) end for
Alg.
2 L EARN R EPRESENTATION () with the SR for a given number of steps n do
Observe s ∈ S , take action a ∈ A selected according to π ( s ) , and observe a next state s (cid:48) ∈ S for each state j ∈ S do ˆΨ( s, j ) ← ˆΨ( s, j )+ η (cid:0) 1 { s = j } + γ ˆΨ( s (cid:48) , j ) − ˆΨ( s, j ) (cid:1) end for end for return ˆΨ
Such equivalences play a central role in the algorithm we describe in the next section.
The SR may also have an important role in neuroscience.
Stachenfeld et al.
(2014; 2017) recently suggested that the successor representation is encoded by the hippocampus, and that a low-dimensional basis set representing it is encoded by the enthorhinal cortex.
Interestingly, both hippocampus and entorhinal cortex are believed to be part of the brain system responsible for spatial memory and navigation.
E IGENOPTION D ISCOVERY
In order to discover eigenoptions, we ﬁrst need to obtain the eigenpurposes through the eigenvectors encoding the DIF model in the environment.
This is currently done through PVFs, which the agent obtains by either explicitly building the environment’s adjacency matrix or by enumerating all of the environment’s transitions ( c.f. Section 2.2).
Such an approach is fairly effective in deterministic settings in which states can be enumerated and uniquely identiﬁed, i.e. , the tabular case.
However, there is no obvious extension of this approach to stochastic settings.
It may be hard for the agent to explicitly model the environment dynamics in a weight matrix.
The existent alternative, to enumerate the environment’s transitions, may have a large cost.
These issues become worse when states cannot be enumerated, i.e. , the function approximation case.
The existing algorithm that is applicable to the function approximation setting requires a ﬁxed representation as input, not being able to learn a representation while estimating the DIF model.
In this paper we introduce an algorithm that addresses the aforementioned issues by estimating the
DIF model through the SR.
Also, we introduce a new neural network that is capable of approximating the SR from raw pixels by learning a latent representation of game screens.
The learned SR is then used to discover eigenoptions, replacing the need for knowing the combinatorial Laplacian.
In this section we discuss the proposed algorithm in the tabular case, the equivalence between PVFs and the SR, and the algorithm capable of estimating the SR, and eigenoptions, from raw pixels.
3. T HE T ABULAR C ASE
The general structure of the algorithms capable of discovering eigenoptions is fairly straightforward, as shown in Alg.
The agent learns (or is given) a representation that captures the DIF model ( e.g. , the combinatorial Laplacian).
It then uses the eigenvectors of this representation to deﬁne eigenpurposes (E XTRACT E IGENPURPOSES ), the intrinsic reward functions described by Equationthat it will learn how to maximize.
The option’s policy is the one that maximizes this new reward function, while a state s is deﬁned to be terminal with respect to the eigenpurpose e i if q e i ∗ ( s, a ) ≤for all a ∈ A .
The initiation set of an option e i is deﬁned to be S \ T e i .
In the tabular case, our proposed algorithm is also fairly simple.
Instead of assuming the matrix ˆ Ψ is given in the form of the graph Laplacian, or trying to estimate the graph Laplacian from samples by stacking the row vectors corresponding to the different observed transitions, we estimate the DIF model through the successor representation ( c.f. Alg. 2).
This idea is supported by the fact that, for our purposes, the eigenvectors of the normalized Laplacian and the eigenvectors of the SR are equivalent.
Below we formalize this concept and discuss its implications.
We show that the eigenvectors of the normalized Laplacian are equal to the eigenvectors of the SR scaled by γ − 1 D 1 / 2 .
The aforementioned equivalence ensures that the eigenpurposes extraction and the eigenoption learning steps remain unchanged.
That is, we still obtain the eigenpurposes from the eigendecomposition 1 of matrix ˆΨ , and we still use each eigenvector e
i ∈
E to deﬁne the new learning problem in which the agent wants to maximize the eigenpurpose, deﬁned in Equation 1.
Importantly, the use of the SR addresses some other limitations of previous work: 1) it deals with stochasticity in the environment and in the agent’s policy naturally; 2) its memory cost is independent on the number of samples drawn by the agent; and 3) it does not assume that for every action there is another action the agent can take to return to the state it was before, i.e. , W is symmetric.
3. R ELATIONSHIP BETWEEN PVF S AND THE SR
As aforementioned, PVFs (the eigenvectors of the normalized Laplacian) are equal to the eigenvectors of the successor representation scaled by γ − 1 D 1 / 2 .
To the best of our knowledge, this equivalence was ﬁrst explicitly discussed by Stachenfeld et al.
We provide below a more formal statement of such an equivalence, for the eingevalues and the eigenvectors of both approaches.
We use the proof to further discuss the extent of this interchangeability.
Theorem.
Stachenfeld et al.
(2014): Let 0 < γ < 1 s.t.
Ψ =
( I − γT ) − 1 denotes the matrix encoding the SR, and let L
= D − 1 / 2 ( D − W ) D − 1 / 2 denote the matrix corresponding to the normalized Laplacian, both obtained under a uniform random policy.
The i -th eigenvalue ( λ SR ,i ) of the SR and the j -th eigenvalue ( λ PVF ,j ) of the normalized Laplacian are related as follows:
[Equation]
The i -th eigenvector ( e SR ,i ) of the SR and the j -th eigenvector ( e PVF ,j ) of the normalized Laplacian are related as follows:
[Equation]
Proof.
Let λ
i , e i denote the i -th eigenvalue and eigenvector of the SR, respectively.
Using the fact that the SR is known to converge, in the limit, to ( I − γT ) − 1 (through the Neumann series), we have:
[Equation]
Importantly, when using PVFs we are ﬁrst interested in the eigenvectors with the corresponding smallest eigenvalues, as they are the “smoothest” ones.
However, when using the SR we are interested in the eigenvectors with the largest eigenvalues.
The change of variables in Eq.
3 highlights this fact i.e. , λ (cid:48)
j = [1 − (1 − λ − 1 i ) γ − 1 ] .
The indices j are sorted in the reverse order of the indices i .
This distinction can be very important when trying to estimate the relevant eigenvectors.
Finding the largest eigenvalues/eigenvectors is statistically more robust to noise in estimation and does not depend on the lowest spectrum of the matrix.
Moreover, notice that the scaling by D 1 / 2 does not change the direction of the eigenvectors when the size of the action set is constant across all states.
This is often the case in the RL problems being studied.
3. T HE F UNCTION A PPROXIMATION C ASE : T HE SR THROUGH D EEP N EURAL N ETWORKS
The tabular case is interesting to study because it provides intuition about the problem and it is easier to analyze, both empirically and theoretically.
However, the tabular case is only realizable in toy domains.
In real-world situations the number of states is often very large and the ability to generalize and to recognize similar states is essential.
In this section, inspired by Kulkarni et al.’s (2016b) and Oh et al.’s (2015) work, we propose replacing Alg. 2 by a neural network that is able to estimate the successor representation from raw pixels.
Such an approach circumvents the limitations of previous work that required a linear feature representation to be provided beforehand.
The SR with non-enumerated states: Originally, the SR was not deﬁned in the function approximation setting, where states are described in terms of feature vectors.
Successor features are the natural extension of the SR to this setting.
We use Barreto et al.’s
(2017) deﬁnition of successor features, where ψ π,i ( s ) denotes the successor feature i of state s ∈ S when following a policy π :
[Equation]
In words, ψ π,i ( s ) encodes the discounted expected value of the i -th feature in the vector φ ( · ) when the agent starts in state s and follows the policy π .
The update rule presented in Eq.
2 can be naturally extended to this deﬁnition.
The temporal-difference error in the update rule can be used as a differentiable loss function, allowing us to estimate the successor features with a neural network.
Neural network architecture:
The architecture we used is depicted in Fig 2.
The reconstruction module is the same as the one introduced by Oh et al.
(2015), but augmented by the SR estimator (the three layers depicted at the bottom).
The SR estimator uses the learned latent representation as input i.e. , the output of the representation learning module.
The proposed neural network receives raw pixels as input and learns to estimate the successor features of a lower-dimension representation learned by the neural network.
The loss function L SR we use to learn the successor features is:
[Equation]
where φ ( s ) denotes the feature vector encoding the learned representation of state s and ψ ( · ) denotes the estimated successor features.
In practice, φ ( · ) is the output of the representation learning module and ψ ( · ) is the output of the SR estimator, as shown in Fig.
The loss function above also highlights the fact that we have two neural networks.
We use − to represent a target network (Mnih et al., 2015), which is updated at a slower rate for stability purposes.
We cannot directly estimate the successor features from raw pixels using only L SR because zero is one of its ﬁxed points.
This is the reason we added Oh et al.’s (2015) reconstruction module in the proposed network.
It behaves as an auxiliary task (Jaderberg et al., 2017) that predicts the next state to be observed given the current state and action.
By predicting the next state we increase the likelihood the agent will learn a representation that takes into consideration the pixels that are under its control, which has been shown to be a good bias in RL problems (Bellemare et al., 2012).
Such an auxiliary task is deﬁned through the network’s reconstruction error L RE :
[Equation]
where ζ ( · ) denotes the output of the reconstruction module, as shown in Fig.
The ﬁnal loss being optimized is L ( s, a, s (cid:48) )
=
L RE ( s, a, s (cid:48) )
+ L SR ( s, s (cid:48) ) .
[Figure]
Finally, to ensure that the SR will not interfere with the learned features, we zero the gradients coming from the SR estimator (represented with the symbol ø in Fig. 2).
We trained our model with
RMSProp and we followed the same protocol
Oh et al.
(2015) used to initialize the network.
Eigenoption learning:
In Alg. 1, the function E XTRACT E IGENPURPOSES returns the eigenpurposes described by Eq.
Eigenpurposes are deﬁned in terms of a feature representation φ ( s t ) of the environment and of the eigenvectors e i of the DIF model (the SR in our case).
We use the trained network to generate both.
It is trivial to obtain φ ( s t ) as we just use the output of the appropriate layer in the network as our feature representation.
To obtain e i we ﬁrst need to generate a meaningful matrix since our network outputs a vector of successor features instead of a matrix.
We do so by having the agent follow the uniform random policy while we store the network outputs ψ ( s t ) , which correspond to the network estimate of the successor features of state s t .
We then create a matrix T where row t corresponds to ψ ( s t ) and we deﬁne e i to be its right eigenvectors.
Once we have created the eigenpurposes, the option discovery problem is reduced to a regular RL problem where the agent aims to maximize the cumulative sum of rewards.
Any learning algorithm can be used for that.
We provide details about our approach in the next section.
E XPERIMENTS
We evaluate the discovered eigenoptions quantitatively and qualitatively in this section.
We use the traditional rooms domain to evaluate the impact, on the eigenvectors and on the discovered options, of approximating the DIF model through the SR.
We then use Atari 2600 games to demonstrate how the proposed network does discover purposeful options from raw pixels.
4. T ABULAR CASE
Our ﬁrst experiment evaluates the impact of estimating the SR from samples instead of assuming the DIF model was given in the form of the normalized Laplacian.
We use the rooms domain (Fig. 3a; Sutton et al., 1999) to evaluate our method.
Fig.
4b depicts the ﬁrst eigenvector obtained from the SR while Fig.
4c depicts the corresponding eigenoption.
We followed the uniform random policy for 1,000 episodes to learn the SR.
Episodes were 100 time steps long.
We used a stepsize of 0 . 1 , and we set γ = 0 .
The estimated eigenvector is fairly close to the true one and, as expected, the obtained eigenvector is fairly similar to the PVFs that are obtained for this domain.
In the Appendix we provide the plots for the true SR and the PVF, as well as plots for different eigenvectors, comparing them to those obtained from ( I − γT ) − 1 .
Eigenoptions are known for improving the agent’s ability to explore the environment.
We use the metric diffusion time to validate whether such an ability is preserved with our method.
The diffusion time can be seen as a proxy for how hard it is for an agent to reach the goal state when following a uniform random policy.
It is deﬁned as the expected number of decisions (action selection steps) an agent needs to take, when following the uniform random policy, to navigate between two randomly chosen states.
We compared the agent’s diffusion time when using eigenoptions obtained with PVFs to the diffusion time when using eigenoptions obtained with estimates of the SR.
As we can see in
Fig 3d, the eigenoptions obtained with the SR do help the agent to explore the environment. The
[Figure] gap between the diffusion time when using PVFs and when using the SR is likely due to different ways of dealing with corners.
The SR implicitly models self-loops in the states adjacent to walls, since the agent takes an action and it observes it did not move.
We also evaluated how the estimates of the SR evolve as more episodes are used during learning, and its impact in the diffusion time (Fig 3d).
In the Appendix we present more results, showing that the local structure of the graph is generally preserved.
Naturally, more episodes allow us to learn more accurate estimates of the SR as a more global facet of the environment is seen, since the agent has more chances to further explore the state space.
However, it seems that even the SR learned from few episodes allow us to discover useful eigenoptions, as depicted in Fig.
3d.
The eigenoptions obtained from the SR learned using only 100 episodes are already capable of reducing the agent’s diffusion time considerably.
Finally, it is important to stress that the discovered options do more than randomly selecting subgoal states.
“Random options” only reduce the agent’s diffusion time when hundreds of them are added to the agent’s action set (Machado et al., 2017).
Finally, we evaluated the use of the discovered eigenoptions to maximize reward.
In our experiments the agent learned, off-policy, the greedy policy over primitive actions (target policy) while following the uniform random policy over actions and eigenoptions (behavior policy).
We used Qlearning (Watkins & Dayan, 1992) in our experiments – parameters λ = 0 , α = 0 .
1 , and γ = 0 .
As before, episodes were 100 time steps long.
Figure 4 summarizes the obtained results comparing the performance of our approach to regular Q-learning over primitive actions.
The eigenoptions were extracted from estimates of the SR obtained after 100 episodes.
The reported results are the average over 24 independent runs when learning the SR, with each one of these runs encodingruns evaluating Q-Learning.
The options were added following the sorting provided by the eigenvalues.
For example, 4 options denotes an agent with the action set used in the behavior policy being composed of the four primitive actions and the four eigenoptions generated by the top 2 eigenvalues (both directions are being used).
Notice that these results do not try to take the sample efﬁciency of our approach into consideration, they are only meant to showcase how eigenoptions, once discovered, can speed up learning.
The sample complexity of learning options is generally justiﬁed in lifelong learning settings where they are re-used over multiple tasks ( e.g. , Brunskill & Li, 2014).
This is beyond the scope of this paper.
The obtained results clearly show that eigenoptions are not only capable of reducing the diffusion time in the environment but of also improving the agent’s control performance.
They do so by increasing the likelihood that the agent will cover a larger part of the state space given the same amount of time.
Moreover, as before, it seems that a very accurate estimate of the successor representation is not necessary for the eigenoptions to be useful.
Similar results can be obtained for different locations of the start and goal states, and when the estimates of the SR are more accurate.
These results can be seen in the Appendix.
4. A TARI
This second set of experiments evaluates the eigenoptions discovered when the SR is obtained from raw pixels.
We obtained the SR through the neural network described in Section 3.
We used four
[Figure]
Atari 2600 games from the Arcade Learning Environment (Bellemare et al., 2013) as testbed: B ANK
H EIST , F REEWAY , M ONTEZUMA ’ S R EVENGE , and M S .
P AC -M
AN .
We followed the protocol described in the previous section to create eigenpurposes.
We trained the network in Fig.
2 to estimate the SR under the uniform random policy.
Since the network does not impact the policy being followed, we built a dataset of 500 , 000 samples for each game and we used this dataset to optimize the network weights.
We passed through the shufﬂed dataset 10 times, using
RMSProp with a step size of 10 − 4 .
Once we were done with the training, we let the agent follow a uniform random policy for 50 , 000 steps while we stored the SR output by the network for each observed state as a row of matrix T .
We deﬁne e , in the eigenpurposes we maximize ( c.f. , Eq. 1), to be the right eigenvectors of the matrix T , while φ ( · ) is extracted at each time step from the network in Fig.
Due to computational constraints, we approximated the ﬁnal eigenoptions.
We did so by using the ALE’s internal emulator to do a one-step lookahead and act greedily with respect to each eigenpurpose (in practice, this is equivalent to learning with γ = 0 ).
This is not ideal because the options we obtain are quite limited, since they do not deal with delayed rewards.
However, even in such limiting setting we were able to obtain promising results, as we discuss below.
Following Machado et al.
(2017), we evaluate the discovered eigenoptions qualitatively.
We execute all options following the procedure described above (greedy one-step lookahead) while tracking the avatar’s position on the screen.
Figure 5 summarizes the behavior of some of the meaningful options discovered.
The trajectories generated by different options are represented by different colors and the color’s intensity at a given location represents how often the agent was at that location.
Eigenoptions were introduced as options that generate purposeful behavior and that help agents explore the environment.
We can clearly see that the discovered eigenoptions are indeed purposeful.
They aim to reach a speciﬁc location and stay there.
If this was not the case the agent’s trajectory would be much more visible.
Instead, what we actually observe is that the mass of visitation is concentrated on one location on the screen, dominating (color intensity) all the others.
The location the agent is spending most of its time on can in fact be seen as the option’s terminal state.
Constantly being in a state suggests the agent has arrived to a myopic local maximum for that eigenpurpose.
In three out of four games (B ANK H EIST , M ONTEZUMA ’ S R EVENGE , M S .
P ACMAN )
our algorithm discovers options that clearly push the agent to corners and to other relevant parts of the state space, corroborating the intuition that eigenoptions also improve exploration.
In M ONTEZUMA ’ S
R EVENGE , the terminal state of the highlighted options even correspond to what are considered good subgoals for the game (Kulkarni et al., 2016a).
It is likely that additional subgoals, such as the key, were not found due to our myopic greedy approach.
This approach may also explain why our algorithm was ineffective in F REEWAY .
Avoiding cars may be impossible without longer-term planning.
A plot depicting the two meaningful options discovered in this game is in the Appendix.
Importantly, the fact that myopic policies are able to navigate to speciﬁc locations and stay there also suggests that, as in the tabular case, the proposed approach gives rise to dense intrinsic rewards that are very informative.
This is another important constrast between randomly assigned subgoals and our approach.
Randomly assigned subgoals do not give rise to such dense rewards.
Thus, one can argue that our approach does not only generate useful options but it also gives rise to dense eigenpurposes, making it easier to build the policies associated with them.
It is important to stress that our algorithm was able to discover eigenoptions, from raw pixels , similar to those obtained by algorithms that use the RAM state of the game as a feature representation.
The
RAM state of the game often uses speciﬁc bytes to encode important information of the game, such as the position of the player’s avatar in the game.
Our algorithm had to implicitly learn what were the meaningful parts of the screen.
Also, different from previous algorithms, our approach is not constrained by the dimensionality of the state representation nor to binary features.
Based on this discussion, we consider our results to be very promising, even though we only depict options that have effect on the initial state of the games.
We believe that in a more general setting ( e.g. , using
DQN to learn policies) our algorithm has the potential to discover even better options.
R ELATED W ORK
Our work was directly inspired by Kulkarni et al.
(2016b), the ﬁrst to propose approximating
the
SR using a neural network.
We use their loss function in a novel architecture.
Because we are not directly using the SR for control, we deﬁne the SR in terms of states, instead of state-action pairs.
Different from Kulkarni et al.
(2016b), our network does not learn a reward model and it does not use an autoencoder to learn a representation of the world.
It tries to predict the next state the agent will observe.
The prediction module we used was introduced by Oh et al.
Because it predicts the next state, it implicitly learns representations that take into consideration the parts of the screen that are under the agent’s control.
The ability to recognize such features is known as contingency awareness , and it is known to have the potential to improve agents’ performance (Bellemare et al., 2012).
Kulkarni et al.
(2016b) did suggest the deep SR could be used to ﬁnd bottleneck states, which are commonly used as subgoals for options, but such an idea was not further explored.
Importantly,
Jong et al.
(2008) and Machado et al.
(2017) have shown that options that look for bottleneck states can be quite harmful in the learning process.
The idea of explicitly building hierarchies based on the learned latent representation of the state space is due to Machado et al.
(2017) and Vezhnevets et al.
Machado et al.
(2017) proposed the concept of eigenoptions , but limited to the linear function approximation case.
Vezhnevets et al.
(2017) do not explicitly build options with initiation and termination sets.
Instead, they learn a hierarchy through an end-to-end learning system that does not allow us to easily retrieve options from it.
Finally, Kompella et al.
(2017) has proposed the use of slow feature analysis (SFA; Wiskott & Sejnowski, 2002) to discover options.
Sprekeler (2011) has shown that, given a speciﬁc choice of adjacency function, PVFs (and consequently the SR) are equivalent to SFA.
However, their work is limited to linear function approximation.
Our method also differs in how we deﬁne the initiation and termination sets.
The options they discover look for bottleneck states, which is not our case.
C ONCLUSION
In this paper we introduced a new algorithm for eigenoption discovery in RL.
Our algorithm uses the successor representation (SR) to estimate the model of diffusive information ﬂow in the environment, leveraging the equivalence between proto-value functions (PVFs) and the SR.
This approach circumvents several limitations from previous work: (i) it builds increasingly accurate estimates using a constant-cost update-rule; (ii) it naturally deals with stochastic MDPs; (iii) it does not depend on the assumption that the transition matrix is symmetric; and (iv) it does not depend on handcrafted feature representations.
The ﬁrst three items were achieved by simply using the SR instead of the
PVFs, while the latter was achieved by using a neural network to estimate the SR.
The proposed framework opens up multiple possibilities for investigation in the future.
It would be interesting to evaluate the compositionality of eigenoptions, or how transferable they are between similar environments, such as the different modes of Atari 2600 games (Machado et al., 2018).
Finally, now that the fundamental algorithms have been introduced, it would be interesting to investigate whether one can use eigenoptions to accumulate rewards instead of using them for exploration. A CKNOWLEDGMENTS
The authors would like to thank Craig Sherstan and Martha White for feedback on an earlier draft,
Kamyar Azizzadenesheli, Marc G. Bellemare and Michael Bowling for useful discussions, and the anonymous reviewers for their feedback and suggestions.
A PPENDIX : S UPPLEMENTARY M ATERIAL
This supplementary material contains details omitted from the main text due to space constraints.
The list of contents is below:
• A more detailed proof of the theorem in the paper; • Empirical results evaluating how the number of episodes used to learn the successor representation impacts the obtained eigenvectors and their corresponding eigenoptions; • Evaluation of the reconstruction module (auxiliary task) that learns the latent representation that is used to estimate the successor representation.
A MORE DETAILED PROOF OF THE THEOREM IN THE MAIN PAPER
Theorem.
Stachenfeld et al.
(2014): Let 0 < γ < 1 s.t.
Ψ =
( I − γT ) − 1 denotes the matrix encoding the SR, and let L
= D − 1 / 2 ( D − W ) D − 1 / 2 denote the matrix corresponding to the normalized Laplacian, both obtained under a uniform random policy.
The i -th eigenvalue ( λ SR ,i ) of the SR and the j -th eigenvalue ( λ PVF ,j ) of the normalized Laplacian are related as follows:
[Equation]
The i -th eigenvector ( e SR ,i ) of the SR and the j -th eigenvector ( e PVF ,j ) of the normalized Laplacian are related as follows:
[Equation]
Proof.
This proof is more detailed than the one presented in the main paper.
Let λ
i , e i denote the i -th eigenvalue and eigenvector of the SR.
Using the fact that the SR is known to converge, in the limit, to ( I − γT ) − 1 (through the Neumann series), we have:
[Equation]
) e i = λ − 1 i e i ( I − γT ) γ − 1 e i = λ − 1 i γ − 1 e i γ − 1 e i − T e i = λ − 1 i γ − 1 e i
T e i = γ − 1 e i − λ − 1 i γ − 1 e i =
(1 − λ − 1 i ) γ − 1 e i
I e i − T e i =
I e i − (1 − λ − 1 i )
γ − 1 e i ( I − T ) e i =
[ γ − (1 − λ − 1 i )] γ − 1 e i ( I − T ) γ − 1 e i =
[1 − (1 − λ − 1 i ) γ − 1 ] γ − 1 e
i
I − T ) γ − 1 e i
= λ (cid:48)
j γ − 1 e
i
I − D − 1 W ) γ − 1 e i = λ (cid:48)
j γ − 1 e
i
( D − 1 ( D − W ))
γ − 1 e i = λ (cid:48)
j γ − 1 e i
D 1 / 2 ( D − 1 ( D − W ))
γ − 1 e i = λ (cid:48)
j γ − 1 D 1 / 2 e i
D − 1 / 2 ( D − W ) γ − 1 e i = λ (cid:48)
j γ − 1 D 1 / 2 e i
D − 1 / 2 ( D − W ) D − 1 / 2 D 1 / 2 γ − 1 e i = λ (cid:48)
j γ − 1 D 1 / 2 e i
L D 1 / 2 γ − 1 e i = λ (cid:48)
j γ − 1 D 1 / 2 e i
T HE IMPACT THE NUMBER OF EPISODES HAS IN LEARNING THE SR AND THE EIGENOPTIONS
In Section 4.1 we brieﬂy discussed the impact of estimating the successor representation from samples instead of assuming the agent has access to the normalized Laplacian.
It makes much more sense to use the successor representation as the DIF model in the environment if we can estimate it quickly.
The diffusion time was the main evidence we used in Section 4.1 to support our claim that early estimates of the successor representation are useful for eigenoption discovery.
In order to be concise we did not actually plot the eigenvectors of the estimates of the successor representation at different moments, nor explicitly compared them to proto-value functions or to the eigenvectors of the matrix ( I − γT ) − 1 .
We do so in this section.
Figures 7–10 depict the ﬁrst four eigenvectors of the successor representation in the Rooms domain, after being learned for different number of episodes (episodes were 100 time steps long, η = 0 .
1 , γ = 0 . 9 ).
We also depict the corresponding eigenvectors of the ( I − γT ) − 1 matrix 2 , and of the normalized Laplacian (Machado et al., 2017).
Because the eigenvectors orientation (sign) is often arbitrary in an eigendecomposition, we matched their orientation to ease visualization.
Overall, after 500 episodes we already have an almost perfect estimate of the ﬁrst eigenvectors in the environment; while 100 episodes seem to not be enough to accurately learn the DIF model in all rooms.
However, learning the successor representation for 100 episodes seems to be enough to generate eigenoptions that reduce the agent’s diffusion time, as we show in Figure 3d.
We can better discuss this behavior by looking at Figures 11–14, which depict the options generated by the obtained eigenvectors.
With the exception of the options generated after learning the successor representation forepisodes, all the eigenoptions obtained from estimates of the successor representation already move the agent towards the “correct” room(s).
Naturally, they do not always hit the corners, but the general structure of the policies can be clearly seen.
We also observe that the eigenoptions obtained from proto-value functions are shifted one tile from the corners.
As discussed in the main paper, this is a consequence of how Machado et al.’s
(2017) dealt with corners.
They did not model selfloops in the MDP, despite the fact that the agent can be in the same state for two consecutive steps.
The successor representation captures this naturally.
Finally, we use Figure 11a to speculate why the options learned after 100 episodes are capable of reducing the agent’s diffusion time.
The ﬁrst eigenoption learned by the agent moves it to the parts of the state space it has never been to, this may be the reason that the combination of these options is so effective.
It also suggests that incremental methods for option discovery and exploration are a promising path for future work.
U SING EIGENOPTIONS TO ACCUMULATE REWARD IN THE ENVIRONMENT
In Section 4.1 we also evaluated the agent’s ability to accumulate reward after the eigenoptions have been learned.
We further analyze this topic here.
As in Section 4.1, the agent learned, off-policy, the greedy policy over primitive actions (target policy) while following the uniform random policy over actions and eigenoptions (behavior policy).
We used Q-learning (Watkins & Dayan, 1992) in our experiments – parameters λ = 0 , α = 0 .
1 , and γ = 0 .
Episodes were 100 time steps long.
Figures 16–19 summarize the obtained results comparing the performance of our approach to regular Q-learning over primitive actions in four different environments ( c.f. Figure 15).
We evaluate the agent’s performance when using eigenoptions extracted from estimates of the SR obtained after 100 , 500 , and 1000 episodes, as well eigenoptions obtained from the true SR, i.e. , ( I − γT ) − 1 .
The reported results are the average over 24 independent runs when learning the SR, with each one of these runs encoding 100 runs evaluating Q-Learning.
The options were added following the sorting provided by the eigenvalues.
For example, 4 options denotes an agent with the action set used in the behavior policy being composed of the four primitive actions and the four eigenoptions generated by the top 2 eigenvalues (both directions are being used).
We can see that eigenoptions are not only capable of reducing the diffusion time in the environment but of also improving the agent’s control performance.
They do so by increasing the likelihood that the agent will cover a larger part of the state space given the same amount of time.
Interestingly, few eigenoptions seem to be enough for the agent.
Moreover, although rough estimates of the SR seem to be enough to improve the agent’s performance ( e.g. , estimates obtained after only 100 episodes).
More accurate predictions of the SR are able to further improve the agent’s performance, mainly when dozens of eigenoptions are being used.
The ﬁrst eigenoptions to be accurately estimated are those with larger eigenvalues, which are the ones we add ﬁrst.
E VALUATION OF THE RECONSTRUCTION TASK
In Section 4.2 we analyzed the eigenoptions we are able to discover in four games of the Arcade
Learning Environment.
We did not discuss the performance of the proposed network in the auxiliary tasks we deﬁned.
We do so here.
Figures 20–23 depict a comparison between the target screen that should be predicted and the network’s actual prediction for ten time steps in each game.
We can see that it accurately predicts the general structure of the environment and it is able to keep track of most moving sprites on the screen.
The prediction is quite noisy, different from Oh et al.’s (2015) result.
Still, it is interesting to see how even an underperforming network is able to learn useful representations for our algorithm.
It is likely better representations would result in better options.
E IGENOPTIONS DISCOVERED IN F REEWAY
Figure 6 depicts the two meaningful eigenoptions we were able to discover in the game F REEWAY .
As in Figure 5, each option is represented by the normalized count of the avatar’s position on the screen in a trajectory.
The trajectories generated by different options are represented by different colors and the color’s intensity at a given location represents how often the agent was at that location.
[Figure]
[Figure]
[Figure]
[Figure]
[Figure]
[Figure]
[Figure]
[Figure] [Figure] [Figure] [Figure]
[Figure] [Figure]
[Figure] [Equation]
[Figure] [Figure]
[Figure] [Figure]
Target
[Equation]
t =
[Equation] [Equation]
[Equation]
[Equation]