Matthieu Geist
email: matthieu.geist@supelec.fr

Bruno Scherrer
email: bruno.scherrer@inria.fr

Off-policy Learning with Eligibility Traces: A Survey

Keywords: Reinforcement Learning, Value Function Estimation, Off-policy Learning, Eligibility Traces

In the framework of Markov Decision Processes, off-policy learning, that is the problem of learning a linear approximation of the value function of some fixed policy from one trajectory possibly generated by some other policy. We briefly review on-policy learning algorithms of the literature (gradient-based and least-squares-based), adopting a unified algorithmic view. Then, we highlight a systematic approach for adapting them to off-policy learning with eligibility traces. This leads to some known algorithms -offpolicy LSTD(λ), LSPE(λ), TD(λ), TDC/GQ(λ) -and suggests new extensions -offpolicy FPKF(λ), BRM(λ), gBRM(λ), GTD2(λ). We describe a comprehensive algorithmic derivation of all algorithms in a recursive and memory-efficent form, discuss their known convergence properties and illustrate their relative empirical behavior on Garnet problems. Our experiments suggest that the most standard algorithms on and off-policy LSTD(λ)/LSPE(λ) -and TD(λ) if the feature space dimension is too large for a leastsquares approach -perform the best.

Introduction

We consider the problem of learning a linear approximation of the value function of some fixed policy in a Markov Decision Process (MDP) framework, in the most general situation where learning must be done from a single trajectory possibly generated by some other policy, also known as off-policy learning. Given samples, well-known methods for estimating a value function are temporal difference (TD) learning and Monte Carlo [START_REF] Sutton | Reinforcement Learning: An Introduction (Adaptive Computation and Machine Learning)[END_REF]. TD learning with eligibility traces [START_REF] Sutton | Reinforcement Learning: An Introduction (Adaptive Computation and Machine Learning)[END_REF], known as TD(λ), constitutes a nice bridge between both approaches, and by controlling the bias/variance trade-off [START_REF] Kearns | Bias-Variance Error Bounds for Temporal Difference Updates[END_REF], their use can significantly speed up learning. When the value function is approximated through a linear architecture, the depth λ of the eligibility traces is also known to control the quality of approximation [START_REF] Tsitsiklis | An analysis of temporal-difference learning with function approximation[END_REF]. Overall, the use of these traces often plays an important practical role.

There has been a significant amount of research on parametric linear approximation of the value function, without eligibility traces (in the on-or off-policy case). We follow the taxonomy proposed by [START_REF] Geist | An Algorithmic Survey of Parametric Value Function Approximation[END_REF], briefly recalled in Table 1 and further gradient-based least-squares-based bootstrapping TD FPKF [START_REF] Sutton | Reinforcement Learning: An Introduction (Adaptive Computation and Machine Learning)[END_REF]) [START_REF] Choi | A Generalized Kalman Filter for Fixed Point Approximation and Efficient Temporal-Difference Learning[END_REF]) residual gBRM BRM [START_REF] Baird | Residual Algorithms: Reinforcement Learning with Function Approximation[END_REF]) [START_REF] Engel | Algorithms and Representations for Reinforcement Learning[END_REF][START_REF] Geist | Kalman Temporal Differences[END_REF]) projected fixed point TDC/GTD2 LSTD [START_REF] Bradtke | Linear Least-Squares algorithms for temporal difference learning[END_REF]) [START_REF] Sutton | Fast gradient-descent methods for temporal-difference learning with linear function approximation[END_REF] LSPE [START_REF] Nedić | Least Squares Policy Evaluation Algorithms with Linear Function Approximation[END_REF] Table 1: Taxonomy of linearly parameterized estimators for value function approximation [START_REF] Geist | An Algorithmic Survey of Parametric Value Function Approximation[END_REF].

developped in Section 2. Value function approximators can be categorized depending on the cost function they minimize (based on bootstrapping, on a Bellman residual minimization or on a projected fixed point approach) and on how it is minimized (gradient-descentbased or linear least-squares). Most of these algorithms have been extended to take into account eligibility traces, in the on-policy case. Works on extending these approaches (based on eligibility traces) to off-policy learning are scarser. They are summarized in Table 2 (algorithms in black). The first motivation of this article is to argue that it is conceptually simple to extend all the algorithms of Table 1 so that they can be applied to the off-policy setting and use eligibility traces. If this allows rederiving existing algorithms (in black in Table 2), it also leads to new candidate algorithms (in red in Table 2). The second motivation of this work is to discuss the subtle differences between these intimatelyrelated algorithms, and to provide some comparative insights on their empirical behavior (a topic that has to our knowledge not been considered in the literature, even in the simplest on-policy and no-trace situation).

gradient-based least-squares-based bootstrapping off-policy TD(λ) off-policy FPKF(λ) (Bertsekas and Yu, 2009a) residual off-policy gBRM(λ) off-policy BRM(λ) projected fixed point GQ(λ) (a.k.a. off-policy TDC(λ)) off-policy LSTD(λ) [START_REF] Maei | GQ(λ): A general gradient algorithm for temporaldifference prediction learning with eligibility traces[END_REF] off-policy LSPE(λ) off-policy GTD2(λ) (Yu, 2010a) Table 2: Surveyed off-policy and eligibility-traces-based approaches. Algorithms in black have been published before (provided references), algorithms in red are new.

The rest of this article is organized as follows. Section 2 introduces the background of Markov Decision Processes, describes the state-of-the-art algorithms for learning without eligibility traces, and gives the fundamental idea to extend the methods to the off-policy situation with eligibility traces. Section 3 details this extension for the least-squares based approaches: the resulting algorithms are formalized, and we derive recursive and memoryefficient formula for their implementation (this allows online learning without loss of generality, all the more that half of these algorithms are recursive by their very definition), and we discuss their convergence properties. Section 4 does the same job for stochastic gradient based approaches, which offers a smaller computational cost (linear per update, instead of quadratic). Last but not least, Section 5 describes an empirical comparison and Section 6 concludes.

Background

We consider a Markov Decision Process (MDP), that is a tuple {S, A, P, R, γ} in which S is a finite state space identified with {1, 2, . . . , N }, A a finite action space, P ∈ P(S) S×A the set of transition probabilities, R ∈ R S×A the reward function and γ the discount factor. A mapping π ∈ P(A) S is called a policy. For any policy π, let P π be the corresponding stochastic transition matrix, and R π the vector of mean reward when following π, i.e., of components E a|π,s [R(s, a)]. The value V π (s) of state s for a policy π is the expected discounted cumulative reward starting in state s and then following the policy π:

V π (s) = E π ∞ i=0 γ i r i |s 0 = s ,
where E π denotes the expectation induced by policy π. The value function satisfies the (linear) Bellman equation: ∀s, V π (s) = E s ,a|s,π [R(s, a) + γV π (s )].

It can be rewritten as the fixed-point of the Bellman evaluation operator: V π = T π V π where for all V, T π V = R π + γP π V .

In this article, we are interested in learning an approximation of this value function V π under some constraints. First, we assume our approximation to be linearly parameterized: ∀s, Vθ (s) = θ T φ(s) with θ ∈ R p being the parameter vector and φ(s) ∈ R p the feature vector in state s. Also, we want to estimate the value function V π (or equivalently the associated parameter θ) from a single finite trajectory generated using a possibly different behavioral policy π 0 . Let µ 0 be the stationary distribution of the stochastic matrix P 0 = P π 0 of the behavior policy π 0 (we assume it exists and is unique). Let D 0 be the diagonal matrix of which the elements are (µ 0 (s i )) 1≤i≤N . Let Φ be the matrix of feature vectors: Φ = [φ(1) . . . φ(N )] T .

The projection Π 0 onto the hypothesis space spanned by Φ with respect to the µ 0 -quadratic norm, which will be central for the understanding of the algorithms, has the following closed-form:

Π 0 = Φ(Φ T D 0 Φ) -1 Φ T D 0 .
If π 0 is different from π, it is called an off-policy setting. Notice that all algorithms considered in this paper use this Π 0 projection operator, that is the projection according to the observed data 1 .

Standard Algorithms for on-policy Learning without Traces. We now review existing on-policy linearly parameterized temporal difference learning algorithms (see Table 1).

In this case, the behavior and target policies are the same, so we omit the subscript 0 for the policy (π) and the projection (Π). We assume that a trajectory (s 1 , a 1 , r 1 , s 2 , . . . , s i , a i , r i , s i+1 , . . . , s n , a n , r n , s n+1 ) sampled according to the policy π is available, and will explain how to compute the i th iterate for several algorithms. For all j ≤ i, let us introduce the empirical Bellman operator at step j:

Tj : R S → R V → r j + γV (s j+1 )
so that Tj V is an unbiased estimate of T V (s j ).

Projected fixed point approaches aim at finding the fixed-point of the operator being the composition of the projection onto the hypothesis space and of the Bellman operator. In other words, they search for the fixed-point Vθ = ΠT Vθ , Π being the just introduced projection operator. Solving the following fixed-point problem:

θ i = argmin ω∈R p i j=1 Tj Vθ i -Vω (s j )
2 with a least-squares approach, corresponds to the Least-Squares Temporal Differences (LSTD) algorithm of [START_REF] Bradtke | Linear Least-Squares algorithms for temporal difference learning[END_REF]. Recently, [START_REF] Sutton | Fast gradient-descent methods for temporal-difference learning with linear function approximation[END_REF] proposed two algorithms reaching the same objective, Temporal Difference with gradient Correction (TDC) and Gradient Temporal Difference 2 (GTD2), by performing a stochastic gradient descent of the function θ → Vθ -ΠT Vθ 2 which is minimal (and equal to 0) when Vθ = ΠT Vθ . A related approach consists in building a recursive algorithm that repeatedly mimicks the iteration Vθ i ΠT Vθ i-1 . In practice, we aim at minimizing

ω → i j=1 Tj Vθ i-1 -Vω (s j ) 2 .
Performing the minimization exactly through a least-squares method leads to the Least-Squares Policy Evaluation (LSPE) algorithm of [START_REF] Bertsekas | Temporal differences-based policy iteration and applications i n neuro-dynamic programming[END_REF]. If this minimization is approximated by a stochastic gradient descent, this leads to the classical Temporal Difference (TD) algorithm [START_REF] Sutton | Reinforcement Learning: An Introduction (Adaptive Computation and Machine Learning)[END_REF].

1. It would certainly be interesting to consider the projection according to the stationary distribution of π, the (unobserved) target policy: this would reduce off-policy learning to on-policy learning. However, this would require reweighting samples according to the stationary distribution of the target policy π, which is unknown and probably as difficult to estimate as the value function itself. As far as we know, the only work to move in this direction is the off-policy approach of [START_REF] Kolter | The Fixed Ponts of Off-Policy TD[END_REF]: samples are weighted such that the projection operator composed with the Bellman operator is non-expansive (so, weaker than finding the projection of the stationary distribution, but offering some guarantees). In this article, we consider only the Π0 projection.

Bootstrapping approaches consist in treating value function approximation after seeing the i th transition as a supervised learning problem, by replacing the unobserved values V π (s j ) at states s j by some estimate computed from the trajectory until the transition (s j , s j+1 ), the best such estimate being Tj Vθ j-1 . This amounts to minimizing the following function:

ω → i j=1 Tj Vθ j-1 -Vω (s j ) 2 .
(1) [START_REF] Choi | A Generalized Kalman Filter for Fixed Point Approximation and Efficient Temporal-Difference Learning[END_REF] proposed the Fixed-Point Kalman Filter (FPKF), a least-square variation of TD that minmizes exactly the function of Equation ( 1). If the minimization is approximated by a stochastic gradient descent, this gives -again -the classical TD algorithm [START_REF] Sutton | Reinforcement Learning: An Introduction (Adaptive Computation and Machine Learning)[END_REF].

Finally, residual approaches aim at minimizing the distance between the value function and its image through the Bellman operator, V -T V2 µ 0 . Based on a trajectory, this suggests the following function to minimize

ω → i j=1 Tj Vω -Vω (s j ) 2 ,
which is a biased surrogate of the objective V -T V 2 µ 0 (for instance, see [START_REF] Antos | Learning Near-optimal Policies with Bellman-residual Minimization based Fitted Policy Iteration and a Single Sample Path[END_REF]). This cost function has originally been proposed by [START_REF] Baird | Residual Algorithms: Reinforcement Learning with Function Approximation[END_REF] who minimized it using a stochastic gradient approach (this algorithm being referred here as gBRM for gradient-based Bellman Residual Minimization). Both the parametric Gaussian Process Temporal Differences (GPTD) algorithm of [START_REF] Engel | Algorithms and Representations for Reinforcement Learning[END_REF] and the linear Kalman Temporal Differences (KTD) algorithm of [START_REF] Geist | Kalman Temporal Differences[END_REF] can be shown to minimize the above cost using a least-squares approach, and are thus the very same algorithm 2 , that we will refer to as BRM (for Bellman Residual Minimization) in the remaining of this paper.

To sum up, it thus appears that after the i th transition has been observed, the above mentioned algorithms behave according to the following pattern:

move from θ i-1 to θ i towards the minimum of ω → i j=1 Tj Vξ -Vω (s j ) 2 , ( 2
)
either through a least-squares approach or a stochastic gradient descent. Each of the algorithms mentionned above is obtained by substituting θ i , θ i-1 , θ j-1 or ω for ξ.

Towards Off-policy Learning with Traces

It is now easy to preview, at least at a high level, how one may extend the previously described algorithms so that they can deal with eligibility traces and off-policy learning. The idea of eligibility traces amounts to looking for the fixed-point of the following variation of the Bellman operator [START_REF] Bertsekas | Neuro-Dynamic Programming[END_REF])

∀V ∈ R S , T λ V = (1 -λ) ∞ k=0 λ k T k+1 V
that makes a geometric average with parameter λ ∈ (0, 1) of the powers of the original Bellman operator T . Clearly, any fixed-point of T is a fixed-point of T λ and vice-versa. After some simple algebra, one can see that:

T λ V = (I -λγP ) -1 (R + (1 -λ)γP V ) (3) = V + (I -λγP ) -1 (R + γP V -V ).
This leads to the following well-known temporal difference-based expression in some state s

T λ V (s) = V (s) + E π ∞ k=i (γλ) k-i r k + γV (s k+1 ) -V (s k ) s i = s = V (s) + ∞ k=i (γλ) k-i δ ik (s)
where we recall that E π means that the expectation is done according to the target policy π, and where we [START_REF] Sutton | Reinforcement Learning: An Introduction (Adaptive Computation and Machine Learning)[END_REF]. With λ = 0, we recover the Bellman evaluation equation. With λ = 1, this is the definition of the value function as the expected and discounted cumulative reward:

δ ik (s) = E π r k + γV (s k+1 ) -V (s k ) s i = s is the expected temporal- difference
T 1 V (s) = E π [ ∞ k=i γ k-i r k |s i = s].
As before, we assume that we are given a trajectory (s 1 , a 1 , r 1 , s 2 , . . . , s j , a j , r j , s j+1 . . . , s n , a n , r n , s n+1 ), except now that it may be generated from some behaviour policy possibly different from the target policy π of which we want to estimate the value. We are going to describe how to compute the i th iterate for several algorithms. For any i ≤ k, unbiased estimates of the temporal difference terms δ ik (s k ) can be computed through importance sampling [START_REF] Ripley | Stochastic Simulation[END_REF]. Indeed, for all s, a, let us introduce the following weight: ρ(s, a) = π(a|s) π 0 (a|s) .

In our trajectory context, for any j and k, write

ρ k j = k l=j ρ l with ρ l = ρ(s l , a l ) with the convention that if k < j, ρ k j = 1. With these notations, δik = ρ k i Tk V -ρ k-1 i V (s k )
is an unbiased estimate of δ ik (s k ), from which we may build an estimate T λ j,i V of T λ V (s j ) (we will describe this very construction separately for the least-squares and the stochastic gradient as they slightly differ). Then, by replacing the empirical operator Tj in Equation (2) by T λ j,i , we get the general pattern for off-policy trace-based algorithms:

move from θ i-1 to θ i towards the minimum of ω → i j=1 T λ j,i Vξ -Vω (s j ) 2 , ( 4
)
either through a least-squares approach or a stochastic gradient descent after having instantiated ξ = θ i , θ i-1 , θ j-1 or ω. This process, including in particular the precise definition of the empirical operator T λ j,i , will be further developped in the next two sections3 . Since they are easier to derive, we begin by focusing on least-squares algorithms (right column of Table 2) in Section 3. Then, Section 4 focuses on stochastic gradient descent-based algorithms (left column of Table 2).

Least-squares-based extensions to eligibility traces and off-policy learning

In this section, we first consider the case of least-squares solving of the pattern described in Equation (4). At their i th step, the algorithms that we are about to describe will compute the parameter θ i by exactly solving the following problem:

θ i = argmin ω∈R p i j=1 T λ j,i Vξ -Vω (s j ) 2
where we define the following empirical truncated approximation of T λ :

T λ j,i : R S → R V → V (s j ) + i k=j (γλ) k-j δjk = V (s j ) + i k=j (γλ) k-j ρ k j Tk V -ρ k-1 j V (s k ) .
Though different definitions of this operator may lead to practical implementations, note that T λ j,i only uses samples seen before time i: this very feature -considered by all existing works in the literature -will enable us to derive recursive and low-memory algorithms.

Recall that a linear parameterization is chosen here, Vξ (s i ) = ξ T φ(s i ). We adopt the following notations:

φ i = φ(s i ), ∆φ i = φ i -γρ i φ i+1 and ρk-1 j = (γλ) k-j ρ k-1 j
The generic cost function to be solved is therefore:

θ i = argmin ω∈R p J(ω; ξ) with J(ω; ξ) = i j=1 (φ T j ξ + i k=j ρk-1 j (ρ k r k -∆φ T k ξ) -φ T j ω) 2 . (5)
Before deriving existing and new least-squares-based algorithms, as announced, some technical lemmata are required.

The first lemma allows computing directly the inverse of a rank-one perturbated matrix.

Lemma 1 (Sherman-Morrison) Assume that A is an invertible n × n matrix and that u, v ∈ R n are two vectors satisfying 1 + v T A -1 u = 0. Then:

(A + uv T ) -1 = A -1 - A -1 uv T A -1 1 + v T A -1 u
The next lemma is simply a rewriting of imbricated sums. However, it is quite important here as it will allow stepping from the operator T λ j,i (operator which depends on future of s j ) -forward view of eligibility traces -to the recursion over parameters using eligibility traces (dependence on only past samples) -backward view of eligibility traces -(see (Sutton and Barto, 1998, Ch.7) for further discussion on backward/forward views).

Lemma 2 Let f ∈ R N×N and n ∈ N. We have:

n i=1 n j=i f (i, j) = n i=1 i j=1 f (j, i)
We are now ready to mechanically derive the off-policy algorithms LSTD(λ), LSPE(λ), FPKF(λ) and BRM(λ). This is what we do in the following subsections.

Off-policy LSTD(λ)

The off-policy LSTD(λ) algorithm corresponds to instantiating Problem (5) with ξ = θ i :

θ i = argmin ω∈R p i j=1 (φ T j θ i + i k=j ρk-1 j (ρ k r k -∆φ T k θ i ) -φ T j ω) 2 .
This can be solved by zeroing the gradient respectively to ω:

θ i = ( i j=1 φ j φ T j ) -1 i j=1 φ j (φ T j θ i + i k=j ρk-1 j (ρ k r k -∆φ T k θ i )) ⇔ 0 = i j=1 i k=j φ j ρk-1 j (ρ k r k -∆φ T k θ i ),
which, through Lemma 2, is equivalent to:

0 = i j=1 ( j k=1 φ k ρj-1 k )(ρ j r j -∆φ T j θ i ).
Introducing the (importance based) eligibility vector z j :

z j = j k=1 φ k ρj-1 k = j k=1 φ k (γλ) j-k j-1 m=k ρ m = γλρ j-1 z j-1 + φ j , ( 6
)
one obtains the following batch estimate:

θ i = ( i j=1 z j ∆φ T j ) -1 i j=1 z j ρ j r j = (A i ) -1 b i (7)
where

A i = i j=1 z j ∆φ T j and b i = i j=1 z j ρ j r j . ( 8
)
Thanks to Lemma 1, the inverse M i = (A i ) -1 can be computed recursively:

M i = ( i j=1 z j ∆φ T j ) -1 = M i-1 - M i-1 z i ∆φ T i M i-1 1 + ∆φ T i M i-1 z i .
This can be used to derive a recursive estimate:

θ i = ( i j=1 z j ∆φ T j ) -1 i j=1 z j ρ j r j = (M i-1 - M i-1 z i ∆φ T i M i-1 1 + ∆φ T i M i-1 z i )( i-1 j=1 z j r j ρ j + z i ρ i r i ) = θ i-1 + M i-1 z i 1 + ∆φ T i M i-1 z i (ρ i r i -∆φ T i θ i-1 ).
Writing K i the gain

M i-1 z i 1+∆φ T i M i-1 z i
, this gives Algorithm 1.

Algorithm 1: Off-policy LSTD(λ)

Initialization;

Initialize vector θ 0 and matrix M 0 ; Set z 0 = 0;

for i = 1, 2, . . . do Observe φ i , r i , φ i+1 ;
Update traces ;

z i = γλρ i-1 z i-1 + φ i ;
Update parameters ;

K i = M i-1 z i 1+∆φ T i M i-1 z i ; θ i = θ i-1 + K i (ρ i r i -∆φ T i θ i-1 ) ; M i = M i-1 -K i (M T i-1 ∆φ i ) T ; end
This algorithm has been proposed and analyzed recently by Yu (2010a). The author proves the following result: if the behavior policy π 0 induces an irreducible Markov chain and chooses with positive probability any action that may be chosen by the target policy π, and if the compound (linear) operator Π 0 T λ has a unique fixed-point 4 , then off-policy LSTD(λ) converges to it almost surely. Formally, it converges to the solution θ * of the so-called projected fixed-point equation:

V θ * = Π 0 T λ V θ * . ( 9
)
Using the expression of the projection Π 0 and the form of the Bellman operator in Equation (3), it can be seen that θ * satisfies (see Yu (2010a) for details)

θ * = A -1 b 4.
It is not always the case, see [START_REF] Tsitsiklis | An analysis of temporal-difference learning with function approximation[END_REF] for a counter-example.

where

A = Φ T D 0 (I -γP )(I -λγP ) -1 Φ and b = Φ T D 0 (I -λγP ) -1 R. ( 10
)
The core of the analysis of Yu (2010a) consists in showing that 1 i A i and 1 i b i defined in Equation ( 8) respectively converge to A and b almost surely. Through Equation ( 7), this implies the convergence of θ i to θ * .

Off-policy LSPE(λ)

The off-policy LSPE(λ) algorithm corresponds to the instantiation ξ = θ i-1 in Problem (5):

θ i = argmin ω∈R p i j=1 (φ T j θ i-1 + i k=j ρk-1 j (ρ k r k -∆φ T k θ i-1 ) -φ T j ω) 2 .
This can be solved by zeroing the gradient respectively to ω:

θ i = ( i j=1 φ j φ T j ) -1 i j=1 φ j (φ T j θ i-1 + i k=j ρk-1 j (ρ k r k -∆φ T k θ i-1 )) = θ i-1 + ( i j=1 φ j φ T j ) -1 i j=1 i k=j φ j ρk-1 j (ρ k r k -∆φ T k θ i-1 ).
Lemma 2 can be used (recall the definition of the eligibility vector z j in Equation ( 6)):

θ i = θ i-1 + ( i j=1 φ j φ T j ) -1 i j=1 j k=1 φ k ρj-1 k (ρ j r j -∆φ T j θ i-1 ) = θ i-1 + ( i j=1 φ j φ T j ) -1 i j=1 z j (ρ j r j -∆φ T j θ i-1 ).
Define the matrix N i as follows:

N i = ( i j=1 φ j φ T j ) -1 = N i-1 - N i-1 φ i φ T i N i-1 1 + φ T i N i-1 φ i , ( 11
)
where the second equality follows from Lemma 1. Let A i and b i be defined as in the LSTD description in Equation ( 8). For clarity, we restate their definition along with their recursive writing:

A i = i j=1 z j ∆φ T j = A i-1 + z i ∆φ T i+1 b i = i j=1 z j ρ j r j = b i-1 + z i ρ i r i .
Then, it can be seen that the LSPE(λ) update is:

θ i = θ i-1 + N i (b i -A i θ i-1 ).
Algorithm 2: Off-policy LSPE(λ)

Initialization;

Initialize vector θ 0 and matrix N 0 ; Set z 0 = 0, A 0 = 0 and b 0 = 0;

for i = 1, 2, . . . do Observe φ i , r i , φ i+1 ;
Update traces ;

z i = γλρ i-1 z i-1 + φ i ;
Update parameters ;

N i = N i-1 - N i-1 φ i φ T i N i-1 1+φ T i N i-1 φ i ; A i = A i-1 + z i ∆φ T i ; b i = b i-1 + ρ i z i r i ; θ i = θ i-1 + N i (b i -A i θ i-1 ) ; end The overall computation is provided in Algorithm 2.
This algorithm, (briefly) mentioned by Yu (2010a), generalizes the LSPE(λ) algorithm of [START_REF] Bertsekas | Temporal differences-based policy iteration and applications i n neuro-dynamic programming[END_REF] to off-policy learning. With respect to LSTD(λ), which computes θ i = (A i ) -1 b i (cf. Equation ( 7)) at each iteration, LSPE(λ) is fundamentally recursive (as it is based on an iterated fixed-point search). Along with the almost sure convergence of 1 i A i and 1 i b i to A and b (defined in Equation ( 10)), it can be shown that iN i converges to N = (Φ T D 0 Φ) -1 (see for instance [START_REF] Nedić | Least Squares Policy Evaluation Algorithms with Linear Function Approximation[END_REF]) so that, asymptotically, LSPE(λ) behaves as:

θ i = θ i-1 + N (b -Aθ i-1 ) = N b + (I -N A)θ i-1
or using the defintion of Π 0 , A, b (Equation ( 10)) and T λ (Equation (3)):

V θ i = Φθ i = ΦN b + Φ(I -N A)θ i-1 = Π 0 T λ V θ i-1 . ( 12
)
The behavior of this sequence depends on whether the spectral radius of Π 0 T λ is smaller than 1 or not. Thus, the analyses of Yu (2010a) and [START_REF] Nedić | Least Squares Policy Evaluation Algorithms with Linear Function Approximation[END_REF] (for the convergence of N i ) imply the following convergence result: under the assumptions required for the convergence of off-policy LSTD(λ), and the additional assumption that the operator Π 0 T λ has a spectral radius smaller than 1 (so that it is contracting), LSPE(λ) also converges almost surely to the fixed-point of the compound Π 0 T λ operator.

There are two sufficient conditions that can ensure such a desired contraction property. The first one is when one considers on-policy learning, as [START_REF] Nedić | Least Squares Policy Evaluation Algorithms with Linear Function Approximation[END_REF] did when they derived the first convergence proof of (on-policy) LSPE(λ). When the behavior policy π 0 is different from the target policy π, a sufficient condition for contraction is that λ be close enough to 1; indeed, when λ tends to 1, the spectral radius of T λ tends to zero and can potentially balance an expansion of the projection Π 0 . In the off-policy case, when γ is sufficiently big, a small value of λ can make Π 0 T λ expansive (see [START_REF] Tsitsiklis | An analysis of temporal-difference learning with function approximation[END_REF] for an example in the case λ = 0) and off-policy LSPE(λ) will then diverge. Eventually, Equations ( 9) and ( 12) show that when λ = 1, both LSTD(λ) and LSPE(λ) asymptotically coincide (as T 1 V does not depend on V ).

Off-policy FPKF(λ)

The off-policy FPKF(λ) algorithm corresponds to the instantiation ξ = θ j-1 in Problem (5):

θ i = argmin ω∈R p i j=1 (φ T j θ j-1 + i k=j ρk-1 j (ρ k r k -∆φ T k θ j-1 ) -φ T j ω) 2 .
This can be solved by zeroing the gradient respectively to ω:

θ i = N i i j=1 φ j (φ T j θ j-1 + i k=j ρk-1 j (ρ k r k -∆φ T k θ j-1 )),
where N i is the matrix introduced for LSPE(λ) in Equation ( 11). For clarity, we restate its definition here and its recursive writing:

N i = ( i j=1 φ j φ T j ) -1 = N i-1 - N i-1 φ i φ T i N i-1 1 + φ T i N i-1 φ i . ( 13
)
Using Lemma 2, one obtains:

θ i = N i ( i j=1 φ j φ T j θ j-1 + i j=1 j k=1 φ k ρj-1 k (ρ j r j -∆φ T j θ k-1 )).
With respect to the previously described algorithms, the difficulty here is that on the right side there is a dependence with all the previous terms θ k-1 for 1 ≤ k ≤ i. Using the symmetry of the dot product ∆φ T j θ k-1 = θ T k-1 ∆φ j , it is possible to write a recursive algorithm by introducing the trace matrix Z j that integrates the subsequent values of θ k as follows:

Z j = j k=1 ρj-1 k φ k θ T k-1 = Z j-1 + γλρ j-1 φ j θ T j-1 .
With this notation we obtain:

θ i = N i ( i j=1 φ j φ T j θ j-1 + i j=1 (z j ρ j r j -Z j ∆φ j )).
Using Equation ( 13) and a few algebraic manipulations, we end up with:

θ i = θ i-1 + N i (z i ρ i r i -Z i ∆φ i ).
This is the parameter update as provided in Algorithm 3. It generalizes the FPKF algorithm of [START_REF] Choi | A Generalized Kalman Filter for Fixed Point Approximation and Efficient Temporal-Difference Learning[END_REF] that was originally only introduced without traces and in the on-policy case. As LSPE(λ), this algorithm is Algorithm 3: Off-policy FPKF(λ)

Initialization;

Initialize vector θ 0 and matrix N 0 ; Set z 0 = 0 and Z 0 = 0;

for i = 1, 2, . . . do Observe φ i , r i , φ i+1 ; Update traces ; z i = γλρ i-1 z i-1 + φ i ; Z i = γλρ i-1 Z i-1 + φ i θ T i-1 ; Update parameters ; N i = N i-1 - N i-1 φ i φ T i N i-1 1+φ T i N i-1 φ i ; θ i = θ i-1 + N i (z i ρ i r i -Z i ∆φ i )
; end fundamentally recursive. However, its overall behavior is quite different. As we discussed for LSPE(λ), iN i can be shown to tend asymptotically to N = (Φ T D 0 Φ) -1 and FPKF(λ) iterates eventually resemble:

θ i = θ i-1 + 1 i N (z i ρ i r i -Z i ∆φ i ).
The term in brackets is a random component (that only depends on the last transition) and 1 i acts as a learning coefficient that asymptotically tends to 0. In other words, FPKF(λ) has a stochastic approximation flavour. In particular, one can see FPKF(0) as a stochastic approximation of LSPE(0). Indeed, asymptotically, FPKF(0) does the following update

θ i = θ i-1 + 1 i N (ρ i φ i r i -φ i ∆φ T i θ i-1 ),
and one can notice that ρ i φ i r i and φ i ∆φ T i are samples of A and b to which A i and b i converge through LSPE(0). When λ > 0, the situation is less clear -up to the fact that since T 1 V does not depend on V , we expect FPKF to asymptotically behave like LSTD and LSPE when λ tends to 1.

Due to its much more involved form (notably the matrix trace Z j integrating the values of all the values θ k from the start), it does not seem easy to provide a guarantee for FPKF(λ), even in the on-policy case. To our knowledge, there does not exist any proof of convergence for stochastic approximation algorithms in the off-policy case with traces 5 , and a related result for FPKF(λ) thus seems difficult. Based on the above-mentioned relation between FPKF(0) and LSPE(0) and the experiments we have run (see Section 5), we conjecture that off-policy FPKF(λ) has the same asymptotic behavior as LSPE(λ). We leave the formal study of this algorithm for future work.

5. An analysis of TD(λ), with a simplifying assumption that forces the algorithm to stay bounded is given by Yu (2010a). An analysis of GQ(λ) is provided by [START_REF] Maei | GQ(λ): A general gradient algorithm for temporaldifference prediction learning with eligibility traces[END_REF], with an assumption on the second moment of the traces, which does not hold in general (see Proposition 2 in (Yu, 2010a)). A full analysis of these algorithms thus remains to be done. See also Sections 4.1 and 4.2.

Off-policy BRM(λ)

The off-policy BRM(λ) algorithm corresponds to the instantiation ξ = ω in Problem (5):

θ i = argmin ω∈R p i j=1 (φ T j ω+ i k=j ρk-1 j (ρ k r k -∆φ T k ω)-φ T j ω) 2 = argmin ω∈R p i j=1 ( i k=j ρk-1 j (ρ k r k -∆φ T k ω)) 2 .
Define

ψ j→i = i k=j ρk-1 j ∆φ k and z j→i = i k=j ρk-1 j ρ k r k .
This yields the following batch estimate:

θ i = argmin ω∈R p i j=1 (z j→i -ψ T j→i ω) 2 = ( Ãi ) -1 bi ( 14
)
where

Ãi = i j=1 ψ j→i ψ T j→i and bi = i j=1 ψ j→i z j→i .
The transformation of this batch estimate into a recursive update rule is somewhat tedious (it involves three "trace" variables), and the details are deferred to Appendix A for clarity.

The resulting BRM(λ) method is provided in Algorithm 4. Note that at each step, this algorithm involves the inversion of a 2×2 matrix (involving the 2×2 identity matrix I 2 ), inversion that admits a straightforward analytical solution. The computational complexity of an iteration of BRM(λ) is thus O(p 2 ) (as for the preceding least-squares-based algorithms). GPTD and KTD, which are close to BRM, have also been extended with some trace mechanism; however, GPTD(λ) [START_REF] Engel | Algorithms and Representations for Reinforcement Learning[END_REF] 6 , KTD(λ) (Geist and Pietquin, 2010a) and the just described BRM(λ) are different algorithms. Briefly, GPTD(λ) is very close to LSTD(λ) and KTD(λ) uses a different Bellman operator 7 . As BRM(λ) builds a linear system whose solution is updated recursively, it resembles LSTD(λ). However, the system it builds is different. The following theorem, proved in Appendix B, partially characterizes the behavior of BRM(λ) and its potential limit 8 . Theorem 3 Assume that the stochastic matrix P 0 of the behavior policy is irreducible and has stationary distribution µ 0 . Further assume that there exists a coefficient

β < 1 such that ∀(s, a), λγρ(s, a) ≤ β, ( 15
)
6. Technically, GPTD(λ) is not exactly a generalization of GPTD as it does not reduce to it when λ = 0. It is rather a variation. 7. The corresponding loss is ( T 0

j,i V (ω) -Vω(sj) + γλ( T 1 j+1,i V (ω) -Vω(sj+1))) 2 . With λ = 0 it gives T 0 j,i
and with λ = 1 it provides T 1 j,i . 8. Our proof is similar to that of Proposition 4 in [START_REF] Bertsekas | Projected Equation Methods for Approximate Solution of Large Linear Systems[END_REF]. The overall arguments are the following: Equation ( 15) implies that the traces can be truncated at some depth l, whose influence on the potential limit of the algorithm vanishes when l tends to ∞. For all l, the l-truncated version of the algorithm can easily be analyzed through the ergodic theorem for Markov chains. Making l tend to ∞ allows tying the convergence of the original arguments to that of the truncated version. Eventually, the formula for the limit of the truncated algorithm is computed and one derives the limit.

Algorithm 4: Off-policy BRM(λ)

Initialization;

Initialize vector θ 0 and matrix C 0 ; Set y 0 = 0, D 0 = 0 and z 0 = 0;

for i = 1, 2, . . . do Observe φ i , r i , φ i+1 ;
Pre-update traces ;

y i = (γλρ i-1 ) 2 y i-1 + 1 ; Compute ; U i = √ y i ∆φ i + γλρ i-1 √ y i D i-1 γλρ i-1 √ y i D i-1 T ; V i = √ y i ∆φ i + γλρ i-1 √ y i D i-1 -γλρ i-1 √ y i D i-1 T ; W i = √ y i ρr i + γλρ i-1 √ y i z i-1 -γλρ i-1 √ y i z i-1 T ;
Update parameters ;

θ i = θ i-1 + C i-1 U i (I 2 + V i C i-1 U i ) -1 (W i -V i θ i-1 ) ; C i = C i-1 -C i-1 U i (I 2 + V i C i-1 U i ) -1 V i C i-1 ; Post-update traces ; D i = (γλρ i-1 )D i-1 + ∆φ i y i ; z i = (γλρ i-1 )z i-1 + r i ρ i y i ; end then 1
i Ãi and 1 i bi respectively converge almost surely to

à = Φ T D -γDP -γP T D + γ 2 D + S(I -γP ) + (I -γP T )S T Φ b = Φ T (I -γP T )Q T D + S R π
where we wrote:

D = diag (I -(λγ) 2 P T ) -1 µ 0 Q = (I -λγP ) -1 D = diag P T (I -(λγ) 2 P T ) -1 µ 0 S = λγ(DP -γD )Q
and where P is the matrix whose coordinates are pss = a π(a|s)ρ(s, a)P (s |s, a). Then, the BRM(λ) algorithm converges with probability 1 to Ã-1 b.

The assumption given by Equation ( 15) trivially holds in the on-policy case (in which ρ(s, a) = 1 for all (s, a)) and in the off-policy case when λγ is sufficiently small with respect to the mismatch between policies. Note in particular that this result implies the almost sure convergence of the GPTD/KTD algorithms in the on-policy and no-trace case, a question that was still open in the literature (see for instance the conclusion of [START_REF] Engel | Algorithms and Representations for Reinforcement Learning[END_REF]). The matrix P , which is in general not a stochastic matrix, can have a spectral radius bigger than 1; Equation (15) ensures that (λγ) 2 P has a spectral radius smaller than β so that D and D are well defined. Removing assumption of Equation ( 15) does not seem easy, since by tuning λγ maliciously, one may force the spectral radius of (λγ) 2 P to be as close to 1 as one may want, which would make à and b diverge. Though the quantity Ã-1 b may compensate for these divergences, our current proof technique cannot account for this situation and a related analysis constitutes possible future work.

The fundamental idea behind the Bellman Residual approach is to address the computation of the fixed-point of T λ differently from the previous methods. Instead of computing the projected fixed-point as in Equation ( 9), one considers the following overdetermined system

Φθ T λ Φθ ⇔ Φθ (I -λγP ) -1 (R + (1 -λ)γP Φθ) (Equation (3)) ⇔ Φθ QR + (1 -λ)γP QΦθ ⇔ Ψθ QR with Ψ = Φ -(1 -λ)
γP QΦ, and solves it in a least-squares sense, that is by computing θ * = Ā-1 b with Ā = Ψ T Ψ and b = Ψ T QR. One of the motivations for this approach is that, as opposed to the matrix A of LSTD/LSPE/FPKF, Ā is invertible for all values of λ, and one can always guarantee a finite error bound with respect to the best projection (see [START_REF] Schoknecht | Optimality of Reinforcement Learning Algorithms with Linear Function Approximation[END_REF]; [START_REF] Yu | New Error Bounds for Approximations from Projected Linear Equations[END_REF]; [START_REF] Scherrer | Should one compute the Temporal Difference fix point or minimize the Bellman Residual? The unified oblique projection view[END_REF]). If the goal of BRM(λ) is to compute Ā and b from samples, what it actually computes ( à and b as characterized in Theorem 3) will in general be biased because the estimation is based on a single trajectory9 . Such a bias adds an uncontrolled variance term to Ā and b (for instance, see [START_REF] Antos | Learning Near-optimal Policies with Bellman-residual Minimization based Fitted Policy Iteration and a Single Sample Path[END_REF]); an interesting consequence is that à is always non-singular10 . More precisely, there are two sources of bias in the estimation: one results from the non Monte-carlo evaluation (the fact that λ < 1) and the other from the use of the correlated importance sampling factors (as soon as one considers off-policy learning). The interested reader may check that in the on-policy case, and when λ tends to 1, à and b coincide with Ā and b. However, in the strictly off-policy case, taking λ = 1 does not prevent the bias due to the correlated importance sampling factors. If we have argued that LSTD/LSPE/FPKF should asymptotically coincide when λ = 1, we see here that BRM should generally differ in an off-policy situation.

Stochastic gradient based extensions to eligibility traces and off-policy learning

We have just provided a systematic derivation of all least-squares-based algorithms for learning with eligibility traces in an off-policy manner. When the number of features p is very large, the O(p 2 ) complexity involved by a least-squares approach may be prohibitive.

In such a situation, a natural alternative is to consider an approach based on a stochastic gradient descent of the objective function of interest [START_REF] Bottou | The tradeoffs of large scale learning[END_REF][START_REF] Sutton | Fast gradient-descent methods for temporal-difference learning with linear function approximation[END_REF][START_REF] Maei | GQ(λ): A general gradient algorithm for temporaldifference prediction learning with eligibility traces[END_REF].

In this section, we will describe a systematic derivation of stochastic gradient based algorithms for learning in an off-policy manner with eligibility traces. The principle followed is the same as for the least-squares-based approaches: we shall instantiate the algorithmic pattern of Equation ( 4) by choosing the value of ξ and update the parameter so as move towards the minimum of J(θ i , ξ) in Equation (4) using a stochastic gradient descent. To make the pattern of Equation ( 4) precise, we need to define the empirical approximate operator we use. We will consider the untruncated T λ i,n operators (written in the followings T λ i , with a slight abuse of notation):

T λ i V = V (s i ) + n j=i (γλ) j-i ρ j i Tj V -ρ j-1 i V (s j ) ( 16
)
where n is the total length of the trajectory.

It should be noted that algorithmic derivations will here be a little bit more involved than in the least-squares case. First, with the instantiation ξ = θ i , the pattern given in Equation ( 4) is actually a fixed-point problem onto which one cannot directly perform a stochastic gradient descent (this issue will be addressed in Section 4.2 through the introduction of an auxiliary objective function, following the approach originally proposed by [START_REF] Sutton | Fast gradient-descent methods for temporal-difference learning with linear function approximation[END_REF]). A second difficulty is the following: the just introduced empirical operator T λ i depends on all the trajectory after step i (on the future of the process), and is for this reason usually coined a forward view estimate. Though it would be possible, in principle, to implement a gradient descent based on this forward view, it would not be very memory nor time efficient. Thus, we will follow a usual trick of the literature by deriving recursive algorithms based on a backward view estimate that is equivalent to the forward view in expectation. To do so, we will repeatedly use the following identity that highlights the fact that the estimate T λ i V can be written as a forward recursion:

Lemma 4 Let T λ i be the operator defined in Equation ( 16) and let V ∈ R S . We have

T λ i V = ρ i r i + γρ i (1 -λ)V (s i+1 ) + γλρ i T λ i+1 V.
Proof Using notably the identity ρ j i = ρ i ρ j i+1 , we have:

T λ i V = V (s i ) + n j=i (γλ) j-i ρ j i Tj V -ρ j-1 i V (s j ) = V (s i ) + ρ i Ti V -V (s i ) + γλρ i n j=i+1 (ρ j i Tj V -ρ j-1 i V (s j )) = ρ i Ti V + γλρ i T λ i+1 V -V (s i+1 ) .
To sum up, the "recipe" that we are about to use to derive off-policy gradient learning algorithms based on eligibility traces will consist of the following steps:

1. write the empirical generic cost function (4) with the untruncated Bellman operator of Equation ( 16)

2. instantiate ξ and derive the gradient-based update rule (with some additional work for ξ = θ i , see Section 4.2);

3. turn the forward view into an equivalent (in expectation) backward view.

The next subsection details the precise derivation of the algorithms.

Off-policy TD(λ)

Because it is the simplest, we begin by considering the bootstrap approach, that is the instantiation ξ = θ j-1 . The cost function to be minimized is therefore:

i j=1 T λ j Vθ j-1 -Vω (s j ) 2 .
Minimized with a stochastic gradient descent, the related update rule is (α i being a standard learning rate and recalling that Vω (s i ) = ω T φ(s i ) = ω T φ i ):

θ i = θ i-1 - α i 2 ∇ ω T λ i Vθ i-1 -Vω (s i ) 2 ω=θ i-1 = θ i-1 + α i φ i T λ i Vθ i-1 -Vθ i-1 (s i ) . ( 17
)
At this point, one could notice that the exact same update rule would have been obtained with the instantiation ξ = θ i-1 . This was to be expected: as only the last term of the sum is considered for the update, we have j = i, therefore ξ = θ i-1 = θ j-1 . Equation ( 17) makes use of a λ-TD error defined as

δ λ i (ω) = T λ i Vω -Vω (s i ).
For convenience, let also δ i be the standard (off-policy) TD error defined as

δ i (ω) = δ λ=0 i (ω) = ρ i Ti Vω -Vω (s i ) = ρ i r i + γ Vω (s i+1 ) -Vω (s i ).
The λ-TD error can be expressed as a forward recursion: Lemma 5 Let δ λ i be the λ-TD error and δ i be the standard TD error. Then for all ω, δ λ i (ω) = δ i (ω) + γλρ i δ λ i+1 (ω). Proof This is a corollary of Lemma 4:

T λ i V ω = ρ i r i + γρ i (1 -λ)V ω (s i+1 ) + γλρ i T λ i+1 V ω ⇔ T λ i V ω -V ω (s i ) = ρ i r i + γρ i V ω (s i+1 ) -V ω (s i ) + γλρ i ( T λ i+1 V ω -V ω (s i+1 )) ⇔ δ λ i (ω) = δ i (ω) + γλρ i δ λ i+1 (ω)
. Therefore, we get the following update rule

θ i = θ i-1 + α i φ i δ λ i (θ i-1 ) with δ λ i (θ i-1 ) = δ i (θ i-1 ) + γλδ λ i+1 (θ i-1 ).
The key idea here is to find some backward recursion such that in expectation, when the Markov chain has reached its steady state, it provides the same result as the forward recursion. Such a backward recursion is given by the following lemma.

Proposition 6 Let z i be the eligibility vector, defined by the following recursion:

z i = φ i + γλρ i-1 z i-1 .
For all ω, we have

E µ 0 [φ i δ λ i (ω)] = E µ 0 [z i δ i (ω)].
Proof For clarity, we omit the dependence with respect to ω and write below δ i (resp. δ λ i ) for δ i (ω) (resp. δ λ i (ω)). The result relies on successive applications of Lemma 5. We have:

E µ 0 [φ i δ λ i ] = E µ 0 [φ i (δ i + γλρ i δ λ i+1 )] = E µ 0 [φ i δ i ] + E µ 0 [φ i γλρ i δ λ i+1 ].
Moreover, we have that

E µ 0 [φ i ρ i δ λ i+1 ] = E µ 0 [φ i-1 ρ i-1 δ λ i ],
as expectation is done according to the stationary distribution, therefore:

E µ 0 [φ i δ λ i ] = E µ 0 [φ i δ i ] + γλE µ 0 [φ i-1 ρ i-1 δ λ i ] = E µ 0 [φ i δ i ] + γλE µ 0 [φ i-1 ρ i-1 (δ i + γλρ i δ λ i+1 )] = E µ 0 [δ i (φ i + γλρ i-1 φ i-1 + (γλ) 2 ρ i-1 ρ i-2 φ i-2 + . . . )] = E µ 0 [δ i z i ].
This suggests to replace Equation ( 17) by the following update rule,

θ i = θ i-1 + α i z i δ i (θ i-1 ),
which is equivalent in expectation when the Markov chain has reached its steady state. This is summarized in Algorithm 5.

Algorithm 5: Off-policy TD(λ)

Initialization;

Initialize vector θ 0 ; Set z 0 = 0;

for i = 1, 2, . . . do Observe φ i , r i , φ i+1 ; Update traces ; z i = γλρ i-1 z i-1 + φ i ; Update parameters ; θ i = θ i-1 + α i z i (ρ i r i -∆φ T i θ i-1 )
; end This algorithm has first been proposed in the tabular case by [START_REF] Precup | Eligibility Traces for Off-Policy Policy Evaluation[END_REF]. An off-policy TD(λ) algorithm (with function approximation) has been proposed by [START_REF] Precup | Off-Policy Temporal-Difference Learning with Function Approximation[END_REF], but it differs significantly from the algorithm just described (notably it differs in the definition of the traces and the projected Bellman equation, and in the fact that it is constrained to episodic trajectories). Algorithm 5 has actually first been proposed much more recently by Bertsekas and Yu (2009a).

An important issue for the analysis of this algorithm is the fact that the trace z i may have an infinite variance, due to importance sampling (see Yu (2010b, Sec. 3.1)). As far as we know, the only existing analysis of off-policy TD(λ) (as provided in Algorithm 5) uses an additional contraint which forces the parameters to be bounded: after each parameter update, the resulting parameter vector is projected onto some predefined compact set. This analysis is performed by Yu (2010b, Sec. 4.1). Under the standard assumptions of stochastic approximations and most of the assumptions required for the on-policy TD(λ) algorithm, assuming moreover that Π 0 T λ is a contraction (which we recall to hold for a big enough λ) and that the predefined compact set used to project the parameter vector is a large enough ball containing the fixed point of Π 0 T λ , the constrained version of off-policy TD(λ) converges to this fixed-point (therefore, the same solution as off-policy LSTD(λ), LSPE(λ) and FPKF(λ)). We refer to Yu (2010b, Sec. 4.1) for further details. An analysis of the unconstrained version of off-policy TD(λ) described in Algorithm 5 is an interesting topic for future research.

Off-policy TDC(λ) and off-policy GTD2(λ)

In this section, the case ξ = θ i is considered. Following the general pattern, at step i, we would like to come up with a new parameter θ i that moves (from θ i-1 ) closer to the minimum of the function

ω → J(ω, θ i ) = T λ j Vθ i -Vω (s j ) 2 .
This problem is tricky since the function to minimize contains what we want to compute θ i -as a parameter. For this reason we cannot directly perform a stochastic gradient descent of the right hand side. Instead, we will consider an alternative (but equivalent) formulation of the projected fixed-point minimization θ = arg min ω V ω -Π 0 T λ V ω 2 , and will move from θ i-1 to θ i by making one step of gradient descent of an estimate of the function

θ → V θ -Π 0 T λ V θ 2 .
With the following vectorial notations:

Vω = Vω (s 1 ) . . . Vω (s i ) T , Tλ Vω = T λ 1 Vω . . . T λ i Vω T , Φ = φ(s 1 ) . . . φ(s i ) T , Π0 = Φ( ΦT Φ) -1 ΦT ,
we consider the following objective function:

J(θ) = Vθ -Π0 Tλ Vθ 2 = Vθ -Tλ Vθ T Π0 Vθ -Tλ Vθ =   i j=1 δ λ j (θ)φ j   T   i j=1 φ j φ T j   -1   i j=1 δ λ j (θ)φ j   .
This is the derivation followed by [START_REF] Sutton | Fast gradient-descent methods for temporal-difference learning with linear function approximation[END_REF] in the case λ = 0 and by [START_REF] Maei | GQ(λ): A general gradient algorithm for temporaldifference prediction learning with eligibility traces[END_REF] in the case λ > 0 (and off-policy learning). Let us introduce the following notation:

g λ j = ∇ T λ j Vθ . ( 18
)
Note that since we consider a linear approximation this quantity does not depend on θ.

Noticing that ∇δ λ j (θ) = φ j -g λ j , we can compute ∇J(θ):

-

1 2 ∇J(θ) = - 1 2 ∇   i j=1 δ λ j (θ)φ j   T   i j=1 φ j φ T j   -1   i j=1 δ λ j (θ)φ j   = -   ∇ i j=1 δ λ j (θ)φ j   T   i j=1 φ j φ T j   -1   i j=1 δ λ j (θ)φ j   =   i j=1 (φ j -g λ j )φ T j     i j=1 φ j φ T j   -1   i j=1 δ λ j (θ)φ j   (19) =   i j=1 δ λ j (θ)φ j   -   i j=1 g λ j φ T j     i j=1 φ j φ T j   -1   i j=1 δ λ j (θ)φ j   .
Let w i (θ) be a quasi-stationary estimate of the last part, that can be recognized as the solution of a least-squares problem (regression of λ-TD errors δ λ j on features φ j ):

w i (θ) ≈   i j=1 φ j φ T j   -1   i j=1 δ λ j (θ)φ j   = argmin ω i j=1 φ T j ω -δ λ j (θ) 2 .
The identification with the above least-squares solution suggests to use the following stochastic gradient descent to form the quasi-stationary estimate:

w i = w i-1 + β i φ i δ λ i (θ i-1 ) -φ T i w i-1 .
This update rule makes use of the λ-TD error, defined through a forward view. As for the previous algorithm, we can use Proposition 6 to obtain the following backward view update rule that is equivalent (in expectation when the Markov chain reaches its steady state):

w i = w i-1 + β i z i δ i (θ i-1 ) -φ i (φ T i w i-1 ) . ( 20
)
Using this quasi-stationary estimate, the gradient can be approximated as:

- 1 2 ∇J(θ) ≈   i j=1 δ λ j (θ)φ j   -   i j=1 g λ j φ T j   w i .
Therefore, a stochastic gradient descent gives the following update rule for the parameter vector θ:

θ i = θ i-1 + α i δ λ i (θ i-1 )φ i -g λ i φ T i w i . ( 21
)
Once again the forward view term δ λ i (θ i-1 )φ i can be turned into a backward view by using Proposition 6. There remains to work on the term g λ i φ T i . First, one can notice that the term g λ i satisfies a forward recursion.

Lemma 7

We have

g λ i = γρ i (1 -λ)φ i+1 + γλρ i g λ i+1 .
Proof This result is simply obtained by applying the gradient to the forward recursion of T λ i V θ provided in Lemma 4 (according to θ). Using this, the term g λ i φ T i can be worked out similarly to the term δ λ i (θ i-1 )φ i .

Proposition 8 Let z i be the eligibility vector defined in Proposition 6. We have

E µ 0 [g λ i φ T i ] = E µ 0 [γρ i (1 -λ)φ i+1 z T i ].
Proof The proof is similar to that of Proposition 6. Writing b i = γρ i (1 -λ)φ i+1 and η i = γλρ i , we have

E µ 0 [g λ i φ T i ] = E µ 0 [(b i + η i g λ i+1 )φ T i ] = E µ 0 [b i φ T i ] + E µ 0 [η i-1 (b i + η i g λ i+1 )φ T i-1 ] = E µ 0 [b i z T i ].
Using this result and Proposition 6, it is natural to replace Equation ( 21) by an update based on a backward recursion:

θ i = θ i-1 + α i z i δ i -γρ i (1 -λ)φ i+1 (z T i w i-1 ) . ( 22
)
Last but not least, for the estimate w i to be indeed quasi-stationary, the learning rates should satisfy the following condition (in addition to the classical conditions):

lim i→∞ α i β i = 0.
Eqs. ( 22) and ( 20) define the off-policy TDC(λ) algorithm, summarized in Algorithm 6. It was originally proposed by [START_REF] Maei | GQ(λ): A general gradient algorithm for temporaldifference prediction learning with eligibility traces[END_REF] under the name GQ(λ). We call it off-policy TDC(λ) to highlight the fact that it is the extension of the original TDC algorithm of [START_REF] Sutton | Fast gradient-descent methods for temporal-difference learning with linear function approximation[END_REF] to off-policy learning with traces. One can observe -to our knowledge, this was never mentionned in the literature before -that when λ = 1, the learning rule of TDC(1) reduces to that of TD(1). [START_REF] Maei | GQ(λ): A general gradient algorithm for temporaldifference prediction learning with eligibility traces[END_REF] show that the algorithm converges with probability 1 to the same solution as the LSTD(λ) algorithm (that is, to θ * = A -1 b) under some technical assumptions. Contrary to off-policy TD(λ), this algorithm does not requires Π 0 T λ to be a contraction in order to be convergent. Unfortunately, one of the assumptions made in the analysis, requiring that the traces z i have uniformly bounded second moments, is restrictive since in an off-policy setting the traces z i may easily have an infinite variance (unless the behavior policy is really close to the target policy), as noted by Yu (2010a) (see also [START_REF] Randhawa | Combining importance sampling and temporal difference control variates to simulate Markov chains[END_REF]). A full proof of convergence thus still remains to be done.

Algorithm 6: Off-policy TDC(λ), also known as GQ(λ)

Initialization;

Initialize vector θ 0 and w 0 ; Set z 0 = 0;

for i = 1, 2, . . . do Observe φ i , r i , φ i+1 ; Update traces ; z i = γλρ i-1 z i-1 + φ i ; Update parameters ; θ i = θ i-1 + α i z i (ρ i r i -∆φ T i θ i-1 ) -γρ i (1 -λ)φ i+1 (z T i w i-1 ) ; w i = w i-1 + β i z i (ρ i r i -∆φ T i θ i ) -φ i (φ T i w i-1 ) ; end
Using the same principle (that is, performing a stochastic gradient descent to minimize J(θ)), in the λ = 0 case, an alternative to TDC, the GTD2 algorithm was derived by [START_REF] Sutton | Fast gradient-descent methods for temporal-difference learning with linear function approximation[END_REF]. As far as we know, it has never been extended to off-policy learning with traces; we do it now. Notice that, given the derivation of GQ(λ), obtaining this algorithm is pretty straightforward.

To do so, we can start back from Equation ( 19):

- 1 2 ∇J(θ) =   i j=1 (φ j -g λ j )φ T j     i j=1 φ j φ T j   -1   i j=1 δ λ j (θ)φ j   ≈   i j=1 (φ j -g λ j )φ T j   w i .
This suggests the following alternative update rule (based on forward recursion):

θ i = θ i-1 + α i (φ i -g λ i )φ T i w i .
Using Proposition 8, it is natural to use the following alternative update rule, based on a backward recursion:

θ i = θ i-1 + α i φ i (φ T i w i-1 ) -γρ i (1 -λ)φ i+1 (z T i w i-1 ) .
The update of w i remains the same, and put together it gives off-policy GTD2(λ), summarized in Algorithm 7. The analysis of this new algorithm constitutes a potential topic for future research.

Algorithm 7: Off-policy GTD2(λ)

Initialization;

Initialize vector θ 0 and w 0 ; Set z 0 = 0;

for i = 1, 2, . . . do Observe φ i , r i , φ i+1 ;
Update traces ;

z i = γλρ i-1 z i-1 + φ i ;
Update parameters ;

