Σάββατο 18 Οκτωβρίου 2014

A resampling example using matlab.

Introduction

In the previous post, a brief introduction on the Dirichlet distribution, Dirichlet process as well as finite and infinite mixture models was given. Furthermore, methods that can be used to perform inference on such models were enumerated. Finally the research question was revisited and the problem, as well as the approach towards solving it were given.
Before continuing to ROS and a low-level implementation of the model, I wanted to have a working example on matlab taking advantage of its nice vectorized functions.

Current setup

The current setup on matlab is now the following:

  • A matalb-based FastSLAM implementation by Grace Lee that was already used in post #1 can be found here
  • A matlab-based Gibbs sampler by François Caron can be found here
The particle positions will be used as input to the Gibbs sampler who will cluster the particles as a mixture of Gaussian distributions. The base distribution that will be used as a prior to the Dirichlet process on the sampler will be a Normal-Inverse-Wishart distribution and was chosen due to its conjugacy to the Gaussian. These mixtures output by the sampler will then be used to train a Hierarchical Dirichlet process with the cluster significance proportional to the particle weights that are classified within the cluster and particle significance proportional to the given particle weight.
An example on the single iteration on the resampling step is then the following:

Particle distribution before resampling
Weighted particle distribution after resampling
Weighted particle distribution before resampling

The particles positions are used as an input to the Gibbs sampler who outputs the particles having clustered them into two clusters as it is shown in the top picture. The weighted particle distribution is shown in the bottom right picture. The hierarchical model then first samples a cluster with probability proportional to the weight of the particles that are classified to the specific cluster. A particle is then chosen form the cluster with probability proportional to the normalized weights of the particles within this cluster. When the number of clusters is one, this sampling method reduces to the roulete wheel. The following video displays the resampling in action with the noise parameters having been significantly increased.

It can be seen that the updated resampling process effectively resamples the particles to the true robot position(blue) even with big amounts of uncertainty added to the model. An issue that is noticeable in the resampling process is the speed. The number of iterations run in the Gibbs sampler can be reduced to increase the process speed, but one cannot be certain of the behaviour of the filter in larger scale maps. Furthermore, there exist alternative methods for inference in the model, such as mean fields method and loopy belief propagation, that can be used for inference instead if speed proves to be a big setback in the implementation.
In order to avoid a very long post and keep this post purely an example implementation, I will put all the technical details of the sampler in my next post.


P.S. Blogger lacks a (working)tool for mathematical formulas. I found many but none of them works. Any feedback on working tools would be greatly appreciated

Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου