Talk:Segmentation/Autoselected Segmentation
Overview
Automatic Segmentation is a concept proposed on the old wiki by Fractal.
Example
Let asee, you have following segmentation axes:
- Lateral Velocity (LV)
- Acceleration (A)
- Time Since Reversal (TSR)
You can 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 the array of segmentations, you need a function to determine how good the data in that segmentation is. One of the 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 (√(∑ a)² / m(a)
where a is the data in the segment).
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
The implementation below is used in Watermelon, which is believe that use by Fractal too.
First, you need either an abstract class or an interface 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. For each number in the sequence, if that place value is a 1, include that axis.
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)
Shouldn't this be on the actual page, not on the talk page? Or are you writing it here, perfecting it, then posting it? --Jacob Litewski 22:59, 15 June 2009 (UTC)
I'm writing it here in small installments while I'm on my breaks at work, then once I'm happy with it I'll move it to the main page. If there's some better way to save "drafts" of a page I'm open to suggestions. -- Synapse 02:09, 16 June 2009 (UTC)
I change something above, especially the math fomula. Hope is isn't too ugly. The first section will be complete later. Some though, I don't think you should post the code here. If you want to post the code, do it in the Free code sub-page of either your user page or the robot's page. The code here should be pseudo-code. And the first implementation thing, I do think that everyone here do know about Polymorphism so I don't think you need to wrote that. » Nat | Talk » 03:20, 16 June 2009 (UTC)
- [View source↑]
- [History↑]
You cannot post new threads to this discussion page because it has been protected from new threads, or you do not currently have permission to edit.