θ i = θ i-1 + α i φ i (φ T i w i-1 ) -γρ i (1 -λ)φ i+1 (z T i w i-1 ) ; w i = w i-1 + β i z i (ρ i r i -∆φ T i θ i ) -φ i (φ T i w i-1 ) ; end

Off-policy gBRM(λ)

The last considered approach is the residual approach, corresponding to the instantiation ξ = ω. The cost function to be minimized is then:

i j=1 T λ j Vω -Vω (s j ) 2 .
Following the negative of the gradient of the last term leads to the following update rule:

θ i = θ i-1 -α i ∇ ω T λ i Vω -Vω (s i ) 2 ω=θ i-1 = θ i-1 -α i ∇ ω T λ i Vω -Vω (s i ) ω=θ i-1 T λ i Vθ i-1 -Vθ i-1 (s i ) = θ i-1 + α i φ i -g λ i δ λ i (θ i-1 ),
recalling the notation g λ i = ∇ T λ i Vω first defined in Equation ( 18). As usual, this update involves a forward view, which we are going to turn into a backward view. The term φ i δ λ i can be worked thanks to Proposition 6. The term g λ i δ λ i is more difficult to handle, as it is the product of two forward views (until now, we only considered the product of a forward view with a non-recursive term). This can be done thanks to the following original relation (the proof being somewhat tedious, it is deferred to Appendix C): Proposition 9 Write g λ i = ∇ ω T λ i and define

c i = 1 + (γλρ i-1 ) 2 c i-1 , ζ i = γρ i (1 -λ)φ i+1 c i + γλρ i-1 ζ i-1 and d i = δ i c i + γλρ i-1 d i-1 ,
we have that

E µ 0 [δ λ i g λ i ] = E µ 0 [δ i ζ i + d i γρ i (1 -λ)φ i+1 -δ i γρ i (1 -λ)φ i+1 c i ].
This result (together with Proposition 6) suggests to update parameters as follows:

θ i = θ i-1 + α i (δ i (z i + γρ i (1 -λ)φ i+1 c i -ζ i ) -d i γρ i (1 -λ)φ i+1 ) .
This gives the off-policy gBRM(λ) algorithm, depicted in Algorithm 8. One can observe that gBRM( 1) is equivalent to TD(1) (and thus also TDC(1), cf. the comment before the description of Algorithm 6). The analysis of this new algorithm is left for future research.

Algorithm 8: Off-policy gBRM(λ)

Initialization; Initialize vector θ 0 ; Set z 0 = 0, d 0 = 0, c 0 = 0, ζ 0 = 0; for i = 1, 2, . . . do Observe φ i , r i , φ i+1 ;
Update traces ;

z i = φ i + γλρ i-1 z i-1 ; c i = 1 + (γλρ i-1 ) 2 c i-1 ; ζ i = γρ i (1 -λ)φ i+1 c i + γλρ i-1 ζ i-1 ; d i = (ρ i r i -∆φ T i θ i-1 )c i + γλρ i-1 d i-1 ; Update parameters ; θ i = θ i-1 + α i (ρ i r i -∆φ T i θ i-1 )(z i + γρ i (1 -λ)φ i+1 c i -ζ i ) -d i γρ i (1 -λ)φ i+1 ; end

Empirical Study

This section aims at empirically comparing the surveyed algorithms. As they only address the policy evaluation problem, we compare the algorithms in their ability to perform policy evaluation (no control, no policy optimization); however, they may straightforwardly be used in an approximate policy iteration approach [START_REF] Bertsekas | Neuro-Dynamic Programming[END_REF][START_REF] Munos | Error Bounds for Approximate Policy Iteration[END_REF]). In order to assess their quality, we consider finite problems where the exact value function can be computed.

More precisely, we consider Garnet problems [START_REF] Archibald | On the Generation of Markov Decision Processes[END_REF], which are a class of randomly constructed finite MDPs. They do not correspond to any specific application, but are totally abstract while remaining representative of the kind of MDP that might be encountered in practice. In our experiments, a Garnet is parameterized by 4 parameters and is written G(n S , n A , b, p): n S is the number of states, n A is the number of actions, b is a branching factor specifying how many possible next states are possible for each state-action pair (b states are chosen uniformly at random and transition probabilities are set by sampling uniform random b -1 cut points between 0 and 1) and p is the number of features (for function approximation). The reward is state-dependent: for a given randomly generated Garnet problem, the reward for each state is uniformly sampled between 0 and 1. Features are chosen randomly: Φ is a n S × p feature matrix of which each component is randomly and uniformly sampled between 0 and 1, except the first row of which each component is set to 1 (this corresponds to a constant feature). The discount factor γ is set to 0.95 in all experiments.

We consider two types of problems, "small" and "big", respectively corresponding to instances G(30, 4, 2, 8) and G(100, 10, 3, 20). We also consider two types of learning: onpolicy learning and off-policy learning. In the on-policy setting, for each Garnet a policy π to be evaluated is randomly generated (by sampling randomly n A -1 cut points between 0 and 1 for each state), and trajectories (to be used for learning) are sampled according to this same policy. In the off-policy setting, the policy π to be evaluated is randomly generated the same way, but trajectories are sampled according to a uniform policy π 0 (that chooses each action with equal probability, that is π 0 (a|s) = 1 n A for any state-action couple). For all algorithms, we choose θ 0 = 0. For least-squares-based algorithms (LSTD, LSPE, FPKF and BRM), we set the initial matrices (M 0 , N 0 , C 0 ) to 10 3 I (the higher this value, the more negligible its effect on estimates11 ). We run a first set of experiments in order to set all other parameters (eligibility factor and learning rates). We use the following schedule for the learning rates:

α i = α 0 α c α c + i and β i = β 0 β c β c + i 2 3
.

More precisely, we generate one problem (MDP and policy) for each possible combination small/big on-policy/off-policy (leading to four problems). For each problem, we generate 10 trajectories of length 10 4 using the behaviorial policy (which is the randomly generated target policy in the on-policy case and the uniform policy in the off-policy case), to be used by all algorithms. For each meta-parameter, we consider the following ranges of values: λ ∈ {0, 0.4, 0.7, 0.9, 1}, α 0 ∈ {10 -2 , 10 -1 , 10 0 }, α c ∈ {10 1 , 10 2 , 10 3 }, β 0 ∈ {10 -2 , 10 -1 , 10 0 } and β c ∈ {10 1 , 10 2 , 10 3 }. Then, we compute the parameter estimates considering all algorithms instantiated with each possible combination of the meta-parameters. This gives for each combination a family θ i,d with i the number of transitions encountered in the d th trajectory. Finally, for each problem and each algorithm, we choose the combination of meta-parameters which minimizes the average error on the second half of the learning curves (we do this to reduce the sensitivity to the initialization and the transient behavior). Formally, we pick the set of parameters that minimizes the following quantity:

err = 1 10 10 d=1 1 5.10 3 10 4 i=5.10 3 Φθ i,d -V π 2 .
We provide the empirical results of this first set of experiments in Table 3 to 6. As a complement, we detail in Figure 1 the sensitivity of all algorithms with respect to the main parameter λ that controls the eligibility traces. We comment these results below.

λ α 0 α c β 0 β c err LSTD 0.9
1.60 LSPE 0.9 1.60 FPKF 1 1.60 BRM 0.9 1.60 TD 0 10 -1 10 3 1.76 gBRM 0.7 10 -1 10 2 1.68 TDC 0.9 10 -1 10 3 10 -1 10 3 2.11 GTD2 0.7 10 -1 10 3 10 -1 10 3 1.69 Table 3: Small problem (G(30, 4, 2, 8)), on-policy learning (π = π 0 ).

Table 3 shows the best meta-parameters for 10 trajectories of a single instance of a small Garnet problem in an on-policy setting, as well as related efficiencies. Numerically, all least-squares-based methods provide equivalent performance, with similar choices of the eligibility factor (which is the only meta-parameter). TD gets its best results with a small λ (we believe this is the case because the MDP has few states). The new gBRM algorithm and GTD2 algorithm work well, but picking a higher value of λ. Eventually, TDC performs slightly worse. Figure 1 (top, left) shows that the choice of λ does not matter, except for FPKF that requires λ = 1 to be efficient; with this value FPKF is almost identical to LSPE(1) and LSTD(1) (cf. the discussion at the end of Section 3.3).

λ α 0 α c β 0 β c err LSTD 0.4
2.75 LSPE 0.7 2.75 FPKF 1 2.77 BRM 0.9 2.77 TD 0.4 10 -1 10 3 3.95 gBRM 0.9 10 -1 10 3 4.45 TDC 0.9 10 -1 10 3 10 -1 10 3 6.31 GTD2 0.9 10 -2 10 3 10 -1 10 3 11.90 Table 4: Big problem (G(100, 10, 3, 20)), on-policy learning (π = π 0 ).

Table 4 shows the best meta-parameters for 10 trajectories of a single instance of a big Garnet problem in an on-policy setting, as well as related performance. These results are consistent with those of the small problem, in the on-policy setting (with slightly different meta-parameters). The main difference are that GTD2 performs here the worse. Figure 1 (top, right) suggests that as the problem's size grows, the role of the eligibity factor gets more prominent: most algorithms need a relatively high value of λ to perform the best. (100,10,3,20)). Top: on-policy learning (π = π 0 ), bottom: off-policy learning (π = π 0 ).

Table 5 reports the best meta-parameters in an off-policy setting for a small problem. In terms of performance, Least-squares approaches are no longer equivalent. LSTD and LSPE get the best results, with the smallest possible value λ = 0: we believe that this choice is due to the fact that higher eligibility factor increases the variance due to importance sampling. FPKF and BRM need large values of λ to work well, and suffer much more from the off-policy aspect. Figure 1 (bottom, left) suggests that FPKF and BRM need a high value of λ (to "catch" the good performance of LSTD/LSPE) but then suffers from the variance due to importance sampling. Regarding gradient-based methods, TD's performance is good (it is close that of LSTD/LSPE), followed closely by GTD2 (both being better than FPKF/BRM). TDC and gBRM lead to the worse results; as both methods choose λ = 1, they here turn out to be equivalent to TD(1) (cf. the discussions after Algorithms 6 and 8)12 . As for FPKF/BRM with respect to LSTD/LSPE, Figure 1 (bottom, left) further sug-

λ α 0 α c β 0 β c err LSTD 0 4.99 LSPE 0 5
.00 FPKF 0.9 12.61 BRM 1 13.17 TD 0.4 10 -1 10 2 7.65 gBRM 1 10 -2 10 2 24.04 TDC 1 10 -2 10 2 10 -2 10 1 24.04 GTD2 0.7 10 -1 10 3 10 -2 10 1 11.51 Table 5: Small problem (G(30, 4, 2, 8)), off-policy learning (π = π 0 ). gests that TDC and gBRM need a high value of λ in order to get a reasonable performance, but then suffer from the variance of importance sampling. Eventually, Table 6 (100,10,3,20)), off-policy learning (π = π 0 ). meta-parameters and performance in the most difficult situation: the off-policy setting of the big problem. These results are consistent with the off-policy results of the small problem, summarized in Table 5. LSTD and LSPE are the most efficient algorithms and choose the smallest possible value λ = 0. FPKF and BRM's performance deteriorate (significantly for the latter). TD behaves reasonably good (it is in particular much better than FPKF) and GTD2 follows closely. The performance of TDC and gBRM are the worse, the latter's by a significant amount. Figure 1 (bottom, right) is similar to that of the small problem.

The main goal of the series of experiments we have just described was to choose reasonable values for the meta-parameters. We have also used these experiments to quickly comment the relative performance of the algorithms, but this is not statistically significant as this was based on a single (random) problem. Though we will see that the general behavior of the algorithm is globally consistent with what we have seen so far, the series of experiments that we are about to describe aims at providing such a statistically significant performance comparison. For each situation (small and big problems, on-and off-policy), we fix the meta-parameters to the previously reported values and we compare the algorithms on several new instances of the problems. These results are reported on Figures. 2 to 5. For each of the 4 problems, we randomly generate 100 instances (MDP and policy to be evaluated). For each such problem, we generate a trajectory of length 10 5 . Then, all algorithms learn using this very trajectory. On each figure, we report the average performance (left), measured as the difference between the true value function (computed from the model) and the currently estimated one, V π -Φθ 2 , as well as the associated standard deviation (right). We begin by discussing the results in the on-policy setting. Figure 2 compares all algorithms for 100 randomly generated small problems (that is, each run corresponds to different dynamics, reward function, features and evaluated policy), the meta-parameters being those provided in Table 3. All least-squares approaches provide the best results and are bunched together; this was to be expected, as all algorithms use λ close to 1. In these problems, gBRM works better than other gradient-based methods, followed by TD and GTD2/TDC. Figure 3 compares the algorithms for 100 randomly generated big problems, the meta-parameters being those provided in Table 4. These result are similar to those of the small problem in an off-policy setting, except that TDC is now faster than GTD2, that TD is slightly faster than gBRM. We now consider the off-policy setting. Figure 4 provides the average performance and standard deviation of the algorithms (meta-parameters being those of Table 5) on 100 small problems. Once again, we can see that LSTD/LSPE provide the best results. The two other least-squares methods (FPKF and BRM) are overtaken by the gradient-based TD algorithm. GTD2 is quite slow (slower than TD) and TDC/gBRM (that are identical to TD(1) since they both use λ = 1) are the slowest algorithms. Figure 5 provides the same data for the big problems (with the meta-parameters of Table 6). These results are similar to those of the small problems in an off-policy setting. The main differences are 1) that FPKF appears to converge faster than TD but with a bigger standard deviation, and 2) gBRM (that uses λ = 0) does not work anymore (it is here equivalent to the standard algorithm by [START_REF] Baird | Residual Algorithms: Reinforcement Learning with Function Approximation[END_REF] and probably suffers from the well-known associated bias issue). Summary Overall, our experiments suggest that the two best algorithms are LSTD/LSPE, since they converge much faster in all situations. The gradient-based TD algorithm globally diplays a good behavior and constitutes a good alternative when the number p of features is too big for least-squares methods to be implemented. Though some new algorithms/extensions show interesting results (FPKF(λ) is consistently better that the stateof-the-art FPKF by [START_REF] Choi | A Generalized Kalman Filter for Fixed Point Approximation and Efficient Temporal-Difference Learning[END_REF], gBRM works well in the on-policy setting) most of the other algorithms do not seem to be empirically competitive with the trio LSTD/LSPE/TD, especially in off-policy situations. In particular, the algorithm introduced specifically for the off-policy setting (TDC/GTD2) are much slower than TD. Moreover, the condition required for the good behavior of LSPE, FPKF and TD -the contraction of Π 0 T λ -does not seem to be very restrictive in practice (at least for the Garnet problems we considered): though it is possible to build specific pathological examples where these algorithms diverge13 , this never happened in our experiments.

Conclusion and Future Work

We have considered least-squares and gradient-based algorithms for value estimation in an MDP context. Starting from the on-policy case with no trace, we have recalled that several algorithms (LSTD, LSPE, FPKF and BRM for least-squares approaches, TD, gBRM and TDC/GTD2 for gradient-based approaches) fall in a common algorithmic pattern (Equation (2)). Substituting the original Bellman operator by an operator that deals with traces and off-policy samples naturally leads to the state-of-the-art off-policy trace-based versions of LSTD, LSPE, TD and TDC, and suggests natural extensions of FPKF, BRM, gBRM and GTD2. This way, we surveyed many known and new off-policy eligibility traces-based algorithms for policy evaluation.

We have explained how to derive recursive (memory and time-efficient) implementations of all these algorithms and discussed their known convergence properties (including an original analysis of BRM(λ) for sufficiently small λ, that implies the so far not known convergence of GPTD/KTD). Interestingly, it appears that the analysis of off-policy tracesbased stochastic gradient algorithms under mild assumptions is still an open problem: the only currently known analysis of TD (Yu, 2010a) only applies to a constrained version of the algorithm, and that of TDC [START_REF] Maei | GQ(λ): A general gradient algorithm for temporaldifference prediction learning with eligibility traces[END_REF] relies on an assumption on the boundedness of the second moment traces that is restrictive (Yu, 2010a). Filling this theoretical gap, as well as providing complete analyses for the other gradient algorithms and FPFK(λ) and BRM(λ) constitute important future work.

Finally, we have illustrated and compared the behavior of these algorithms; this constitutes the first exhaustive empirical comparison of linear methods 14 . Overall, our study suggests that even if the use of eligibility traces generally improves the efficiency of all algorithms, LSTD and LSPE consistently provide the best estimates; and in situations where the computational cost is prohibitive for a least-squares approach (when the number p of features is large), TD probably constitutes the best alternative.

Lemma 11 Let f ∈ R N×N×N and n ∈ N. We have:

n i=1 n j=i n k=i f (i, j, k) = n i=1 i j=1 j k=1 f (k, i, j) + n i=2 i-1 j=1 j k=1 f (k, j, i)
As stated in Equation ( 14), we have the following batch estimate for BRM(λ):

θ i = argmin ω∈R p i j=1 (z j→i -ψ T j→i ω) 2 = ( Ãi ) -1 bi
where

ψ j→i = i k=j ρk-1 j ∆φ k and z j→i = i k=j ρk-1 j ρ k r k and Ãi = i j=1 ψ j→i ψ T j→i and bi = i j=1 ψ j→i z j→i .
To obtain a recursive formula, these two sums have to be reworked through Lemma 11. Let us first focus on the latter:

i j=1 ψ j→i z j→i = i j=1 i k=j i m=j ρk-1 j ∆φ k ρm-1 j ρ m r m = i j=1 j k=1 k m=1 ρj-1 m ∆φ j ρk-1 m ρ k r k + i j=2 j-1 k=1 k m=1 ρk-1 m ∆φ k ρj-1 m ρ j r j .
Writing

y k = k m=1 (ρ k-1 m ) 2 = 1 + (γλρ k-1 ) 2 y k-1 ,
we have that:

k m=1 ρj-1 m ρk-1 m = ρj-1 k y k . Therefore: i j=1 ψ j→i z j→i = i j=1 j k=1 ρj-1 k y k ∆φ j ρ k r k + i j=2 j-1 k=1 ρj-1 k y k ∆φ k ρ j r j .
With the following notations:

z j = j k=1 ρj-1 k y k ρ k r k = γλρ j-1 z j-1 + ρ j r j y j and D j = j k=1 ρj-1 k y k ∆φ k = γλρ j-1 D j-1 + y j ∆φ j ,
and with the convention that z 0 = 0 and D 0 = 0, one can write:

i j=1 ψ j→i z j→i = i j=1
(∆φ j ρ j r j y j + γλρ j-1 (∆φ j z j-1 + ρ j r j D j-1 ))

Similarly, on can show that:

i j=1 ψ j→i ψ T j→i = i j=1 (∆φ j ∆φ T j y j + γλρ j-1 (∆φ j D T j-1 + D j-1 ∆φ T j )) Denoting j = √ y j ∆φ j , v j = γλρ j-1 √ y j D j-1 ,
and I 2 the 2 × 2 identity matrix, we have:

i j=1 ψ j→i ψ T j→i = i j=1 ((u j + v j )(u j + v j ) T -v j v T j ) = i-1 j=1 ψ j→i ψ T j→i + u i + v i v i =U i I 2 (u i + v i ) T -v T i =V i .
We can apply the Woodbury identity given in Lemma 10:

C i =   i j=1 ψ j→i ψ T j→i   -1 =   i-1 j=1 ψ j→i z j→i + U i I 2 V i   -1 = C i-1 -C i-1 U i (I 2 + V i C i-1 U i ) -1 V i C i-1 .
The other sum can also be reworked: bi

= i j=1 ψ j→i z j→i = i j=1 ∆φ j r j y j + γλ (D j-1 r j + ∆φ j z j-1 ) = bi-1 + ∆φ i r i y i + γλ (D i-1 r i + ∆φ i z i-1 ) = bi-1 + U i   √ y i r i + γλ √ y i z i-1 -γλ √ y i z i-1   =W i .
Finally, the recursive BRM(λ) estimate can be computed as follows:

θ i = C i bi = θ i-1 + C i-1 U i (I 2 + V i C i-1 U i ) -1 (W i -V i θ i-1 ) .
This gives BRM(λ) as provided in Algorithm 4.

Appendix B. Proof of Theorem 3 (Convergence of BRM(λ))

The proof of Theorem 3 follows the general idea of that of Proposition 4 of [START_REF] Bertsekas | Projected Equation Methods for Approximate Solution of Large Linear Systems[END_REF]. It is done in 2 steps. First we argue that the limit of the sequence is linked to that of an alternative algorithm for which one cuts the traces at a certain depth l. Then, we show that for all depth l, this alternative algorithm converges almost surely, we explicitely compute its limit and make l tend to infinity to obtain the limit of BRM(λ).

We will only show that 1 i Ãi tends to Ã. The argument is similar for 1 i b i → b. Consider the following l-truncated version of the algorithm based on the following alternative traces (we here limit the "memory" of the traces to a size l):

y k,l = k m=max(1,k-l+1) (ρ k-1 m ) 2 D j,l = j k=max(1,j-l+1) ρj-1 k y k,l ∆φ k
and update the following matrix:

Ãi,l = Ãi-1,l + ∆φ i ∆φ T i y i,l + ρi-1 (∆φ i D T i-1,l + D i-1,l ∆φ T i ).
The assumption in Equation ( 15) implies that ρj-1 i ≤ β j-i , therefore it can be seen that for all k,

|y k,l -y k | = max(0,k-l) m=1 (ρ k-1 m ) 2 ≤ max(0,k-l) m=1 β 2(k-m) ≤ β 2l 1 -β 2 = 1 (l)
where 1 (l) tends to 0 when l tends to infinity. Similarly, using the fact that y k ≤ 1 1-β 2 and writing K = max s,s φ(s) -γφ(s ) ∞ , one has for all j,

D j,l -D j ∞ ≤ max(0,j-l) k=1 ρj-1 k y k ∆φ k ∞ + j k=max(1,j-l+1) ρj-1 k |y k,l -y k | ∆φ k ∞ ≤ max(0,j-l) k=1 ρj-1 k 1 1 -β 2 K + j k=max(1,j-l+1) ρj-1 k β 2l 1 -β 2 K ≤ β l 1 -β 1 1 -β 2 K + 1 1 -β β 2l 1 -β 2 K = 2 (l)
where 2 (l) also tends to 0. Then, it can be seen that:

Ãi,l -Ãi ∞ = Ãi-1,l -Ãi-1 + ∆φ i ∆φ T i (y i,l -y i ) + ρi-1 (∆φ i (D T i-1,l -D T i-1 ) + (D i-1,l -D i-1 )∆φ T i ) ∞ ≤ Ãi-1,l -Ãi-1 ∞ + ∆φ i ∆φ T i ∞ |y k,l -y k | + 2β ∆φ i ∞ D i-1,l -D i ∞ ≤ Ãi-1,l -Ãi-1 ∞ + K 2 1 (l) + 2βK 2 (l)
and, by a recurrence on i, one obtains

Ãi,l i - Ãi i ∞ ≤ (l)
where (l) tends to 0 when l tends to infinity. This implies that: In other words, one can see that lim i→∞ Ãi i and lim l→∞ lim i→∞ Ãi,l i are equal if the latter exists. In the remaing of the proof, we show that the latter limit indeed exists and we compute it explicitely.

