Constructing skill trees (CST) is a hierarchical reinforcement learning algorithm which can build skill trees from a set of sample solution trajectories obtained from demonstration. CST uses an incremental MAP (maximum a posteriori) change point detection algorithm to segment each demonstration trajectory into skills and integrate the results into a skill tree. CST was introduced by George Konidaris, Scott Kuindersma, Andrew Barto and Roderic Grupen in 2010.[1]
CST consists of mainly three parts;change point detection, alignment and merging. The main focus of CST is online change-point detection. The change-point detection algorithm is used to segment data into skills and uses the sum of discounted reward
Rt
The change point detection algorithm is implemented as follows. The data for times
t\inT
p(q\inQ)
j+1
P(j,t,q) | |
P(j,t,q)
InverseGamma\left( | v |
2 |
,
u | |
2 |
\right)
Normal(0,\sigma2\delta)
The fit probability
P(j,t,q)
P(j,t,q)= |
| |||||||
\deltam |
\left|(A+D)-1
| ||||
\right| |
| ||||||||
|
| |||||
|
)}
Then, CST compute the probability of the changepoint at time with model,
Pt(j,q)
MAP | |
P | |
j |
MAP | |
P | |
j |
MAP | |
P | |
j |
=maxi,q
Pj(i,q)g(j-i) | |
1-G(j-i-1) |
,\forallj<t
The descriptions of the parameters and variables are as follows;
t | |
A=\sum | |
i=j |
\Phi(xi)\Phi(x
T | |
i) |
\Phi(xi)
xi
t | |
y=(\sum | |
i=j |
2 | |
R | |
i |
)-bT(A+D)-1b
t | |
b=\sum | |
i=j |
Ri\Phi(xi)
T | |
R | |
j=i |
\gammaj-irj
: Gamma function
n=t-j
: The number of basis functions q has.
: an m by m matrix with
\delta-1
The skill length is assumed to follow a Geometric distribution with parameter
g | |
(l)=(1-p)l-1p
G | |
(l)=(1-(1-p)l)
p | = | |
1 | |
k |
: Expected skill length
Using the method above, CST can segment data into a skill chain. The time complexity of the change point detection is
O(NL)
O(Nc)
P(j,t,q)
O(c)
Next step is alignment. CST needs to align the component skills because the change-point does not occur in the exactly same places. Thus, when segmenting second trajectory after segmenting the first trajectory, it has a bias on the location of change point in the second trajectory. This bias follows a mixture of gaussians.
The last step is merging. CST merges skill chains into a skill tree. CST merges a pair of trajectory segments by allocating the same skill. All trajectories have the same goal and it merges two chains by starting at their final segments. If two segments are statistically similar, it merges them. This procedure is repeated until it fails to merge a pair of skill segments.
P(j,t,q)
The following pseudocode describes the change point detection algorithm:
particles := []; Process each incoming data point for t = 1:T do //Compute fit probabilities for all particles for p ∈ particles do p_tjq := (1 − G(t − p.pos − 1)) × p.fit_prob × model_prior(p.model) × p.prev_MAP p.MAP := p_tjq × g(t−p.pos) / (1 − G(t − p.pos − 1)) end // Filter if necessary if the number of particles ≥ N then particles := particle_filter(p.MAP, M) end // Determine the Viterbi path for t = 1 do max_path := [] max_MAP := 1/|Q| else max_particle := p.MAP max_path := max_particle.path ∪ max_particle max_MAP := max_particle.MAP end // Create new particles for a changepoint at time t for q ∈ Q do new_p := create_particle(model=q, pos=t, prev_MAP=max_MAP, path=max_path) p := p ∪ new_p end // Update all particles for p ∈ P do particles := update_particle(current_state, current_reward, p) end end // Return the most likely path to the final point return max_path
function update_particle(current_state, current_reward, particle) is p := particle r_t := current_reward // Initialization if t = 0 then p.A := zero matrix(p.m, p.m) p.b := zero vector(p.m) p.z := zero vector(p.m) p.sum r := 0 p.tr1 := 0 p.tr2 := 0 end if // Compute the basis function vector for the current state Φ := p.Φ (current state) // Update sufficient statistics p.A := p.A + ΦΦ p.z := p.z + Φ p.b := p.b + r p.z p.tr1 := 1 + p.tr1 p.sum r := sum p.r + r p.tr1 + 2r p.tr2 p.tr2 := p.tr2 + r p.tr1 p.fit_prob := compute_fit_prob(p, v, u, delta,)
CTS assume that the demonstrated skills form a tree, the domain reward function is known and the best model for merging a pair of skills is the model selected for representing both individually.
CST is much faster learning algorithm than skill chaining. CST can be applied to learning higher dimensional policies.Even unsuccessful episode can improve skills. Skills acquired using agent-centric features can be used for other problems.
CST has been used to acquire skills from human demonstration in the PinBall domain. It has been also used to acquire skills from human demonstration on a mobile manipulator.