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

From Robowiki
Jump to navigation Jump to search
 
(17 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Automatic Segmentation is a concept proposed on the old wiki by Fractal. You start with a list of segmentation axes:
+
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"? &raquo; <span style="font-size:0.9em;color:darkgreen;">[[User:Nat|Nat]] | [[User_talk:Nat|Talk]]</span> &raquo; 12:45, 15 June 2009 (UTC)
* Lateral Velocity (LV)
+
 
* Acceleration (A)
+
Excellent thought - you can see I've moved the page. Thanks! -- [[User:Synapse|<font style="font-size:0.8em;font-variant:small-caps;">Synapse</font>]] 22:36, 15 June 2009 (UTC)
* Time Since Reversal (TSR)
 
  
You assemble all combinations of segments into a long list of every segmentation that uses these three axes:
+
Shouldn't this be on the actual page, not on the talk page? Or are you writing it here, perfecting it, then posting it? --[[User:J Litewski|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. -- [[User:Synapse|<font style="font-size:0.8em;font-variant:small-caps;">Synapse</font>]] 02:09, 16 June 2009 (UTC)
!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)).
+
: <nowiki>{{stub}}</nowiki> will do =) &raquo; <span style="font-size:0.9em;color:darkgreen;">[[User:Nat|Nat]] | [[User_talk:Nat|Talk]]</span> &raquo; 02:42, 16 June 2009 (UTC)
  
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.
+
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. &raquo; <span style="font-size:0.9em;color:darkgreen;">[[User:Nat|Nat]] | [[User_talk:Nat|Talk]]</span> &raquo; 03:20, 16 June 2009 (UTC)
  
==Implementation==
+
I've updated the math formulas with the images from the main Wikipedia article on crest factor and root-mean-squared calculations. Thanks for the improvements, Nat! You can also see specific code for the assembly of the segments on [[Watermelon/Code#Autoselected_Segmentation | Watermelon/Code]]. -- [[User:Synapse|<font style="font-size:0.8em;font-variant:small-caps;">Synapse</font>]] 06:55, 16 June 2009 (UTC)
  
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.
+
Thanks for noticing, Nat. I just noticed the same thing rereading the old article! :) -- [[User:Synapse|<font style="font-size:0.8em;font-variant:small-caps;">Synapse</font>]] 09:13, 12 September 2009 (UTC)
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.
+
: This strategy has caught me attention before (and still on my must-do list, only at nearly bottom of it) so I know it before. Old wiki is really messy, isn't it? =) &raquo; <span style="font-size:0.9em;color:darkgreen;">[[User:Nat|Nat]] | [[User_talk:Nat|Talk]]</span> &raquo; 09:22, 12 September 2009 (UTC)
  
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.
+
:: In my implementation I've gotten decent results without the [[Multiple Choice|multiple choice]] analysis [[User:Vuen|Vuen]] mentions in the original article. I've been restructuring things so I can try that out, at least on the gun, but so far just picking a good segment seems to work well. I don't think it's a golden bullet, but it was easy to understand once I grokked [[Wave Surfing|wave surfing]] and has gotten good results so far. -- [[User:Synapse|<font style="font-size:0.8em;font-variant:small-caps;">Synapse</font>]] 11:01, 12 September 2009 (UTC)
  
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.
+
== Problems using this with binsmoothing ==
  
<pre>
+
When I use this with binsmoothing, if there's a hit near &plusmn;1, it produces an artificially higher crest factor, since the smoothing is only applied in one direction. This causes segments with a peak near one end or the other to get a much higher priority. Suggestions? --&nbsp;<font style="font-size:0.8em;font-variant:small-caps;">[[User:Synapse|Synapse]]&nbsp;|&nbsp;[[User_talk:Synapse|talk]]</font> 07:12, 10 October 2009 (UTC)
Code will be available tonight.
 
</pre>
 
  
----
+
The only idea that comes to mind here that would would neither distort crest factors, nor distort probabilities within the -1 to +1 range, would be extending your number of bins, to include bins slightly outside the -1 to +1 range, which will never actually be aimed at due to only being written to via smoothing. --[[User:Rednaxela|Rednaxela]] 17:37, 10 October 2009 (UTC)
===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"? &raquo; <span style="font-size:0.9em;color:darkgreen;">[[User:Nat|Nat]] | [[User_talk:Nat|Talk]]</span> &raquo; 12:45, 15 June 2009 (UTC)
+
== Standard Deviation ==
  
Excellent thought - you can see I've moved the page. Thanks! -- [[User:Synapse|<font style="font-size:0.8em;font-variant:small-caps;">Synapse</font>]] 22:36, 15 June 2009 (UTC)
+
Wonder why can't we just use SD of each segment to determine which one is the best? --[[User:Nat|<span style="color:#099;">Nat</span>]] [[User talk:Nat|<span style="color:#0a5;">Pavasant</span>]] 12:06, 23 January 2010 (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? --[[User:J Litewski|Jacob Litewski]] 22:59, 15 June 2009 (UTC)
+
Standard deviation would probably work reasonably in some cases, but I'd consider it less optimal. The case of two very strong peaks far apart is very clearly useful data since it gives a reasonably high rate of hits, but standard deviation would rate it very low, and crest factor would rate it reasonably high. I think crest factor, (with some sort of multiplier to penalize when the number of samples is very low) definitely makes the most sense. --[[User:Rednaxela|Rednaxela]] 16:06, 23 January 2010 (UTC)

Latest revision as of 17:06, 23 January 2010

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)

{{stub}} will do =) » Nat | Talk » 02:42, 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)

I've updated the math formulas with the images from the main Wikipedia article on crest factor and root-mean-squared calculations. Thanks for the improvements, Nat! You can also see specific code for the assembly of the segments on Watermelon/Code. -- Synapse 06:55, 16 June 2009 (UTC)

Thanks for noticing, Nat. I just noticed the same thing rereading the old article! :) -- Synapse 09:13, 12 September 2009 (UTC)

This strategy has caught me attention before (and still on my must-do list, only at nearly bottom of it) so I know it before. Old wiki is really messy, isn't it? =) » Nat | Talk » 09:22, 12 September 2009 (UTC)
In my implementation I've gotten decent results without the multiple choice analysis Vuen mentions in the original article. I've been restructuring things so I can try that out, at least on the gun, but so far just picking a good segment seems to work well. I don't think it's a golden bullet, but it was easy to understand once I grokked wave surfing and has gotten good results so far. -- Synapse 11:01, 12 September 2009 (UTC)

Problems using this with binsmoothing

When I use this with binsmoothing, if there's a hit near ±1, it produces an artificially higher crest factor, since the smoothing is only applied in one direction. This causes segments with a peak near one end or the other to get a much higher priority. Suggestions? -- Synapse | talk 07:12, 10 October 2009 (UTC)

The only idea that comes to mind here that would would neither distort crest factors, nor distort probabilities within the -1 to +1 range, would be extending your number of bins, to include bins slightly outside the -1 to +1 range, which will never actually be aimed at due to only being written to via smoothing. --Rednaxela 17:37, 10 October 2009 (UTC)

Standard Deviation

Wonder why can't we just use SD of each segment to determine which one is the best? --Nat Pavasant 12:06, 23 January 2010 (UTC)

Standard deviation would probably work reasonably in some cases, but I'd consider it less optimal. The case of two very strong peaks far apart is very clearly useful data since it gives a reasonably high rate of hits, but standard deviation would rate it very low, and crest factor would rate it reasonably high. I think crest factor, (with some sort of multiplier to penalize when the number of samples is very low) definitely makes the most sense. --Rednaxela 16:06, 23 January 2010 (UTC)