Let us fix some l and let us consider the sequence ( Ãi,l i ). At some index i, y i,l depends only on the last l samples, while D i,l depends on the same samples and the last l values of y j,l , thus on the last 2l samples. It is then natural to view the computation of Ãi,l , which is based on y i,l , D i-1,l and ∆φ i = φ i -γρ i φ i+1 , as being related to a Markov chain of which the states are the 2l +1 consecutive states of the original chain (s i-2l , . . . , s i , s i+1 ). Write E 0 the expectation with respect to its stationary distribution. By the Markov chain Ergodic Theorem, we have with probability 1: lim i→∞ Ãi,l i = E 0 ∆φ 2l ∆φ T 2l y 2l,l + λγρ 2l-1 (∆φ 2l D T 2l-1,l + D 2l-1,l ∆φ T 2l ) .

(

) 23
Let us now explicitely compute this expectation. Write x i the indicator vector (of which the k th coordinate equals 1 when the state at time i is k and 0 otherwise). One has the following relations: φ i = Φ T x i . Let us first look at the left part of the above limit: where we used the definiton ρk-1 j = (λγ) k-j ρ k-1 j and the notation X m,i,j = ρ i-1 m ρ j-1 m x i x T j . To finish the computation, we will mainly rely on the following Lemma:

Lemma 12 (Some identities) Let P be the matrix of which the coordinates are pss = a π(s, a)ρ(s, a)T (s, a, s ), which is in general not a stochastic matrix. Let µ 0 be the stationary distribution of the behavior policy π 0 . Write Di = diag ( P T ) i µ 0 . Then ∀m ≤ i, E 0 [X m,i,i ] = Di-m ∀m ≤ i ≤ j, E 0 [X m,i,j ] = Di-m P j-i ∀m ≤ j ≤ i, E 0 [X m,i,j ] = (P T ) j-i

Di-m

Proof We first observe that:

E 0 [X m,i,i ] = E 0 [(ρ i-1 m ) 2 x i x T i ] = E 0 [(ρ i-1 m ) 2 diag(x i )] = diag E 0 [(ρ i-1 m ) 2 x i
To provide the identity, we will thus simply provide a proof by recurrence that E 0 [(ρ i-1 m ) 2 x i ] = ( P T ) m-i µ 0 . For i = m, we have E 0 [x m ] = µ 0 . Now suppose the relation holds for i and let us prove it for i + 1.

E 0 [(ρ i m ) 2 x i+1 ] = E 0 E 0 [(ρ i m ) 2 x i+1 |F i ] = E 0 E 0 [(ρ i-1 m ) 2 (ρ i ) 2 x i+1 |F i ] = E 0 (ρ i-1 m ) 2 E 0 [(ρ i ) 2 x i+1 |F i ] .
Write F i the realization of the process until time i. Recalling that s i is the state at time i and x i is the indicator vector corresponding to s i , one has for all s : As this is true for all s , we deduce that E 0 [(ρ i ) 2 x i+1 |F i ] = P T x i and

E 0 [(ρ i m ) 2 x i+1 ] = E 0 [(ρ i-1 m ) 2 P T x i ] = P T E 0 [(ρ i-1
m ) 2 P T x i ] = P T ( P T ) i µ 0 = ( P T ) i+1 µ 0 which concludes the proof by recurrence.

Let us consider the next identity. For i ≤ j,

E 0 [ρ i-1 m ρ j-1 m x i x T j ] = E 0 [E 0 [ρ i-1 m ρ j-1 m x i x T j |F i ]] = E 0 [(ρ i-1 m ) 2 x i E 0 [ρ j-1 i x T j |F i ]] = E 0 [(ρ i-1
m ) 2 x i x T i P j-i ] = diag ( P T ) m-i µ 0 P j-i .

Eventually, the last identity is obtained by considering Y m,i,j = X T m,j,i .

Thus, coming back to our calculus, Similarly, the second term on the right side of Equation ( 23) satisfies: with Q l = l-1 j=0 (λγP ) j . Gathering this and Equation (24), we see that the limit of When l tends to infinity, Q l tends to Q = (I -λγP ) -1 . The assumption of Equation ( 15) ensures that (λγ) P has spectral radius smaller than 1, and thus when l tends to infinity, These two identities can be used to work the term of interest:

E 0 ρ 2l-1 D 2l-1,l ∆φ T 2l = E 0 ρ 2l-1 2l-1 k=l ρ2l-2 k y k,l ∆φ k ∆φ T 2l = E 0 2l-1 k=l (λγ) 2l-1-k ρ 2l-1 k k m=k-l+1 (ρ k-1 m ) 2 Φ T (x k -γρ k x k+1 )(x 2l -γρ 2l x 2l+1 ) T Φ∆φ T 2l = Φ T 2l-1 k=l (λγ) 2l-1-k k m=k-l+1 (λγ) 2(k-m) E 0 ρ 2l-1 m ρ k-1 m (x k -γρ k x k+1 )(x 2l -γρ 2l x 2l+1 ) T Φ = Φ T
E[α i β i ] = E[(a i + η i α i+1 )(b i + η i β i+1 )] = E[a i β i ] + E[b i α i ] + E[η 2 i α i+1 β i+1 ] -E[a i b i ] = E[a i β i ] + E[b i α i ] -E[a i b i ] + E[η 2 i-1 (a i + η i α i+1 )(b i + η i β i+1 )] = E[a i (1 + η 2 i-1 )β i ] + E[b i (1 + η 2 i-1 )α i ] -E[a i b i (1 + η 2 i-1 )] + E[(η i-1 η i ) 2 α i+1 β i+1 ]
This process can be repeated, giving

E[α i β i ] = E[(a i β i + b i α i -a i b i )(1 + η 2 i-1 + (η i-1 η i-2 ) 2 + . . . )].
We have that

w i = 1 + η 2 i-1 w i-1 = 1 + η 2 i-1 + (η i-1 η i-2 ) 2 + . . . , therefore: E[α i β i ] = E[a i w i β i ] + E[b i w i α i ] -E[a i b i w i ]
We can work on the first term:

E[a i w i β i ] = E[a i w i (b i + η i β i+1 )] = E[a i w i b i ] + E[a i-1 w i-1 η i-1 (b i + η i β i+1 )] = E[b i (a i w i + η i-1 (a i-1 w i-1 ) + η i-1 η i-2 (a i-2 w i-2 ) + . . . )] = E[b i u i ].
The work on the second term is symmetric:

E[b i w i α i ] = E[a i v i ].
This finishes proving the result.

The proof of Proposition 9 is a simple application of the preceding technical lemma. By lemma 5, we have that

δ λ i . =α i = δ i . =a i + γλρ i . =η i δ λ i+1 . =α i+1
.

By lemma 7, we have that

g λ i . =β i = γρ i (1 -λ)φ i+1 . =b i + γλρ i . =η i g λ i+1 . =β i+1
.

The result is then a direct application of lemma 13.

Figure 1 :

 1 Figure 1: Sensitivity of performance of the algorithms (y-axis, in logarithmic scale) with respect to the eligibility trace parameter λ (x-axis). Left: Small problem (G(30, 4, 2, 8)), right: Big problem (G(100, 10, 3, 20)). Top: on-policy learning (π = π 0 ), bottom: off-policy learning (π = π 0 ).

Figure 2 :

 2 Figure 2: Performance for small problems (G(30, 4, 2, 8)), on-policy learning (π = π 0 ) (left: average error, right: standard deviation).

Figure 3 :

 3 Figure 3: Performance for big problems (G(100, 10, 3, 20)), on-policy learning (π = π 0 ) (left: average error, right: standard deviation).

Figure 4 :

 4 Figure 4: Performance for small problems (G(30, 4, 2, 8)), off-policy learning (π = π 0 ) (left: average error, right: standard deviation).

Figure 5 :

 5 Figure 5: Performance for big problems (G(100, 10, 3, 20)), on-policy learning (π = π 0 ) (left: average error, right: standard deviation).

E 0

 0 ∆φ 2l ∆φ T 2l y 2l,l = E 0 (φ 2l -γρ 2l φ 2l+1 )(φ 2l -γρ 2l φ 2l+1 ) T y 2l,l = E 0 Φ T (x 2l -γρ 2l x 2l+1 )(x 2l -γρ 2l x 2l+1 ) x 2l -γρ 2l x 2l+1 )(x 2l -γρ 2l x 2l+1 ) 2(2l-m) E 0 (X m,2l,2l -γX m,2l,2l+1 -γX m,2l+1,2l + γ 2 X m,2l+1,2l+1 ) Φ

E 0 [

 0 (ρ i ) 2 x i+1 (s )|F i ] = a π 0 (s i , a)ρ(s i , a) 2 T (s i , a, s ) = a π(s i , a)ρ(s i , a)T (s i , a, s ) = ps i ,s = [ P T x i ](s ).

E 0

 0 ∆φ 2l ∆φ T 2l y 2l,l = Φ T 2l m=l+1 (λγ) 2(2l-m) D2l-m -γ D2l-m P -γP T D2l-m + γ 2 D2l+1-m Φ = Φ T (D l -γD l P -γP T D l + γ 2 D l )

  2(k-m) E 0 X m,k,2l -γX m,k+1,2l -γX m,k,2l+1 + γ 2 X m,k+12(k-m) Dk-m P 2l-k -γ Dk+1-m P 2l-k-1 -γ Dk-m P 2l+1-k + γ 2 Dk+1-m P 2l-2(k-m) Dk-m P 2l-k (I -γP ) -γ Dk+1-m P 2l-1-k (I -γP ) 2(k-m) Dk-m P -γ Dk+1-m P 2l-1-k (I -γP ) 2l-1-k D l P -γD l P 2l-1-k (I -γP ) Φ = Φ T D l P -γD l Q l (I -γP )Φ

  l -γD l P -γP T D l + γ 2 D l + λγ (D l P -γD l )Q l (I -γP ) + (I -γP T )Q T l (P T D l -γD l ) Φ.

Table 6 :

 6 Big problem (G

	shows the

This is only true in the linear case. GPTD and KTD were both introduced in a more general setting: GPTD is nonparametric and KTD is motivated by the goal of handling nonlinearities.

Note that we let the empirical operator T λ j,i depends on the index j of the sample (as before) but also on the step i of the algorithm. This will be particularly useful for the derivation of the recursive and memory-efficient least-squares based algorithms that we present in the next section.

It is possible to remove the bias when λ = 0 by using double samples. However, in the case where λ > 0, the possibility to remove the bias seems much more difficult.

Ā is by construction positive definite, and à equals Ā plus a positive term (the variance term), and is thus also positive definite.

We observed that this parameter did not play a crucial role in practice.

In particular, one can observe that the performance of gBRM(1) and TDC(1) in Table5are numerically equal.

A preliminary version of this article[START_REF] Scherrer | Recursive Least-Squares Learning with Eligibility Traces[END_REF] contains such examples, and also an example where an adverserial choice of λ leads to the divergence of LSTD(λ).

This is typically true if the index i refers to a state sampled according to some stationary distribution, which is the case we are interested in.

Appendix A. Derivation of the recursive formulae for BRM(λ)

We here detail the derivation of off-policy BRM(λ). We will need two technical lemmata. The first one is the Woodbury matrix identity which generalizes the Sherman-Morrison formula (given in Lemma 1).

Lemma 10 (Woodbury) Let A, U , C and V be matrices of correct sizes, then:

The second lemma is a rewriting of imbricated sums:

In other words, lim l→∞ lim i→∞ Ãi,l i exists with probability 1 and equals:

Eventually, this shows that lim i→∞ Ãi i exists with probability 1 and shares the same value. A similar reasoning allows to show that lim i→∞ bi i exists and equals

Appendix C. Proof of Proposition 9

To prove Proposition 9, we need the following technical lemma.

Lemma 13 Forget the notations used so far. Let α i and β i be two forward recursions defined as

Assume that for any function f we have that 15

Let also u i , v i and w i be the backward recursions defined as:

Then, we have:

Proof The proof looks like the one of Proposition 6, but is a little bit more complicated.

A key equality, to be applied repeatedly, is:

Another equality to be used repeatedly makes use of the "stationarity" assumption. For any k ≥ 0 we have: