Difference between revisions of "Talk:Segmentation/Autoselected Segmentation"

From Robowiki
Jump to navigation Jump to search
m (→‎Thoughts/Suggestions: slepping issue)
(Completing the article, one break at a time.)
Line 30: Line 30:
 
The segmentation that returns the most useful data (as determined by the Crest Factor) is used either for dodging or aiming, depending on what you need.
 
The segmentation that returns the most useful data (as determined by the Crest Factor) is used either for dodging or aiming, depending on what you need.
  
(to be completed later)
+
==Implementation==
 +
 
 +
First, you need an abstract class to represent a segmentation axis. It needs a minimum and maximum value, a number of segments, and a function to return an index value given a reference to either a bot or enemy.
 +
Create a subclass for each segmentation axis you need - Lateral Velocity, Acceleration, etc.
 +
 
 +
Second, you need a class to represent a single segmentation. It will be initialized with a certain number of axes, and it will segment on all those axes. It also needs to be able to handle being initialized with no axis at all. This class needs to be able to mark a "hit" on itself (possibly with bin smoothing) given the necessary index for each of its axes. It should also be able to indicate how "good" its data is given a certain set of axis indices. It can simply return the Crest Factor, or it can incorporate additional factors such as how many axes it has and how much data has been collected.
 +
 
 +
Finally you need to assemble every possible segmentation into a large array of segmentations. When you register a "hit", mark it on each segmentation. When you need to take advantage of the data you've collected, find the axis indices for each segmentation and ask it how good its data is for that set of indices. Use the segmentation with the best fitness.
 +
 
 +
One simple way to assemble these axes for each segmentation takes advantage of properties of binary numbers. You will have ''2<sup><small>num_of_axes</small></sup>'' segmentations, due to some convenient cancellation in the combinations. Count from ''0'' to ''num_of_segmentations'' in binary, and assign each place value to one of your axes. If that place value is a 1, include that axis this time.
 +
 
 +
<pre>
 +
Code will be available tonight.
 +
</pre>
  
 
----
 
----

Revision as of 23:51, 15 June 2009

Automatic Segmentation is a concept proposed on the old wiki by Fractal. You start with a list of segmentation axes:

  • Lateral Velocity (LV)
  • Acceleration (A)
  • Time Since Reversal (TSR)

You assemble all combinations of segments into a long list of every segmentation that uses these three axes:

Segmentation Depth
(no segmentation) 0
LV 1
A 1
TSR 1
LV / A 2
LV / TSR 2
A / TSR 2
LV / A / TSR 3

Once you have your array of segmentations, you need a function to determine how good the data in that segmentation is. One simple way to do that is with what's called the Crest Factor. This is just the ratio of the peak data to the root-mean-squared value of the data (square root of ((the sum of each element's square) divided by the number of elements)).

The segmentation that returns the most useful data (as determined by the Crest Factor) is used either for dodging or aiming, depending on what you need.

Implementation

First, you need an abstract class to represent a segmentation axis. It needs a minimum and maximum value, a number of segments, and a function to return an index value given a reference to either a bot or enemy. Create a subclass for each segmentation axis you need - Lateral Velocity, Acceleration, etc.

Second, you need a class to represent a single segmentation. It will be initialized with a certain number of axes, and it will segment on all those axes. It also needs to be able to handle being initialized with no axis at all. This class needs to be able to mark a "hit" on itself (possibly with bin smoothing) given the necessary index for each of its axes. It should also be able to indicate how "good" its data is given a certain set of axis indices. It can simply return the Crest Factor, or it can incorporate additional factors such as how many axes it has and how much data has been collected.

Finally you need to assemble every possible segmentation into a large array of segmentations. When you register a "hit", mark it on each segmentation. When you need to take advantage of the data you've collected, find the axis indices for each segmentation and ask it how good its data is for that set of indices. Use the segmentation with the best fitness.

One simple way to assemble these axes for each segmentation takes advantage of properties of binary numbers. You will have 2num_of_axes segmentations, due to some convenient cancellation in the combinations. Count from 0 to num_of_segmentations in binary, and assign each place value to one of your axes. If that place value is a 1, include that axis this time.

Code will be available tonight.

Thoughts/Suggestions

I think we should define new term for this things. The "Automatic Segmentation" word make me feel like "Dynamic Segmentation". Perhaps the "Auto-Choose Segmentation Set"? » Nat | Talk » 12:45, 15 June 2009 (UTC)

Excellent thought - you can see I've moved the page. Thanks! -- Synapse 22:36, 15 June 2009 (UTC)