Automatic basis function construction

From HandWiki

In machine learning, automatic basis function construction (or basis discovery) is the mathematical method of looking for a set of task-independent basis functions that map the state space to a lower-dimensional embedding, while still representing the value function accurately. Automatic basis construction is independent of prior knowledge of the domain, which allows it to perform well where expert-constructed basis functions are difficult or impossible to create.

Motivation

In reinforcement learning (RL), most real-world Markov Decision Process (MDP) problems have large or continuous state spaces, which typically require some sort of approximation to be represented efficiently.

Linear function approximators[1] (LFAs) are widely adopted for their low theoretical complexity. Two sub-problems needs to be solved for better approximation: weight optimization and basis construction. To solve the second problem, one way is to design special basis functions. Those basis functions work well in specific tasks but are significantly restricted to domains. Thus constructing basis construction functions automatically is preferred for broader applications.[citation needed]

Problem definition

A Markov decision process with finite state space and fixed policy is defined with a 5-tuple [math]\displaystyle{ {s,a,p,\gamma,r} }[/math], which includes the finite state space [math]\displaystyle{ S={{1,2,\ldots,s}} }[/math], the finite action space [math]\displaystyle{ A }[/math], the reward function [math]\displaystyle{ r }[/math], discount factor [math]\displaystyle{ \gamma\in [0,1) }[/math], and the transition model [math]\displaystyle{ P }[/math].

Bellman equation is defined as:

[math]\displaystyle{ v=r+\gamma Pv. \, }[/math]

When the number of elements in [math]\displaystyle{ S }[/math] is small, [math]\displaystyle{ v }[/math] is usually maintained as tabular form. While [math]\displaystyle{ S }[/math] grows too large for this kind of representation. [math]\displaystyle{ v }[/math] is commonly being approximated via a linear combination of basis function [math]\displaystyle{ \Phi={\phi_1,\phi_2,\ldots,\phi_n} }[/math],[2] so that we have:

[math]\displaystyle{ v\approx\hat{v}=\sum_{i=1}^n\theta_n\phi_{n} }[/math]

Here [math]\displaystyle{ \Phi }[/math] is a [math]\displaystyle{ |S|\times n }[/math] matrix in which every row contains a feature vector for corresponding row, [math]\displaystyle{ \theta }[/math] is a weight vector with n parameters and usually [math]\displaystyle{ n\ll |s| }[/math].

Basis construction looks for ways to automatically construct better basis function [math]\displaystyle{ \Phi }[/math] which can represent the value function well.

A good construction method should have the following characteristics:

  • Small error bounds between the estimate and real value function
  • Form orthogonal basis in the value function space
  • Converge to stationary value function fast

Popular methods

Proto-value basis

In this approach, Mahadevan analyzes the connectivity graph between states to determine a set of basis functions.[3]

The normalized graph Laplacian is defined as:

[math]\displaystyle{ L=I-D^{-\frac{1}{2}}WD^{-\frac{1}{2}} }[/math]

Here W is an adjacency matrix which represents the states of fixed policy MDP which forms an undirected graph (N,E). D is a diagonal matrix related to nodes' degrees.

In discrete state space, the adjacency matrix [math]\displaystyle{ W }[/math] could be constructed by simply checking whether two states are connected, and D could be calculated by summing up every row of W. In continuous state space, we could take random walk Laplacian of W.

This spectral framework can be used for value function approximation (VFA). Given the fixed policy, the edge weights are determined by corresponding states' transition probability. To get smooth value approximation, diffusion wavelets are used.[3]

Krylov basis

Krylov basis construction uses the actual transition matrix instead of random walk Laplacian. The assumption of this method is that transition model P and reward r are available.

The vectors in Neumann series are denoted as [math]\displaystyle{ y_i=P^ir }[/math] for all [math]\displaystyle{ i\in[0,infty) }[/math].

It shows that Krylov space spanned by [math]\displaystyle{ y_0,y_1,\ldots,y_{m-1} }[/math] is enough to represent any value function,[4] and m is the degree of minimal polynomial of [math]\displaystyle{ (I-\gamma P) }[/math].

Suppose the minimal polynomial is [math]\displaystyle{ p(A)=\frac{1}{\alpha_0}\sum_{i=0}^{m-1}\alpha_{i+1}A^i }[/math], and we have [math]\displaystyle{ BA=I }[/math], the value function can be written as:

[math]\displaystyle{ v=Br=\frac{1}{\alpha_0}\sum_{i=0}^{m-1}\alpha_{i+1}(I-\gamma P)^ir=\sum_{i=0}^{m-1}\alpha_{i+1}\beta_i y_i. }[/math][5]
Algorithm Augmented Krylov Method[5]
[math]\displaystyle{ z_1,z_2,\ldots,z_k }[/math] are top real eigenvectors of P
[math]\displaystyle{ z_{k+1}:=r }[/math]
for [math]\displaystyle{ i:=1:(l+k) }[/math] do
if [math]\displaystyle{ i\gt k+1 }[/math] then
[math]\displaystyle{ z_i:=Pz_{i-1} }[/math];
end if
for [math]\displaystyle{ j:=1:(i-1) }[/math] do
[math]\displaystyle{ z_i:=z_i-\lt z_j,z_i\gt z_j; }[/math]
end for
if [math]\displaystyle{ \parallel z_i\parallel\approx 0 }[/math] then
break;
end if
end for
  • k: number of eigenvectors in basis
  • l: total number of vectors

