Revision: b245b96b04e5
Author: kthayer
Date: Tue May 31 12:30:51 2011
Log: Fixed indexing and size testing if the data set has a name column.
http://code.google.com/p/ifcsoft/source/detail?r=b245b96b04e5
Revision: eaf4592966ae
Author: kthayer
Date: Tue May 31 12:46:45 2011
Log: Fixed bug where SOM weighting wasn't all used if it wasn't on
linear i...
http://code.google.com/p/ifcsoft/source/detail?r=eaf4592966ae
==============================================================================
Revision: b245b96b04e5
Author: kthayer
Date: Tue May 31 12:30:51 2011
Log: Fixed indexing and size testing if the data set has a name column.
http://code.google.com/p/ifcsoft/source/detail?r=b245b96b04e5
Modified:
/src/ifcSoft/model/dataSet/RawData.java
=======================================
--- /src/ifcSoft/model/dataSet/RawData.java Tue May 31 11:54:02 2011
+++ /src/ifcSoft/model/dataSet/RawData.java Tue May 31 12:30:51 2011
@@ -358,6 +358,7 @@
length = 0;
int dataRows = 0;
+ int fileRowCounter = 0;
String st[];
while(line != null){
st = line.split(",");
@@ -378,24 +379,34 @@
boolean didLoadRow = true;
String pointName = null;
if(hasNames){
- pointName = st[0];
- }
- if(st.length != columnLabels.length){
- System.out.println("Error reading FCS, columns in row"
- +dataRows+" didn't match");
- didLoadRow = false;
- }
+ pointName = st[0];
+ if(st.length-1 != columnLabels.length){ //if it uses name, the file
has one extra column
+ System.out.println("Error reading FCS, columns in row"
+ +dataRows+" didn't match");
+ didLoadRow = false;
+ }
+ }else{
+ if(st.length != columnLabels.length){
+ System.out.println("Error reading FCS, columns in row"
+ +dataRows+" didn't match");
+ didLoadRow = false;
+ }
+ }
try{
for(int i = 0; i < columnLabels.length; i++){
- thisrow[i] = Float.parseFloat(st[i]);
+ if(hasNames){
+ thisrow[i] = Float.parseFloat(st[i+1]); //start one over on
file if first is name
+ }else{
+ thisrow[i] = Float.parseFloat(st[i]);
+ }
}
}catch(Exception e){
didLoadRow = false;
System.out.println("Error reading FCS, couldn't parse floats in
row"
- +dataRows);
- }
-
+ +fileRowCounter);
+ }
+ fileRowCounter++;
if(didLoadRow){
tempData.add(thisrow);
if(hasNames){
==============================================================================
Revision: eaf4592966ae
Author: kthayer
Date: Tue May 31 12:46:45 2011
Log: Fixed bug where SOM weighting wasn't all used if it wasn't on
linear init.
http://code.google.com/p/ifcsoft/source/detail?r=eaf4592966ae
Modified:
/src/ifcSoft/model/som/SOM.java
=======================================
--- /src/ifcSoft/model/som/SOM.java Wed May 25 09:13:13 2011
+++ /src/ifcSoft/model/som/SOM.java Tue May 31 12:46:45 2011
@@ -116,57 +116,6 @@
protected BlockingQueue<ThreadJob> jobqueue = new
LinkedBlockingQueue<ThreadJob>();
-
- /**
- * Default constructor: creates a random map to start with.
- * @param dims
- * @param width
- * @param height
- * @param mapType
- * @param weighting
- * @param isLog
- * @param dataSet
- */
- /*public SOM(int width, int height, int mapType, float[] weighting,
DataSetScalar dataSet, Facade facade){
- int dims = dataSet.getDimensions();
- SOMnodes = new SOMNode[width][height];
- this.mapType = mapType;
- this.weighting = weighting;
- //this.isLog = isLog;
- this.datasetScalar = dataSet;
- this.facade = facade;
-
- if(this.weighting == null || this.weighting.length < dims){
- this.weighting = new float[dims];
- for(int i = 0; i < dims; i++){
- this.weighting[i] = 1;
- }
- }
-
- SOMInitFns.linearInitialize(width, height, dataSet.getDataSet(), this);
- checkWeighting();
- /*try {
- loadSOMfile(dims);
- } catch (Exception ex) {
- Logger.getLogger(SOM.class.getName()).log(Level.SEVERE, null, ex);
- }*/
-
-
-
-
- //TODO: should I just go ahead and start the threads to await jobs?
- //what happens to threads just sitting out there? I probably should
have
- //universal threads and jobQueue associated with the program, and pass
it to the SOM
- //have a listener to get the threads if they exist?
- /*for(int i = 0; i < 4; i++){
- Thread newthread = new Thread(new SOMThread(jobqueue, facade));
- newthread.setPriority(newthread.getPriority() - 1);
- //drop the priority by 1 so that it runs in background and doesn't
- //interfere with the gui
- newthread.start();
- }
- }*/
-
public SOM(SOMSettings somSettings, Facade facade){
int dims = somSettings.datasetscalar.getDimensions();
SOMnodes = new SOMNode[somSettings.width][somSettings.height];
@@ -182,10 +131,10 @@
this.weighting[i] = 1;
}
}
+ checkWeighting();
if(somSettings.initType == SOMSettings.LINEARINIT){
SOMInitFns.linearInitialize(somSettings.width, somSettings.height,
datasetScalar.getDataSet(), this);
- checkWeighting();
}else if (somSettings.initType == SOMSettings.RANDOMINIT){
SOMInitFns.randomInitialize(somSettings.width, somSettings.height,
this);
}else if (somSettings.initType == SOMSettings.FILEINIT){
@@ -210,66 +159,6 @@
}
-
-
-
- /**
- * Constructor that loads the specific given SOM node values.
- * @param dims
- * @param width
- * @param height
- * @param isLog
- * @param colWeights
- * @param mapType
- * @param dataSet
- * @param oldNodes
- */
- /*public SOM(int dims, int width, int height, float colWeights[], int
mapType, DataSetScalar dataSet, SOMNode[][] oldNodes, Facade facade){
- SOMnodes = new SOMNode[width][height];
- this.mapType = mapType;
- this.datasetScalar = dataSet;
- this.facade = facade;
-
- if(weighting == null || weighting.length < dims){
- weighting = new float[dims];
- for(int i = 0; i < dims; i++){
- weighting[i] = colWeights[i];
- }
- }
-
- /*for now we'll do just square maps*/
- //initialize the nodes
- /*for(int i = 0; i < width; i++){
- for(int j=0; j < height; j++){
- SOMnodes[i][j] = new SOMNode(oldNodes[i][j].getWeights());
- }
- }
-
- initDenseMap();
-
- for(int i = 0; i < 4; i++){
- Thread newthread = new Thread(new SOMThread(jobqueue, facade));
- newthread.start();
- }
-
- //add job to find membership of set
- initMemberArray(dataSet.length());
- int firstpt = 0;
- while(firstpt < dataSet.length()){
- int lastpt = firstpt + 1000 - 1;
- if(lastpt >= dataSet.length()){
- lastpt = dataSet.length() - 1;
- }
- FindMembershipsJob newjob = new FindMembershipsJob(-1, this,
firstpt, lastpt, iscanceled, ispaused);
- try {
- jobqueue.put(newjob);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- firstpt+= 1000;
- }
- }*/
-
/**
* This function saves information on the weighting used, allowing
findBMU to run faster
*/