Wednesday, January 24, 2018

From Colors to Histograms to Neural Networks - Part 1

My previous blog post was about noticing the unique teal coloring of the particle cloud weights following a Kidnap event.  In the time since, I have:

-Used histograms for representing the color change numerically
-Experimented with arranging the datasets to train the neural network
-Tested that my neural network *should* work by training it on a standard sine function
-Found a combination for the neural network that "works" (kinda).

Histograms:

The algorithm behind coloring the particles by weight is this:
1. Come up with a range of color representations.  There should be as many different colors as there are unique weights.
2. Sort the colors from dark to light, and sort the list of unique weights least to greatest.
3. Match each unique weight to a unique color.
4. Apply this mapping to assign a color to each weights in the dataset




I needed a way to numerically recreate the message that the teal color conveys.  I applied a rule and printed out the resulting histograms:

*At each timestep, divide up the data into 10 bins.  Always 10 bins.*

The histograms at each timestep during a "normal" trial looked like this, with some variation:


The histograms following a Kidnapping event and corresponding to the teal particle cloud looked like this:


The next step was preparing the data for the neural network.  I represented the dramatic histogram of the Kidnap event by creating a ratio of the tallest histogram bin at the timestep to the 2nd tallest histogram bin.  Ratios that indicate a Kidnap event are higher (5, 18, 40) while normal ratios are 1 or 2 or less.

Here's a plot of the ratios for the whole duration of the driving trials.  It's bad resolution, but take my word for it: the "sprinkle" outliers at ratios of 20 or above are from the kidnapping trials.  There are even 3 "normal" trials that appear in the outliers, that helped me identify unintentional kidnapping occurrences during these trials.






Note: after explaining the histogram method and showing that it works...I'm still not sure why it works, and why the method appears to work exclusively for kidnapping instances.

No comments:

Post a Comment