Bellman error basis

Bellman error (or BEBFs) is defined as: [math]\displaystyle{ \varepsilon=r+\gamma P\hat{v}-\hat{v}=r+\gamma P\Phi\theta-\Phi\theta }[/math].

Loosely speaking, Bellman error points towards the optimal value function.[6] The sequence of BEBF form a basis space which is orthogonal to the real value function space; thus with sufficient number of BEBFs, any value function can be represented exactly.

Algorithm BEBF
stage stage i=1, [math]\displaystyle{ \phi_{1}=r }[/math];
stage [math]\displaystyle{ i\in[2,N] }[/math]
compute the weight vector [math]\displaystyle{ \theta_i }[/math] according to current basis function [math]\displaystyle{ \Phi_i }[/math];
compute new bellman error by [math]\displaystyle{ \varepsilon=r+\gamma P \Phi_{i}\theta_{i}-\Phi_{i}\theta_{i} }[/math];
add bellman error to form new basis function: [math]\displaystyle{ \Phi_{i+1}=[\Phi_{i}:\varepsilon] }[/math];
  • N represents the number of iterations till convergence.
  • ":" means juxtaposing matrices or vectors.

Bellman average reward bases

Bellman Average Reward Bases (or BARBs)[7] is similar to Krylov Bases, but the reward function is being dilated by the average adjusted transition matrix [math]\displaystyle{ P-P^* }[/math]. Here [math]\displaystyle{ P^* }[/math] can be calculated by many methods in.[8]

BARBs converges faster than BEBFs and Krylov when [math]\displaystyle{ \gamma }[/math] is close to 1.

Algorithm BARBs
stage stage i=1, [math]\displaystyle{ P^*r }[/math];
stage [math]\displaystyle{ i\in[2,N] }[/math]
compute the weight vector [math]\displaystyle{ \theta_i }[/math] according to current basis function [math]\displaystyle{ \Phi_i }[/math];
compute new basis: [math]\displaystyle{ :\phi_{i+1}=r-P^*r+P\Phi_{i}\theta_i-\Phi_{i}\theta_i }[/math], and add it to form new bases matrix[math]\displaystyle{ \Phi_{i+1}=[\Phi_{i}:\phi_{i+1}] }[/math];
  • N represents the number of iterations till convergence.
  • ":" means juxtaposing matrices or vectors.

Discussion and analysis

There are two principal types of basis construction methods.

The first type of methods are reward-sensitive, like Krylov and BEBFs; they dilate the reward function geometrically through transition matrix. However, when discount factor [math]\displaystyle{ \gamma }[/math] approaches to 1, Krylov and BEBFs converge slowly. This is because the error Krylov based methods are restricted by Chebyshev polynomial bound.[5] To solve this problem, methods such as BARBs are proposed. BARBs is an incremental variant of Drazin bases, and converges faster than Krylov and BEBFs when [math]\displaystyle{ \gamma }[/math] becomes large.

Another type is reward-insensitive proto value basis function derived from graph Lapalacian. This method uses graph information, but the construction of adjacency matrix makes this method hard to analyze.[5]

See also

References

  1. Keller, Philipp; Mannor, Shie; Precup, Doina. (2006) Automatic Basis Function Construction for Approximate Dynamic Programming and Reinforcement Learning. Proceedings of the 23rd International Conference on Machine Learning, Pittsburgh, PA.
  2. Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction.(1998) MIT Press, Cambridge, MA, chapter 8
  3. 3.0 3.1 Mahadevan, Sridhar; Maggioni, Mauro. (2005) Value function approximation with diffusion wavelets and Laplacian eigenfuctions. Proceedings of Advances in Neural Information Processing Systems.
  4. Ilse C. F. Ipsen and Carl D. Meyer. The idea behind Krylov methods. American Mathematical Monthly, 105(10):889–899, 1998.
  5. 5.0 5.1 5.2 5.3 M. Petrik. An analysis of Laplacian methods for value function approximation in MDPs. In Proceedings of the International Joint Conference on Artificial Intelligence (IJCAI), pages 2574–2579, 2007
  6. R. Parr, C. Painter-Wakefield, L.-H. Li, and M. Littman. Analyzing feature generation for value-function approximation. In ICML’07, 2007.
  7. S. Mahadevan and B. Liu. Basis construction from power series expansions of value functions. In NIPS’10, 2010
  8. William J. Stewart. Numerical methods for computing stationary distributions of finite irreducible Markov chains. In Advances in Computational Probability. Kluwer Academic Publishers, 1997.

External links

  • [1] UMASS ALL lab