# History of Chase-san/SelfOrganizingMap

Robo Home | Changes | Preferences | AllPages

Revision 2 . . January 11, 2008 10:32 EST by Chase-san [updated to be a little more useful]
Revision 1 . . January 10, 2008 9:46 EST by Chase-san [creating page]

Difference (from prior major revision) (no other diffs)

 import java.util.*;

Changed: 10c12
 protected int timeIndex;
 protected int timeIndex = 1;

 private Queue updateQueue = new LinkedList(); private Update nextUpdate = null;

Changed: 17c22
 * @param weights - the nubmer of weights found in a node
 * @param weights - the number of weights found in a node

 // if(lattice[i] > maxLatticeDim?) { // maxLatticeDim? = lattice[i]; // } //end if

Removed: 52d59
 //Initializes? each node randomly, not very well done

Removed: 55,61d61
 //I have found that in a 2D map with equal dimensions //that if you set each weight outward from the center //at a distance of about a quarter, and then guassian //it from there with a .5 = dimension/4, that it works //alot better, but my code is far to complex and messy //to include here

Changed: 67c67
 for(int i=0; i
 for(int i=0; i

 public int size() { return nodes.length; } public void addUpdate(double[] input, int index) { updateQueue.offer(new Update(input,index)); } public void distributeUpdate(int num) { if((nextUpdate == null || nextUpdate.startNode > size()) && !updateQueue.isEmpty()) { nextUpdate = updateQueue.poll(); bmu = getBMU(nextUpdate.weights); timeIndex++; } if(nextUpdate == null) return; for(int i=nextUpdate.startNode; i

Changed: 77c101
 for(int i=0; i
 for(int i=0; i

 private class Update { public double[] weights; public int index; public int startNode; public Update(double w[], int i) { weights = w; index = i; startNode = 0; } }

Changed: 107,112c144
 //Make? this smarter, it should degrade over time, and it determines //The? size of the area to update, it should be based on the physical //size of the map, not the number of nodes (easiest is the smallest dimension) //I find its best if it slowly decreases in size over about 100 to 1000 ticks/updates double variance = 10/map.timeIndex;
 double variance = Math.min(2,Math.log(.2*map.timeIndex+1)+.25);

 //double limiter = Math.max(Math.exp(-(map.timeIndex/1000)),.75); if(neighborhood < 0.001) return;

Removed: 115,122d149
 //This? makes the whole thing ALOT faster. Remove for precision or if //you wanna test how you bot handles turn skipping. if(neighborhood < 0.0002) return; //Much? more can be done here, this should also be based on time //and it is, however if this is the bmu, then it will get changed //to the input, an undesirable thing later on. I never did this in //my prototype gun, I could of achieved greater precision here

Removed: 127,130d153
 //This? is just the index updating, very important to multiply in the neighborhood //otherwise it gets very messy later on, not to much you can do here unlike other areas //.7 is purely a magic number I came up with, I find binIndexes / 30 works well too

Removed: 135,137d157
 // statBin[i] = KTools.rollingAvg(bin[0][i], neighborhood*input, // Math.min(update_num, 5), 100);

Changed: 169c189,191
 Yah, I realize I could do better for an example, but I really wanna see what everyone else can come up with for this, its a very basic SOM system, I have myself introduced my own distributed update and so on, this is just the data control. If you like I can add things into this, but I am not an expert programmer, and my methods are anything but pretty. --Chase-san
 Yah, I realize I could do better for an example, but I really wanna see what everyone else can come up with for this, its a very basic SOM system, I have myself introduced my own distributed update and so on, this is just the data control. If you like I can add things into this, but I am not an expert programmer, and my methods are anything but pretty. --Chase-san Its still not running 100% when I plug it into my old prototype gun, but mostly cause I think it uses much more well formed code. ;) --Chase-san

Robo Home | Changes | Preferences | AllPages
Search: