Image51

This is an example of the “plot” method from the Kmeans object. It lets you print the training points so that it makes it easy to recognize classes that are too close from each other.

This example is the plot of leg movement after PCA. We started with 6 acceleration values for 64 samples (approx 1/4 of a second). This vector (of dimension 384) was then reduced to 2 values using PCA object.

I can’t wait to see the live projection on top of this information to have a good feeling on how to properly set the recognition threshold (maximal distance to a set to be recognized as belonging to this set).

I am currently trying to implement Mahalanobis distance so that there is some kind of automated distance threshold calculation done for all classes depending on the training data. I cannot manage to make it work now. The distance calculations produce huge values and these values cannot be compared from one class to the other. There must be a bug somewhere… There was no bug, it’s just that we did not have enough data for some classes, so the covariance matrix was near zero.

Mahalanobis distance joy

Here is a comparison of the recognition for grid points using either Euclidean distance or Mahalanobis distance. The threshold was high (4.0) which means we want to be fault tolerant during play.

sample points
samples

samples

euclidean

Euclidean distance

mahalanobis

Mahalanobis distance

Kmeans usage

You have to “feed” it with training samples (using “ClassRecorder” for example). The data is contained in a folder, with one file per class. The files must be named “class_k.txt” where “k” is the label for the class.

Use “learn” method from the Kmeans object to rebuild the codebook from the training data.

You can plot the training data using “plot” and a connection from outlet 4 to a Plot object.