Revision: 99f5e05e8857
Author: Kyle Thayer@your-0cdc4f5844
Date: Wed Jul 13 14:15:27 2011
Log: Loads missing data as NaN.
http://code.google.com/p/ifcsoft/source/detail?r=99f5e05e8857
Revision: 01a918ddd1c4
Author: Kyle Thayer@your-0cdc4f5844
Date: Wed Jul 13 14:57:07 2011
Log: Min/Mean/Max now handles missing values. Added numValsInDim (for
count...
http://code.google.com/p/ifcsoft/source/detail?r=01a918ddd1c4
Revision: fca6ed967c50
Author: Kyle Thayer@your-0cdc4f5844
Date: Wed Jul 13 15:19:36 2011
Log: Standard Deviation now handles missing values. Also does a random
samp...
http://code.google.com/p/ifcsoft/source/detail?r=fca6ed967c50
Revision: 62a5c8f276f5
Author: Kyle Thayer@your-0cdc4f5844
Date: Wed Jul 13 16:03:31 2011
Log: Iterative SOM handles missing values (batch SOM still has some
problem...
http://code.google.com/p/ifcsoft/source/detail?r=62a5c8f276f5
Revision: d11646f39d0f
Author: Kyle Thayer@your-0cdc4f5844
Date: Thu Jul 14 11:55:24 2011
Log: Turn all tabs into 2 spaces.
http://code.google.com/p/ifcsoft/source/detail?r=d11646f39d0f
Revision: 7a26bc04f390
Author: Kyle Thayer@your-0cdc4f5844
Date: Thu Jul 14 12:24:55 2011
Log: Batch SOM now seems to work with missing values.
http://code.google.com/p/ifcsoft/source/detail?r=7a26bc04f390
Revision: c6f1ea00f569
Author: Kyle Thayer@your-0cdc4f5844
Date: Thu Jul 14 12:58:30 2011
Log: Export csv and data set viewer now show empty spaces for missing
value...
http://code.google.com/p/ifcsoft/source/detail?r=c6f1ea00f569
Revision: 061e2b67cb90
Author: Kyle Thayer@your-0cdc4f5844
Date: Fri Jul 22 13:34:04 2011
Log: Calculate SOM now has options for how to deal with missing data:
Use o...
http://code.google.com/p/ifcsoft/source/detail?r=061e2b67cb90
Revision: fb98dd398fe8
Author: Kyle Thayer@your-0cdc4f5844
Date: Thu Aug 4 18:08:33 2011
Log: The Synchronize Data Set dialog now is fully functional. It also
handl...
http://code.google.com/p/ifcsoft/source/detail?r=fb98dd398fe8
Revision: f0b292458805
Author: Kyle Thayer@your-0cdc4f5844
Date: Fri Aug 5 11:41:27 2011
Log: In Synchronize Data Set dialog, make highlighting work for
strings tha...
http://code.google.com/p/ifcsoft/source/detail?r=f0b292458805
Revision: 9f07e08e095a
Author: Kyle Thayer@your-0cdc4f5844
Date: Tue Aug 9 14:02:03 2011
Log: Histogram, Scatterplot and Wind Rose Plots now handle missing
data.
http://code.google.com/p/ifcsoft/source/detail?r=9f07e08e095a
Revision: 844c8fd08100
Author: Kyle Thayer@your-0cdc4f5844
Date: Tue Aug 9 14:14:40 2011
Log: Reworded SOM point selection depending on missing data (still too
word...
http://code.google.com/p/ifcsoft/source/detail?r=844c8fd08100
==============================================================================
Revision: 99f5e05e8857
Author: Kyle Thayer@your-0cdc4f5844
Date: Wed Jul 13 14:15:27 2011
Log: Loads missing data as NaN.
http://code.google.com/p/ifcsoft/source/detail?r=99f5e05e8857
Modified:
/src/ifcSoft/model/dataSet/RawData.java
=======================================
--- /src/ifcSoft/model/dataSet/RawData.java Tue May 31 12:30:51 2011
+++ /src/ifcSoft/model/dataSet/RawData.java Wed Jul 13 14:15:27 2011
@@ -361,6 +361,10 @@
int fileRowCounter = 0;
String st[];
while(line != null){
+ line = line.replaceAll(",,", ", ,"); //make sure at least a space
between each comma
+ if(line.endsWith(",")){//if it ends with a comma, an extra space will
make
+ line = line + " "; //sure the split gives the right number of
elements
+ }
st = line.split(",");
//if the column labels aren't set, then this is the first read
if(columnLabels == null){
@@ -396,9 +400,17 @@
try{
for(int i = 0; i < columnLabels.length; i++){
if(hasNames){
- thisrow[i] = Float.parseFloat(st[i+1]); //start one over on
file if first is name
+ if(st[i+1].trim().length() == 0){ //if no number is empty
+ thisrow[i] = Float.NaN;
+ }else{
+ thisrow[i] = Float.parseFloat(st[i+1]); //start one over on file
if first is name
+ }
}else{
- thisrow[i] = Float.parseFloat(st[i]);
+ if(st[i].trim().length() == 0){ //if no number is empty
+ thisrow[i] = Float.NaN;
+ }else{
+ thisrow[i] = Float.parseFloat(st[i]);
+ }
}
}
}catch(Exception e){
==============================================================================
Revision: 01a918ddd1c4
Author: Kyle Thayer@your-0cdc4f5844
Date: Wed Jul 13 14:57:07 2011
Log: Min/Mean/Max now handles missing values. Added numValsInDim (for
counting amount of non-empty values).
http://code.google.com/p/ifcsoft/source/detail?r=01a918ddd1c4
Modified:
/src/ifcSoft/model/dataSet/DataSet.java
/src/ifcSoft/model/dataSet/DataSetMask.java
/src/ifcSoft/model/dataSet/RawData.java
/src/ifcSoft/model/dataSet/SubsetData.java
/src/ifcSoft/model/dataSet/UnionData.java
/src/ifcSoft/model/dataSet/rearrangeDimDataSet.java
/src/ifcSoft/model/dataSet/summaryData/SummaryData.java
=======================================
--- /src/ifcSoft/model/dataSet/DataSet.java Thu May 26 08:20:43 2011
+++ /src/ifcSoft/model/dataSet/DataSet.java Wed Jul 13 14:57:07 2011
@@ -46,10 +46,11 @@
protected String name;
- public float[] mins; //Probably bad to have it public, but for now it
must be
- public float[] maxes; //so that SummaryData can access it
- public double[] means;
- double[] stddevs;
+ protected int[] numValsInDim; //not counting missing numbers
+ protected float[] mins; //Probably bad to have it public, but for now it
must be
+ protected float[] maxes; //so that SummaryData can access it
+ protected double[] means;
+ protected double[] stddevs;
DataSetMask myMask = null;
@@ -113,6 +114,13 @@
public boolean hasPointNames(){
return false;
}
+
+ public int getNumValsInDim(int dimension){
+ if(myMask == null){
+ return numValsInDim[dimension];
+ }
+ return myMask.getNumValsInDim(dimension);
+ }
/**
* The maximum in the data set of the given dimension.
@@ -234,6 +242,7 @@
*/
protected void findstats() {
for(int k = 0; k < getDimensions(); k++){
+ numValsInDim[k] = 0;
mins[k] = Float.MAX_VALUE;
maxes[k] = Float.MIN_VALUE;
means[k] = 0; //for now we'll use it to keep sums
@@ -243,13 +252,16 @@
for(int k = 0; k < getDimensions(); k++){
//compute averages(at each step it's the current avg. of pts given)
double weight = getVals(i)[k];
- means[k] = weight / (i+1) + (means[k]*i)/(i+1);
- if(weight < mins[k]){
- mins[k] = (float) weight;
- }
- if(weight > maxes[k]){
- maxes[k] = (float)weight;
- }
+ if(!Double.isNaN(weight)){ //if it is a missing value, ignore it
+ means[k] = weight / (numValsInDim[k]+1) +
(means[k]*numValsInDim[k])/(numValsInDim[k]+1);
+ if(weight < mins[k]){
+ mins[k] = (float) weight;
+ }
+ if(weight > maxes[k]){
+ maxes[k] = (float)weight;
+ }
+ numValsInDim[k]++; //the dimension has one more valid value
+ }
}
}
}
=======================================
--- /src/ifcSoft/model/dataSet/DataSetMask.java Fri Feb 11 10:49:36 2011
+++ /src/ifcSoft/model/dataSet/DataSetMask.java Wed Jul 13 14:57:07 2011
@@ -40,7 +40,7 @@
private LinkedList<DataSetMaskRemoved> removedList;
private DataSet parentSet;
-
+ private int[] numValsInDim;
private float[] mins;
private float[] maxes;
private double[] means;
@@ -72,12 +72,14 @@
//get stats from parent
+ numValsInDim = new int[parentSet.getDimensions()];
mins = new float[parentSet.getDimensions()];
maxes = new float[parentSet.getDimensions()];
means = new double[parentSet.getDimensions()];
stddevs = new double[parentSet.getDimensions()];
for(int i = 0; i < parentSet.getDimensions(); i++){
+ numValsInDim[i] = parentSet.numValsInDim[i];
mins[i] = parentSet.getMin(i);
maxes[i] = parentSet.getMax(i);
means[i] = parentSet.getMean(i);
@@ -108,7 +110,9 @@
return length;
}
-
+ int getNumValsInDim(int dimension){
+ return numValsInDim[dimension];
+ }
float getMin(int dimension) {
return mins[dimension];
@@ -248,6 +252,7 @@
private void findstats() {
//parentSet.find
for(int k = 0; k < parentSet.getDimensions(); k++){
+ numValsInDim[k] = 0;
mins[k] = Float.MAX_VALUE;
maxes[k] = Float.MIN_VALUE;
means[k] = 0;
@@ -257,13 +262,16 @@
for(int k = 0; k < parentSet.getDimensions(); k++){
//compute averages(at each step it's the current avg. of pts given)
double weight = getVals(i)[k];
- means[k] = weight / (i+1) + (means[k]*i)/(i+1);
- if(weight < mins[k]){
- mins[k] = (float) weight;
- }
- if(weight > maxes[k]){
- maxes[k] = (float)weight;
- }
+ if(!Double.isNaN(weight)){ //if it is a missing value, ignore it
+ means[k] = weight / (numValsInDim[k]+1) +
(means[k]*numValsInDim[k])/(numValsInDim[k]+1);
+ if(weight < mins[k]){
+ mins[k] = (float) weight;
+ }
+ if(weight > maxes[k]){
+ maxes[k] = (float)weight;
+ }
+ numValsInDim[k]++; //the dimension has one more valid value
+ }
}
}
}
=======================================
--- /src/ifcSoft/model/dataSet/RawData.java Wed Jul 13 14:15:27 2011
+++ /src/ifcSoft/model/dataSet/RawData.java Wed Jul 13 14:57:07 2011
@@ -110,7 +110,7 @@
}
System.out.println();
-
+ numValsInDim = new int[columnLabels.length];
mins = new float[columnLabels.length];
maxes = new float[columnLabels.length];
means = new double[columnLabels.length];
@@ -176,6 +176,7 @@
this.name = name;
this.length = length;
+ numValsInDim = new int[columnLabels.length];
mins = new float[colLabels.length];
maxes = new float[colLabels.length];
means = new double[colLabels.length];
@@ -476,6 +477,7 @@
String[] nameSeg = new String[dataRows];
if(mins == null){
+ numValsInDim = new int[columnLabels.length];
mins = new float[columnLabels.length];
maxes = new float[columnLabels.length];
means = new double[columnLabels.length];
=======================================
--- /src/ifcSoft/model/dataSet/SubsetData.java Wed Apr 20 14:10:36 2011
+++ /src/ifcSoft/model/dataSet/SubsetData.java Wed Jul 13 14:57:07 2011
@@ -40,6 +40,7 @@
dataSet.registerChild((DataSet) this);
+ numValsInDim = new int[parentSet.getDimensions()];
mins = new float[parentSet.getDimensions()];
maxes = new float[parentSet.getDimensions()];
means = new double[parentSet.getDimensions()];
=======================================
--- /src/ifcSoft/model/dataSet/UnionData.java Thu May 26 08:20:43 2011
+++ /src/ifcSoft/model/dataSet/UnionData.java Wed Jul 13 14:57:07 2011
@@ -84,6 +84,7 @@
}
}
+ numValsInDim = new int[dimensions];
mins = new float[dimensions];
maxes = new float[dimensions];
means = new double[dimensions];
@@ -246,15 +247,25 @@
@Override
protected void findstats() {
for(int k = 0; k < getDimensions(); k++){
+ numValsInDim[k] = 0;
mins[k] = Float.MAX_VALUE;
maxes[k] = Float.MIN_VALUE;
means[k] = 0; //for now we'll use it to keep sums
}
+
+ //find numValsInDim of the final set
+ for(int i = 0; i < parentSets.size(); i++){
+ DataSet currentset = parentSets.get(i).getData();
+ for(int k = 0; k < getDimensions(); k++){
+ numValsInDim[k] += currentset.getNumValsInDim(k);
+ }
+ }
+
for(int i = 0; i < parentSets.size(); i++){
DataSet currentset = parentSets.get(i).getData();
for(int k = 0; k < getDimensions(); k++){
- means[k]+= (currentset.length()/(double) this.length)*
currentset.means[k];
+ means[k]+= (currentset.getNumValsInDim(k)/(double)
numValsInDim[k])* currentset.means[k];
if(currentset.mins[k] < mins[k]){
mins[k] = currentset.mins[k];
=======================================
--- /src/ifcSoft/model/dataSet/rearrangeDimDataSet.java Mon May 16 15:24:37
2011
+++ /src/ifcSoft/model/dataSet/rearrangeDimDataSet.java Wed Jul 13 14:57:07
2011
@@ -26,14 +26,16 @@
name = parentSet.name;
+ numValsInDim = new int[colIndeces.length];
mins = new float[colIndeces.length];
maxes= new float[colIndeces.length];
means= new double[colIndeces.length];
for(int i = 0; i < colIndeces.length; i++){
- mins[i] = parentSet.mins[colIndeces[i]];
- maxes[i] = parentSet.maxes[colIndeces[i]];
- means[i] = parentSet.means[colIndeces[i]];
+ numValsInDim[i] = parentSet.getNumValsInDim(colIndeces[i]);
+ mins[i] = parentSet.getMin(colIndeces[i]);
+ maxes[i] = parentSet.getMax(colIndeces[i]);
+ means[i] = parentSet.getMean(colIndeces[i]);
}
=======================================
--- /src/ifcSoft/model/dataSet/summaryData/SummaryData.java Wed Apr 20
08:26:49 2011
+++ /src/ifcSoft/model/dataSet/summaryData/SummaryData.java Wed Jul 13
14:57:07 2011
@@ -57,6 +57,7 @@
datasets.add(dataset);
}
+ numValsInDim = new int[getDimensions()];
mins = new float[getDimensions()];
maxes = new float[getDimensions()];
means = new double[getDimensions()];
==============================================================================
Revision: fca6ed967c50
Author: Kyle Thayer@your-0cdc4f5844
Date: Wed Jul 13 15:19:36 2011
Log: Standard Deviation now handles missing values. Also does a random
sampling if there are a high enough number of data points (should run
faster for very large data sets).
http://code.google.com/p/ifcsoft/source/detail?r=fca6ed967c50
Modified:
/src/ifcSoft/model/dataSet/DataSet.java
/src/ifcSoft/model/dataSet/DataSetMask.java
=======================================
--- /src/ifcSoft/model/dataSet/DataSet.java Wed Jul 13 14:57:07 2011
+++ /src/ifcSoft/model/dataSet/DataSet.java Wed Jul 13 15:19:36 2011
@@ -19,6 +19,7 @@
package ifcSoft.model.dataSet;
import java.util.LinkedList;
+import java.util.Random;
/**
@@ -183,58 +184,44 @@
private void findStandardDevs() {
stddevs = new double[getDimensions()];
- for(int i = 0; i < getDimensions(); i++){
- stddevs[i] =0;
- }
-
- // find the variance (avg of [dist to mean]^2)
- //do this on SegSize at a time, then average those values together,
just to reduce rounding errors
- int numSegs = (int) Math.ceil(length() / (double) DataSet.SEGSIZE);
- int segLengths[] = new int[numSegs];
- for(int i = 0; i < numSegs; i++){
- if(i != numSegs-1){
- segLengths[i] = DataSet.SEGSIZE;
- }else{ //last one is remainder
- segLengths[i] = length() - DataSet.SEGSIZE*(numSegs-1);
- }
- }
-
-
- double [][] segVars = new double[numSegs][getDimensions()];
- //0 it out
- for(int i = 0; i < numSegs; i++){
- for(int k = 0; k < getDimensions(); k++){
- segVars[i][k] = 0;
- }
- }
- int sofar = 0;
- for(int i = 0; i < numSegs; i++){
- for(int j = 0; j < segLengths[i]; j++){
- float[] vals = getVals(sofar);
- sofar++;
- for(int k = 0; k < getDimensions(); k++){
- //compute average of the squares (at each step it's the current
avg. of pts given)
- double distToAvg = vals[k] - means[k];
- segVars[i][k] = distToAvg*distToAvg / (j+1) +
(segVars[i][k]*j)/(j+1);
- }
- }
- }
-
- //compute actual varience from the segments
- double variance[] = new double[getDimensions()];
- for(int k = 0; k < getDimensions(); k++){
+ double variance[] = new double[getDimensions()];
+ for(int k = 0; k < getDimensions(); k++){
variance[k] = 0;
}
- for(int i = 0; i < numSegs; i++){
- for(int k = 0; k < getDimensions(); k++){
- variance[k] += segVars[i][k] * (segLengths[i] / (double) length());
- }
- }
+
+ for(int k=0; k < getDimensions(); k++){
+ //in order to save time, we'll take data from no more than
DataSet.SEGSIZE points
+ if(getNumValsInDim(k) <= DataSet.SEGSIZE){ //do them all
+ int pointsSoFar = 0;
+ for(int i = 0; i < length(); i++){
+ //compute average of the squares (at each step it's the current avg.
of pts given)
+ float[] vals = getVals(i);
+ if(!Float.isNaN(vals[k])){
+ double distToAvg = vals[k] - means[k];
+ variance[k] = distToAvg*distToAvg / (pointsSoFar+1) +
(variance[k]*pointsSoFar)/(pointsSoFar+1);
+ pointsSoFar++;
+ }
+ }
+ }else{ //randomly pick DataSet.SEGSIZE
+ int pointsSoFar = 0;
+ Random r = new Random();
+ while(pointsSoFar < DataSet.SEGSIZE){
+ //compute average of the squares (at each step it's the current avg.
of pts given)
+ float[] vals = getVals(r.nextInt(length()));
+ if(!Float.isNaN(vals[k])){
+ double distToAvg = vals[k] - means[k];
+ variance[k] = distToAvg*distToAvg / (pointsSoFar+1) +
(variance[k]*pointsSoFar)/(pointsSoFar+1);
+ pointsSoFar++;
+ }
+ }
+ }
+ }
//find actual standard devs from the variance we computed
for(int k = 0; k < getDimensions(); k++){
stddevs[k] = Math.sqrt(variance[k]);
}
+
}
/**
=======================================
--- /src/ifcSoft/model/dataSet/DataSetMask.java Wed Jul 13 14:57:07 2011
+++ /src/ifcSoft/model/dataSet/DataSetMask.java Wed Jul 13 15:19:36 2011
@@ -19,6 +19,7 @@
package ifcSoft.model.dataSet;
import java.util.LinkedList;
+import java.util.Random;
/**
*
@@ -277,57 +278,40 @@
}
private void findStandardDevs() {
-
- stddevs = new double[parentSet.getDimensions()];
-
- for(int i = 0; i < parentSet.getDimensions(); i++){
- stddevs[i] =0;
- }
- //TODO: This feels like really ugly code
-
- // find the variance (avg of [dist to mean]^2)
- //do this on SegSize at a time, then average those values together,
just to reduce rounding errors
- int numSegs = (int) Math.ceil(length / (double) DataSet.SEGSIZE);
- int segLengths[] = new int[numSegs];
- for(int i = 0; i < numSegs; i++){
- if(i != numSegs-1){
- segLengths[i] = DataSet.SEGSIZE;
- }else{ //last one is remainder
- segLengths[i] = length - DataSet.SEGSIZE*(numSegs-1);
- }
- }
-
-
- double [][] segVars = new double[numSegs][parentSet.getDimensions()];
- //0 it out
- for(int i = 0; i < numSegs; i++){
- for(int k = 0; k < parentSet.getDimensions(); k++){
- segVars[i][k] = 0;
- }
- }
- int sofar = 0;
- for(int i = 0; i < numSegs; i++){
- for(int j = 0; j < segLengths[i]; j++){
- float[] vals = getVals(sofar);
- sofar++;
- for(int k = 0; k < parentSet.getDimensions(); k++){
- //compute average of the squares (at each step it's the current
avg. of pts given)
- double distToAvg = vals[k] - means[k];
- segVars[i][k] = distToAvg*distToAvg / (j+1) +
(segVars[i][k]*j)/(j+1);
- }
- }
- }
-
- //compute actual varience from the segments
- double variance[] = new double[parentSet.getDimensions()];
- for(int k = 0; k < parentSet.getDimensions(); k++){
+ stddevs = new double[parentSet.getDimensions()];
+
+ double variance[] = new double[parentSet.getDimensions()];
+ for(int k = 0; k < parentSet.getDimensions(); k++){
variance[k] = 0;
}
- for(int i = 0; i < numSegs; i++){
- for(int k = 0; k < parentSet.getDimensions(); k++){
- variance[k] += segVars[i][k] * (segLengths[i] / (double) length);
- }
- }
+
+ for(int k=0; k < parentSet.getDimensions(); k++){
+ //in order to save time, we'll take data from no more than
DataSet.SEGSIZE points
+ if(getNumValsInDim(k) <= DataSet.SEGSIZE){ //do them all
+ int pointsSoFar = 0;
+ for(int i = 0; i < length(); i++){
+ //compute average of the squares (at each step it's the current avg.
of pts given)
+ float[] vals = getVals(i);
+ if(!Float.isNaN(vals[k])){
+ double distToAvg = vals[k] - means[k];
+ variance[k] = distToAvg*distToAvg / (pointsSoFar+1) +
(variance[k]*pointsSoFar)/(pointsSoFar+1);
+ pointsSoFar++;
+ }
+ }
+ }else{ //randomly pick DataSet.SEGSIZE
+ int pointsSoFar = 0;
+ Random r = new Random();
+ while(pointsSoFar < DataSet.SEGSIZE){
+ //compute average of the squares (at each step it's the current avg.
of pts given)
+ float[] vals = getVals(r.nextInt(length()));
+ if(!Float.isNaN(vals[k])){
+ double distToAvg = vals[k] - means[k];
+ variance[k] = distToAvg*distToAvg / (pointsSoFar+1) +
(variance[k]*pointsSoFar)/(pointsSoFar+1);
+ pointsSoFar++;
+ }
+ }
+ }
+ }
//find actual standard devs from the variance we computed
for(int k = 0; k < parentSet.getDimensions(); k++){
==============================================================================
Revision: 62a5c8f276f5
Author: Kyle Thayer@your-0cdc4f5844
Date: Wed Jul 13 16:03:31 2011
Log: Iterative SOM handles missing values (batch SOM still has some
problems).
http://code.google.com/p/ifcsoft/source/detail?r=62a5c8f276f5
Modified:
/src/ifcSoft/model/som/SOMCalcFns.java
/src/ifcSoft/model/som/SOMHelperFns.java
/src/ifcSoft/model/som/SOMInitFns.java
/src/ifcSoft/model/som/SOMNode.java
=======================================
--- /src/ifcSoft/model/som/SOMCalcFns.java Fri Feb 11 10:49:36 2011
+++ /src/ifcSoft/model/som/SOMCalcFns.java Wed Jul 13 16:03:31 2011
@@ -207,8 +207,15 @@
//update the SOM Nodes to be avg of weights placed in neighborsize
for(int i = 0; i < nodeWeightPlaced.length; i++){
for(int j = 0; j < nodeWeightPlaced[0].length; j++){
+ int[] numPtsPerDim = new int[job.SOMdata.getDimensions()];
+ for(int k = 0; k < numPtsPerDim.length; k++){
+ numPtsPerDim[k] = 0;
+ }
double[] avgWeights = new double[job.SOMdata.getDimensions()];
- double vectorsplaced = 0;
+ double vectorsplaced[] = new double[job.SOMdata.getDimensions()];
+ for(int k = 0; k < numPtsPerDim.length; k++){
+ vectorsplaced[k] = 0;
+ }
Point currentpt = new Point(i, j);
//go through all in neighborhoodsize putting in all the weights
for(int nsize = 0; nsize <= neighborsize; nsize++){
@@ -221,21 +228,25 @@
for(int m = 0; m < vectors.size(); m++){
float[] vector = vectors.get(m);
for(int k = 0; k < vector.length; k++){
- avgWeights[k] += vector[k] * factor;
- }
- vectorsplaced+= factor;
+ if(!Float.isNaN(vector[k])){
+ avgWeights[k] += vector[k] * factor;
+ numPtsPerDim[k]++;
+ vectorsplaced[k] += factor;
+ }
+ }
+
}
}
}
- if(vectorsplaced > 0){
- //System.out.println(" node: ("+i+","+j+") vectorsplaced: "+
vectorsplaced);
- //update the node with the new weight
- float newWeights[] = new float[avgWeights.length];
- for(int k = 0; k < avgWeights.length; k++){
- newWeights[k] = (float) (avgWeights[k] / vectorsplaced);
- }
- job.som.SOMnodes[i][j].setWeights(newWeights);
- }
+ for(int k=0; k < vectorsplaced.length; k++){
+ if(vectorsplaced[k] > 0){
+ //System.out.println(" node: ("+i+","+j+") vectorsplaced: "+
vectorsplaced);
+ //update the node with the new weight
+ float newWeights[] = new float[avgWeights.length];
+ newWeights[k] = (float) (avgWeights[k] / vectorsplaced[k]);
+ job.som.SOMnodes[i][j].setWeights(newWeights);
+ }
+ }
}
}
=======================================
--- /src/ifcSoft/model/som/SOMHelperFns.java Fri Feb 11 10:49:36 2011
+++ /src/ifcSoft/model/som/SOMHelperFns.java Wed Jul 13 16:03:31 2011
@@ -142,11 +142,15 @@
int weightLength = currentW.length;
if(som.allUsedWeightsSame){
for(int k = 0; k < weightLength; k++){
- euclidD+= Math.pow(currentW[k] - testweight[k], 2);
+ if(!Float.isNaN(currentW[k]) && !Float.isNaN(testweight[k])){
+ euclidD+= Math.pow(currentW[k] - testweight[k], 2);
+ }
}
}else{ //some weights are different
for(int k = 0; k < weightLength; k++){
- euclidD+= Math.pow(som.weighting[k]*(currentW[k] -
testweight[k]), 2);
+ if(!Float.isNaN(currentW[k]) && !Float.isNaN(testweight[k])){
+ euclidD+= Math.pow(som.weighting[k]*(currentW[k] - testweight[k]),
2);
+ }
}
}
}else{ //only some channels used
@@ -154,12 +158,16 @@
if(som.allUsedWeightsSame){
for(int k = 0; k < channelsUsedLength; k++){
int index = som.channelsUsed[k];
- euclidD+= Math.pow(currentW[index] - testweight[index], 2);
+ if(!Float.isNaN(currentW[index]) && !Float.isNaN(testweight[index])){
+ euclidD+= Math.pow(currentW[index] - testweight[index], 2);
+ }
}
}else{ //some of the used weights are different
for(int k = 0; k < channelsUsedLength; k++){
int index = som.channelsUsed[k];
- euclidD+= Math.pow(som.weighting[index]*(currentW[index] -
testweight[index]), 2);
+ if(!Float.isNaN(currentW[index]) && !Float.isNaN(testweight[index])){
+ euclidD+= Math.pow(som.weighting[index]*(currentW[index] -
testweight[index]), 2);
+ }
}
}
}
=======================================
--- /src/ifcSoft/model/som/SOMInitFns.java Wed Jun 1 14:49:51 2011
+++ /src/ifcSoft/model/som/SOMInitFns.java Wed Jul 13 16:03:31 2011
@@ -80,9 +80,13 @@
for(int i = 0; i < width ; i++){
for(int j = 0; j < height ; j++){
//initialize with random points from the data
- som.SOMnodes[i][j] = new SOMNode(
- som.datasetScalar.getPoint((int) (Math.random() *
(som.datasetScalar.length() - 1)))
- );
+ float values[] = som.datasetScalar.getPoint((int) (Math.random() *
(som.datasetScalar.length() - 1)));
+ for(int k=0; k < values.length; k++){
+ if(Float.isNaN(values[k])){//if it's a missing value, fill it in with
the avg. value
+ values[k] = (float) som.datasetScalar.getMean(k);
+ }
+ }
+ som.SOMnodes[i][j] = new SOMNode(values);
}
}
}
@@ -265,19 +269,29 @@
static private double approxAutoCor(DataSet data, int dim1, int dim2){
double topAvg = 0;
if(data.length() <= 10000){ //do all points
+ int ptsSoFar = 0;
for(int i = 0; i < data.length(); i++){
- double nextpt = (data.getVals(i)[dim1] - data.getMean(dim1))
- *(data.getVals(i)[dim2] - data.getMean(dim2));
- //compute rolling average
- topAvg = (topAvg*i)/(i+1) + nextpt / (i+1);
+ if(!Float.isNaN(data.getVals(i)[dim1])
&& !Double.isNaN(data.getMean(dim1))
+ && !Float.isNaN(data.getVals(i)[dim2])
&& !Double.isNaN(data.getMean(dim2))){
+ double nextpt = (data.getVals(i)[dim1] - data.getMean(dim1))
+ *(data.getVals(i)[dim2] - data.getMean(dim2));
+ //compute rolling average
+ topAvg = (topAvg*ptsSoFar)/(ptsSoFar+1) + nextpt / (ptsSoFar+1);
+ ptsSoFar++;
+ }
}
}else{ //pick 10,000 random points
+ int ptsSoFar = 0;
for(int i = 0; i < 10000; i++){
int index = (int) (Math.random() * data.length());
//compute rolling average
- topAvg = (topAvg*i)/(i+1) +
- (data.getVals(index)[dim1] - data.getMean(dim1))
- *(data.getVals(index)[dim2] - data.getMean(dim2)) /
(i+1);
+ if(!Float.isNaN(data.getVals(i)[dim1])
&& !Double.isNaN(data.getMean(dim1))
+ && !Float.isNaN(data.getVals(i)[dim2])
&& !Double.isNaN(data.getMean(dim2))){
+ topAvg = (topAvg*ptsSoFar)/(ptsSoFar+1) +
+ (data.getVals(index)[dim1] - data.getMean(dim1))
+ *(data.getVals(index)[dim2] - data.getMean(dim2)) / (ptsSoFar+1);
+ ptsSoFar++;
+ }
}
}
=======================================
--- /src/ifcSoft/model/som/SOMNode.java Fri Feb 11 10:49:36 2011
+++ /src/ifcSoft/model/som/SOMNode.java Wed Jul 13 16:03:31 2011
@@ -81,7 +81,9 @@
*/
protected void shiftWeights(float[] newWeight, float alpha){
for(int k=0; k < weights.length; k++){
- weights[k] = (1-alpha)*weights[k] + alpha*newWeight[k];
+ if(!Float.isNaN(newWeight[k])){
+ weights[k] = (1-alpha)*weights[k] + alpha*newWeight[k];
+ }
}
}
}
==============================================================================
Revision: d11646f39d0f
Author: Kyle Thayer@your-0cdc4f5844
Date: Thu Jul 14 11:55:24 2011
Log: Turn all tabs into 2 spaces.
http://code.google.com/p/ifcsoft/source/detail?r=d11646f39d0f
Modified:
/src/ifcSoft/model/dataSet/DataSet.java
/src/ifcSoft/model/dataSet/DataSetMask.java
/src/ifcSoft/model/dataSet/RawData.java
/src/ifcSoft/model/dataSet/SubsetData.java
/src/ifcSoft/model/dataSet/UnionData.java
/src/ifcSoft/model/dataSet/rearrangeDimDataSet.java
/src/ifcSoft/model/dataSet/summaryData/SummaryData.java
/src/ifcSoft/model/som/SOM.java
/src/ifcSoft/model/som/SOMCalcFns.java
/src/ifcSoft/model/som/SOMHelperFns.java
/src/ifcSoft/model/som/SOMInitFns.java
/src/ifcSoft/model/som/SOMNode.java
/src/ifcSoft/view/dialogBox/ifcDialogCheckBox.fx
/src/ifcSoft/view/dialogBox/ifcDialogDataSetSelectBox.fx
/src/ifcSoft/view/dialogBox/ifcDialogRadioButton.fx
/src/ifcSoft/view/som/SOMMediator.java
/src/ifcSoft/view/synchDataSets/SynchDataTable.fx
=======================================
--- /src/ifcSoft/model/dataSet/DataSet.java Wed Jul 13 15:19:36 2011
+++ /src/ifcSoft/model/dataSet/DataSet.java Thu Jul 14 11:55:24 2011
@@ -47,7 +47,7 @@
protected String name;
- protected int[] numValsInDim; //not counting missing numbers
+ protected int[] numValsInDim; //not counting missing numbers
protected float[] mins; //Probably bad to have it public, but for now it
must be
protected float[] maxes; //so that SummaryData can access it
protected double[] means;
@@ -116,12 +116,12 @@
return false;
}
- public int getNumValsInDim(int dimension){
- if(myMask == null){
- return numValsInDim[dimension];
- }
- return myMask.getNumValsInDim(dimension);
- }
+ public int getNumValsInDim(int dimension){
+ if(myMask == null){
+ return numValsInDim[dimension];
+ }
+ return myMask.getNumValsInDim(dimension);
+ }
/**
* The maximum in the data set of the given dimension.
@@ -184,38 +184,38 @@
private void findStandardDevs() {
stddevs = new double[getDimensions()];
- double variance[] = new double[getDimensions()];
- for(int k = 0; k < getDimensions(); k++){
+ double variance[] = new double[getDimensions()];
+ for(int k = 0; k < getDimensions(); k++){
variance[k] = 0;
}
-
- for(int k=0; k < getDimensions(); k++){
- //in order to save time, we'll take data from no more than
DataSet.SEGSIZE points
- if(getNumValsInDim(k) <= DataSet.SEGSIZE){ //do them all
- int pointsSoFar = 0;
- for(int i = 0; i < length(); i++){
- //compute average of the squares (at each step it's the current avg.
of pts given)
- float[] vals = getVals(i);
- if(!Float.isNaN(vals[k])){
- double distToAvg = vals[k] - means[k];
- variance[k] = distToAvg*distToAvg / (pointsSoFar+1) +
(variance[k]*pointsSoFar)/(pointsSoFar+1);
- pointsSoFar++;
- }
- }
- }else{ //randomly pick DataSet.SEGSIZE
- int pointsSoFar = 0;
- Random r = new Random();
- while(pointsSoFar < DataSet.SEGSIZE){
- //compute average of the squares (at each step it's the current avg.
of pts given)
- float[] vals = getVals(r.nextInt(length()));
- if(!Float.isNaN(vals[k])){
- double distToAvg = vals[k] - means[k];
- variance[k] = distToAvg*distToAvg / (pointsSoFar+1) +
(variance[k]*pointsSoFar)/(pointsSoFar+1);
- pointsSoFar++;
- }
- }
- }
- }
+
+ for(int k=0; k < getDimensions(); k++){
+ //in order to save time, we'll take data from no more than
DataSet.SEGSIZE points
+ if(getNumValsInDim(k) <= DataSet.SEGSIZE){ //do them all
+ int pointsSoFar = 0;
+ for(int i = 0; i < length(); i++){
+ //compute average of the squares (at each step it's the current
avg. of pts given)
+ float[] vals = getVals(i);
+ if(!Float.isNaN(vals[k])){
+ double distToAvg = vals[k] - means[k];
+ variance[k] = distToAvg*distToAvg / (pointsSoFar+1) +
(variance[k]*pointsSoFar)/(pointsSoFar+1);
+ pointsSoFar++;
+ }
+ }
+ }else{ //randomly pick DataSet.SEGSIZE
+ int pointsSoFar = 0;
+ Random r = new Random();
+ while(pointsSoFar < DataSet.SEGSIZE){
+ //compute average of the squares (at each step it's the current
avg. of pts given)
+ float[] vals = getVals(r.nextInt(length()));
+ if(!Float.isNaN(vals[k])){
+ double distToAvg = vals[k] - means[k];
+ variance[k] = distToAvg*distToAvg / (pointsSoFar+1) +
(variance[k]*pointsSoFar)/(pointsSoFar+1);
+ pointsSoFar++;
+ }
+ }
+ }
+ }
//find actual standard devs from the variance we computed
for(int k = 0; k < getDimensions(); k++){
@@ -229,7 +229,7 @@
*/
protected void findstats() {
for(int k = 0; k < getDimensions(); k++){
- numValsInDim[k] = 0;
+ numValsInDim[k] = 0;
mins[k] = Float.MAX_VALUE;
maxes[k] = Float.MIN_VALUE;
means[k] = 0; //for now we'll use it to keep sums
@@ -239,16 +239,16 @@
for(int k = 0; k < getDimensions(); k++){
//compute averages(at each step it's the current avg. of pts given)
double weight = getVals(i)[k];
- if(!Double.isNaN(weight)){ //if it is a missing value, ignore it
- means[k] = weight / (numValsInDim[k]+1) +
(means[k]*numValsInDim[k])/(numValsInDim[k]+1);
- if(weight < mins[k]){
- mins[k] = (float) weight;
- }
- if(weight > maxes[k]){
- maxes[k] = (float)weight;
- }
- numValsInDim[k]++; //the dimension has one more valid value
- }
+ if(!Double.isNaN(weight)){ //if it is a missing value, ignore it
+ means[k] = weight / (numValsInDim[k]+1) +
(means[k]*numValsInDim[k])/(numValsInDim[k]+1);
+ if(weight < mins[k]){
+ mins[k] = (float) weight;
+ }
+ if(weight > maxes[k]){
+ maxes[k] = (float)weight;
+ }
+ numValsInDim[k]++; //the dimension has one more valid value
+ }
}
}
}
=======================================
--- /src/ifcSoft/model/dataSet/DataSetMask.java Wed Jul 13 15:19:36 2011
+++ /src/ifcSoft/model/dataSet/DataSetMask.java Thu Jul 14 11:55:24 2011
@@ -41,7 +41,7 @@
private LinkedList<DataSetMaskRemoved> removedList;
private DataSet parentSet;
- private int[] numValsInDim;
+ private int[] numValsInDim;
private float[] mins;
private float[] maxes;
private double[] means;
@@ -73,14 +73,14 @@
//get stats from parent
- numValsInDim = new int[parentSet.getDimensions()];
+ numValsInDim = new int[parentSet.getDimensions()];
mins = new float[parentSet.getDimensions()];
maxes = new float[parentSet.getDimensions()];
means = new double[parentSet.getDimensions()];
stddevs = new double[parentSet.getDimensions()];
for(int i = 0; i < parentSet.getDimensions(); i++){
- numValsInDim[i] = parentSet.numValsInDim[i];
+ numValsInDim[i] = parentSet.numValsInDim[i];
mins[i] = parentSet.getMin(i);
maxes[i] = parentSet.getMax(i);
means[i] = parentSet.getMean(i);
@@ -111,9 +111,9 @@
return length;
}
- int getNumValsInDim(int dimension){
- return numValsInDim[dimension];
- }
+ int getNumValsInDim(int dimension){
+ return numValsInDim[dimension];
+ }
float getMin(int dimension) {
return mins[dimension];
@@ -253,7 +253,7 @@
private void findstats() {
//parentSet.find
for(int k = 0; k < parentSet.getDimensions(); k++){
- numValsInDim[k] = 0;
+ numValsInDim[k] = 0;
mins[k] = Float.MAX_VALUE;
maxes[k] = Float.MIN_VALUE;
means[k] = 0;
@@ -264,54 +264,54 @@
//compute averages(at each step it's the current avg. of pts given)
double weight = getVals(i)[k];
if(!Double.isNaN(weight)){ //if it is a missing value, ignore it
- means[k] = weight / (numValsInDim[k]+1) +
(means[k]*numValsInDim[k])/(numValsInDim[k]+1);
- if(weight < mins[k]){
- mins[k] = (float) weight;
- }
- if(weight > maxes[k]){
- maxes[k] = (float)weight;
- }
- numValsInDim[k]++; //the dimension has one more valid value
- }
+ means[k] = weight / (numValsInDim[k]+1) +
(means[k]*numValsInDim[k])/(numValsInDim[k]+1);
+ if(weight < mins[k]){
+ mins[k] = (float) weight;
+ }
+ if(weight > maxes[k]){
+ maxes[k] = (float)weight;
+ }
+ numValsInDim[k]++; //the dimension has one more valid value
+ }
}
}
}
private void findStandardDevs() {
- stddevs = new double[parentSet.getDimensions()];
-
- double variance[] = new double[parentSet.getDimensions()];
- for(int k = 0; k < parentSet.getDimensions(); k++){
+ stddevs = new double[parentSet.getDimensions()];
+
+ double variance[] = new double[parentSet.getDimensions()];
+ for(int k = 0; k < parentSet.getDimensions(); k++){
variance[k] = 0;
}
- for(int k=0; k < parentSet.getDimensions(); k++){
- //in order to save time, we'll take data from no more than
DataSet.SEGSIZE points
- if(getNumValsInDim(k) <= DataSet.SEGSIZE){ //do them all
- int pointsSoFar = 0;
- for(int i = 0; i < length(); i++){
- //compute average of the squares (at each step it's the current avg.
of pts given)
- float[] vals = getVals(i);
- if(!Float.isNaN(vals[k])){
- double distToAvg = vals[k] - means[k];
- variance[k] = distToAvg*distToAvg / (pointsSoFar+1) +
(variance[k]*pointsSoFar)/(pointsSoFar+1);
- pointsSoFar++;
- }
- }
- }else{ //randomly pick DataSet.SEGSIZE
- int pointsSoFar = 0;
- Random r = new Random();
- while(pointsSoFar < DataSet.SEGSIZE){
- //compute average of the squares (at each step it's the current avg.
of pts given)
- float[] vals = getVals(r.nextInt(length()));
- if(!Float.isNaN(vals[k])){
- double distToAvg = vals[k] - means[k];
- variance[k] = distToAvg*distToAvg / (pointsSoFar+1) +
(variance[k]*pointsSoFar)/(pointsSoFar+1);
- pointsSoFar++;
- }
- }
- }
- }
+ for(int k=0; k < parentSet.getDimensions(); k++){
+ //in order to save time, we'll take data from no more than
DataSet.SEGSIZE points
+ if(getNumValsInDim(k) <= DataSet.SEGSIZE){ //do them all
+ int pointsSoFar = 0;
+ for(int i = 0; i < length(); i++){
+ //compute average of the squares (at each step it's the current
avg. of pts given)
+ float[] vals = getVals(i);
+ if(!Float.isNaN(vals[k])){
+ double distToAvg = vals[k] - means[k];
+ variance[k] = distToAvg*distToAvg / (pointsSoFar+1) +
(variance[k]*pointsSoFar)/(pointsSoFar+1);
+ pointsSoFar++;
+ }
+ }
+ }else{ //randomly pick DataSet.SEGSIZE
+ int pointsSoFar = 0;
+ Random r = new Random();
+ while(pointsSoFar < DataSet.SEGSIZE){
+ //compute average of the squares (at each step it's the current
avg. of pts given)
+ float[] vals = getVals(r.nextInt(length()));
+ if(!Float.isNaN(vals[k])){
+ double distToAvg = vals[k] - means[k];
+ variance[k] = distToAvg*distToAvg / (pointsSoFar+1) +
(variance[k]*pointsSoFar)/(pointsSoFar+1);
+ pointsSoFar++;
+ }
+ }
+ }
+ }
//find actual standard devs from the variance we computed
for(int k = 0; k < parentSet.getDimensions(); k++){
=======================================
--- /src/ifcSoft/model/dataSet/RawData.java Wed Jul 13 14:57:07 2011
+++ /src/ifcSoft/model/dataSet/RawData.java Thu Jul 14 11:55:24 2011
@@ -77,9 +77,9 @@
name = filename;
}
}
- if(name.endsWith(".csv") || name.endsWith(".fcs")){
- name = name.substring(0, name.length()-4);
- }
+ if(name.endsWith(".csv") || name.endsWith(".fcs")){
+ name = name.substring(0, name.length()-4);
+ }
}
/**
@@ -110,7 +110,7 @@
}
System.out.println();
- numValsInDim = new int[columnLabels.length];
+ numValsInDim = new int[columnLabels.length];
mins = new float[columnLabels.length];
maxes = new float[columnLabels.length];
means = new double[columnLabels.length];
@@ -176,7 +176,7 @@
this.name = name;
this.length = length;
- numValsInDim = new int[columnLabels.length];
+ numValsInDim = new int[columnLabels.length];
mins = new float[colLabels.length];
maxes = new float[colLabels.length];
means = new double[colLabels.length];
@@ -359,13 +359,13 @@
length = 0;
int dataRows = 0;
- int fileRowCounter = 0;
+ int fileRowCounter = 0;
String st[];
while(line != null){
- line = line.replaceAll(",,", ", ,"); //make sure at least a space
between each comma
- if(line.endsWith(",")){//if it ends with a comma, an extra space will
make
- line = line + " "; //sure the split gives the right number of
elements
- }
+ line = line.replaceAll(",,", ", ,"); //make sure at least a space
between each comma
+ if(line.endsWith(",")){//if it ends with a comma, an extra space
will make
+ line = line + " "; //sure the split gives the right number of
elements
+ }
st = line.split(",");
//if the column labels aren't set, then this is the first read
if(columnLabels == null){
@@ -384,42 +384,42 @@
boolean didLoadRow = true;
String pointName = null;
if(hasNames){
- 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;
- }
+ 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;
- }
- }
+ 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++){
- if(hasNames){
- if(st[i+1].trim().length() == 0){ //if no number is empty
- thisrow[i] = Float.NaN;
- }else{
- thisrow[i] = Float.parseFloat(st[i+1]); //start one over on file
if first is name
- }
- }else{
- if(st[i].trim().length() == 0){ //if no number is empty
- thisrow[i] = Float.NaN;
- }else{
- thisrow[i] = Float.parseFloat(st[i]);
- }
- }
+ if(hasNames){
+ if(st[i+1].trim().length() == 0){ //if no number is empty
+ thisrow[i] = Float.NaN;
+ }else{
+ thisrow[i] = Float.parseFloat(st[i+1]); //start one over
on file if first is name
+ }
+ }else{
+ if(st[i].trim().length() == 0){ //if no number is empty
+ thisrow[i] = Float.NaN;
+ }else{
+ thisrow[i] = Float.parseFloat(st[i]);
+ }
+ }
}
}catch(Exception e){
didLoadRow = false;
System.out.println("Error reading FCS, couldn't parse floats in
row"
+fileRowCounter);
}
- fileRowCounter++;
+ fileRowCounter++;
if(didLoadRow){
tempData.add(thisrow);
if(hasNames){
@@ -477,7 +477,7 @@
String[] nameSeg = new String[dataRows];
if(mins == null){
- numValsInDim = new int[columnLabels.length];
+ numValsInDim = new int[columnLabels.length];
mins = new float[columnLabels.length];
maxes = new float[columnLabels.length];
means = new double[columnLabels.length];
@@ -532,10 +532,10 @@
if(currentString == null){
if(columnLabels[i].startsWith("\"")){ //start of a special case
currentString = columnLabels[i];
- if(columnLabels[i].endsWith("\"")){ //if it also ends with a "
- newLabels.add(currentString);
- currentString = null;
- }
+ if(columnLabels[i].endsWith("\"")){ //if it also ends with a "
+ newLabels.add(currentString);
+ currentString = null;
+ }
}else{ //normal string value
newLabels.add(columnLabels[i]);
}
=======================================
--- /src/ifcSoft/model/dataSet/SubsetData.java Wed Jul 13 14:57:07 2011
+++ /src/ifcSoft/model/dataSet/SubsetData.java Thu Jul 14 11:55:24 2011
@@ -40,7 +40,7 @@
dataSet.registerChild((DataSet) this);
- numValsInDim = new int[parentSet.getDimensions()];
+ numValsInDim = new int[parentSet.getDimensions()];
mins = new float[parentSet.getDimensions()];
maxes = new float[parentSet.getDimensions()];
means = new double[parentSet.getDimensions()];
=======================================
--- /src/ifcSoft/model/dataSet/UnionData.java Wed Jul 13 14:57:07 2011
+++ /src/ifcSoft/model/dataSet/UnionData.java Thu Jul 14 11:55:24 2011
@@ -84,7 +84,7 @@
}
}
- numValsInDim = new int[dimensions];
+ numValsInDim = new int[dimensions];
mins = new float[dimensions];
maxes = new float[dimensions];
means = new double[dimensions];
@@ -247,19 +247,19 @@
@Override
protected void findstats() {
for(int k = 0; k < getDimensions(); k++){
- numValsInDim[k] = 0;
+ numValsInDim[k] = 0;
mins[k] = Float.MAX_VALUE;
maxes[k] = Float.MIN_VALUE;
means[k] = 0; //for now we'll use it to keep sums
}
- //find numValsInDim of the final set
- for(int i = 0; i < parentSets.size(); i++){
+ //find numValsInDim of the final set
+ for(int i = 0; i < parentSets.size(); i++){
DataSet currentset = parentSets.get(i).getData();
- for(int k = 0; k < getDimensions(); k++){
- numValsInDim[k] += currentset.getNumValsInDim(k);
- }
- }
+ for(int k = 0; k < getDimensions(); k++){
+ numValsInDim[k] += currentset.getNumValsInDim(k);
+ }
+ }
for(int i = 0; i < parentSets.size(); i++){
=======================================
--- /src/ifcSoft/model/dataSet/rearrangeDimDataSet.java Wed Jul 13 14:57:07
2011
+++ /src/ifcSoft/model/dataSet/rearrangeDimDataSet.java Thu Jul 14 11:55:24
2011
@@ -26,13 +26,13 @@
name = parentSet.name;
- numValsInDim = new int[colIndeces.length];
+ numValsInDim = new int[colIndeces.length];
mins = new float[colIndeces.length];
maxes= new float[colIndeces.length];
means= new double[colIndeces.length];
for(int i = 0; i < colIndeces.length; i++){
- numValsInDim[i] = parentSet.getNumValsInDim(colIndeces[i]);
+ numValsInDim[i] = parentSet.getNumValsInDim(colIndeces[i]);
mins[i] = parentSet.getMin(colIndeces[i]);
maxes[i] = parentSet.getMax(colIndeces[i]);
means[i] = parentSet.getMean(colIndeces[i]);
=======================================
--- /src/ifcSoft/model/dataSet/summaryData/SummaryData.java Wed Jul 13
14:57:07 2011
+++ /src/ifcSoft/model/dataSet/summaryData/SummaryData.java Thu Jul 14
11:55:24 2011
@@ -57,7 +57,7 @@
datasets.add(dataset);
}
- numValsInDim = new int[getDimensions()];
+ numValsInDim = new int[getDimensions()];
mins = new float[getDimensions()];
maxes = new float[getDimensions()];
means = new double[getDimensions()];
=======================================
--- /src/ifcSoft/model/som/SOM.java Tue May 31 12:46:45 2011
+++ /src/ifcSoft/model/som/SOM.java Thu Jul 14 11:55:24 2011
@@ -131,7 +131,7 @@
this.weighting[i] = 1;
}
}
- checkWeighting();
+ checkWeighting();
if(somSettings.initType == SOMSettings.LINEARINIT){
SOMInitFns.linearInitialize(somSettings.width, somSettings.height,
datasetScalar.getDataSet(), this);
=======================================
--- /src/ifcSoft/model/som/SOMCalcFns.java Wed Jul 13 16:03:31 2011
+++ /src/ifcSoft/model/som/SOMCalcFns.java Thu Jul 14 11:55:24 2011
@@ -207,15 +207,15 @@
//update the SOM Nodes to be avg of weights placed in neighborsize
for(int i = 0; i < nodeWeightPlaced.length; i++){
for(int j = 0; j < nodeWeightPlaced[0].length; j++){
- int[] numPtsPerDim = new int[job.SOMdata.getDimensions()];
- for(int k = 0; k < numPtsPerDim.length; k++){
- numPtsPerDim[k] = 0;
- }
+ int[] numPtsPerDim = new int[job.SOMdata.getDimensions()];
+ for(int k = 0; k < numPtsPerDim.length; k++){
+ numPtsPerDim[k] = 0;
+ }
double[] avgWeights = new double[job.SOMdata.getDimensions()];
double vectorsplaced[] = new double[job.SOMdata.getDimensions()];
- for(int k = 0; k < numPtsPerDim.length; k++){
- vectorsplaced[k] = 0;
- }
+ for(int k = 0; k < numPtsPerDim.length; k++){
+ vectorsplaced[k] = 0;
+ }
Point currentpt = new Point(i, j);
//go through all in neighborhoodsize putting in all the weights
for(int nsize = 0; nsize <= neighborsize; nsize++){
@@ -228,25 +228,25 @@
for(int m = 0; m < vectors.size(); m++){
float[] vector = vectors.get(m);
for(int k = 0; k < vector.length; k++){
- if(!Float.isNaN(vector[k])){
- avgWeights[k] += vector[k] * factor;
- numPtsPerDim[k]++;
- vectorsplaced[k] += factor;
- }
+ if(!Float.isNaN(vector[k])){
+ avgWeights[k] += vector[k] * factor;
+ numPtsPerDim[k]++;
+ vectorsplaced[k] += factor;
+ }
}
}
}
}
- for(int k=0; k < vectorsplaced.length; k++){
- if(vectorsplaced[k] > 0){
- //System.out.println(" node: ("+i+","+j+") vectorsplaced: "+
vectorsplaced);
- //update the node with the new weight
- float newWeights[] = new float[avgWeights.length];
- newWeights[k] = (float) (avgWeights[k] / vectorsplaced[k]);
- job.som.SOMnodes[i][j].setWeights(newWeights);
- }
- }
+ for(int k=0; k < vectorsplaced.length; k++){
+ if(vectorsplaced[k] > 0){
+ //System.out.println(" node: ("+i+","+j+")
vectorsplaced: "+ vectorsplaced);
+ //update the node with the new weight
+ float newWeights[] = new float[avgWeights.length];
+ newWeights[k] = (float) (avgWeights[k] / vectorsplaced[k]);
+ job.som.SOMnodes[i][j].setWeights(newWeights);
+ }
+ }
}
}
=======================================
--- /src/ifcSoft/model/som/SOMHelperFns.java Wed Jul 13 16:03:31 2011
+++ /src/ifcSoft/model/som/SOMHelperFns.java Thu Jul 14 11:55:24 2011
@@ -142,15 +142,15 @@
int weightLength = currentW.length;
if(som.allUsedWeightsSame){
for(int k = 0; k < weightLength; k++){
- if(!Float.isNaN(currentW[k]) && !Float.isNaN(testweight[k])){
- euclidD+= Math.pow(currentW[k] - testweight[k], 2);
- }
+ if(!Float.isNaN(currentW[k]) && !Float.isNaN(testweight[k])){
+ euclidD+= Math.pow(currentW[k] - testweight[k], 2);
+ }
}
}else{ //some weights are different
for(int k = 0; k < weightLength; k++){
- if(!Float.isNaN(currentW[k]) && !Float.isNaN(testweight[k])){
- euclidD+= Math.pow(som.weighting[k]*(currentW[k] - testweight[k]),
2);
- }
+ if(!Float.isNaN(currentW[k]) && !Float.isNaN(testweight[k])){
+ euclidD+= Math.pow(som.weighting[k]*(currentW[k] -
testweight[k]), 2);
+ }
}
}
}else{ //only some channels used
@@ -158,16 +158,16 @@
if(som.allUsedWeightsSame){
for(int k = 0; k < channelsUsedLength; k++){
int index = som.channelsUsed[k];
- if(!Float.isNaN(currentW[index]) && !Float.isNaN(testweight[index])){
- euclidD+= Math.pow(currentW[index] - testweight[index], 2);
- }
+ if(!Float.isNaN(currentW[index])
&& !Float.isNaN(testweight[index])){
+ euclidD+= Math.pow(currentW[index] - testweight[index], 2);
+ }
}
}else{ //some of the used weights are different
for(int k = 0; k < channelsUsedLength; k++){
int index = som.channelsUsed[k];
- if(!Float.isNaN(currentW[index]) && !Float.isNaN(testweight[index])){
- euclidD+= Math.pow(som.weighting[index]*(currentW[index] -
testweight[index]), 2);
- }
+ if(!Float.isNaN(currentW[index])
&& !Float.isNaN(testweight[index])){
+ euclidD+= Math.pow(som.weighting[index]*(currentW[index] -
testweight[index]), 2);
+ }
}
}
}
=======================================
--- /src/ifcSoft/model/som/SOMInitFns.java Wed Jul 13 16:03:31 2011
+++ /src/ifcSoft/model/som/SOMInitFns.java Thu Jul 14 11:55:24 2011
@@ -80,12 +80,12 @@
for(int i = 0; i < width ; i++){
for(int j = 0; j < height ; j++){
//initialize with random points from the data
- float values[] = som.datasetScalar.getPoint((int) (Math.random() *
(som.datasetScalar.length() - 1)));
- for(int k=0; k < values.length; k++){
- if(Float.isNaN(values[k])){//if it's a missing value, fill it in with
the avg. value
- values[k] = (float) som.datasetScalar.getMean(k);
- }
- }
+ float values[] = som.datasetScalar.getPoint((int) (Math.random() *
(som.datasetScalar.length() - 1)));
+ for(int k=0; k < values.length; k++){
+ if(Float.isNaN(values[k])){//if it's a missing value, fill it in
with the avg. value
+ values[k] = (float) som.datasetScalar.getMean(k);
+ }
+ }
som.SOMnodes[i][j] = new SOMNode(values);
}
}
@@ -96,58 +96,58 @@
int dims = dataset.getDimensions();
Matrix m = findAutocorrelationMatrix(dataset);
- //since the autocorrelation Matrix may have had divide by 0s (if std
deviation = 0)
- //we need to remove all row/columns that have a NAN or infinity
- m.print(8, 2);
- boolean dimsValidity[] = new boolean[dims];
- for(int i = 0; i < dims; i++){
- dimsValidity[i] = false;
- }
- for(int i = 0; i < m.getRowDimension(); i++){
- for(int j = 0; j < m.getColumnDimension(); j++){
- if(!Double.isNaN(m.get(i, j)) && !Double.isInfinite(m.get(i, j)) ){
- if(i != j){
- dimsValidity[i] = true;
- dimsValidity[j] = true;
- }
- }
- }
- }
- boolean areAnyInvalid = false;
- for(int i = 0; i < dims; i++){
- if(!dimsValidity[i]){
- areAnyInvalid = true;
- }
- }
-
- if(areAnyInvalid){//if some dimensions are invalid we need to remove
them from the matrix
- int numValid = 0;
- for(int i = 0; i < dims; i++){
- if(dimsValidity[i]){
- numValid++;
- }
- }
- int validDims[] = new int[numValid];
- int validDimsI = 0;
- for(int i = 0; i < dims; i++){
- if(dimsValidity[i]){
- validDims[validDimsI] = i;
- validDimsI++;
- }
- }
-
- //make a new matrix with just the valid dimensions and replace the old
matrix with it
- Matrix newM = new Matrix(numValid,numValid);
- for(int i = 0; i < numValid; i++){
- for(int j = 0; j < numValid; j++){
- newM.set(i, j, m.get(validDims[i], validDims[j]));
- }
- }
-
- m = newM;
- System.out.println("New matrix:");
- m.print(8, 2);
- }
+ //since the autocorrelation Matrix may have had divide by 0s (if std
deviation = 0)
+ //we need to remove all row/columns that have a NAN or infinity
+ m.print(8, 2);
+ boolean dimsValidity[] = new boolean[dims];
+ for(int i = 0; i < dims; i++){
+ dimsValidity[i] = false;
+ }
+ for(int i = 0; i < m.getRowDimension(); i++){
+ for(int j = 0; j < m.getColumnDimension(); j++){
+ if(!Double.isNaN(m.get(i, j)) && !Double.isInfinite(m.get(i, j)) ){
+ if(i != j){
+ dimsValidity[i] = true;
+ dimsValidity[j] = true;
+ }
+ }
+ }
+ }
+ boolean areAnyInvalid = false;
+ for(int i = 0; i < dims; i++){
+ if(!dimsValidity[i]){
+ areAnyInvalid = true;
+ }
+ }
+
+ if(areAnyInvalid){//if some dimensions are invalid we need to remove
them from the matrix
+ int numValid = 0;
+ for(int i = 0; i < dims; i++){
+ if(dimsValidity[i]){
+ numValid++;
+ }
+ }
+ int validDims[] = new int[numValid];
+ int validDimsI = 0;
+ for(int i = 0; i < dims; i++){
+ if(dimsValidity[i]){
+ validDims[validDimsI] = i;
+ validDimsI++;
+ }
+ }
+
+ //make a new matrix with just the valid dimensions and replace the
old matrix with it
+ Matrix newM = new Matrix(numValid,numValid);
+ for(int i = 0; i < numValid; i++){
+ for(int j = 0; j < numValid; j++){
+ newM.set(i, j, m.get(validDims[i], validDims[j]));
+ }
+ }
+
+ m = newM;
+ System.out.println("New matrix:");
+ m.print(8, 2);
+ }
EigenvalueDecomposition test = m.eig();
@@ -168,24 +168,24 @@
double largestEigenV[] = new double[dims];
double secondLargestEigenV[] = new double[dims];
- if(areAnyInvalid){
- int validI = 0;
- for(int k = 0; k < dims; k++){ //the columns (second index) are the
eigen vectors
- if(dimsValidity[k]){
- largestEigenV[k] = eigenvectors.get(validI, largestEigenIndex);
- secondLargestEigenV[k] = eigenvectors.get(validI,
secondLargestEigenIndex);
- validI++;
- }else{
- largestEigenV[k] = dataset.getMean(k);
- secondLargestEigenV[k] = dataset.getMean(k);
- }
- }
- }else{
- for(int k = 0; k < dims; k++){ //the columns (second index) are the
eigen vectors
- largestEigenV[k] = eigenvectors.get(k, largestEigenIndex);
- secondLargestEigenV[k] = eigenvectors.get(k, secondLargestEigenIndex);
- }
- }
+ if(areAnyInvalid){
+ int validI = 0;
+ for(int k = 0; k < dims; k++){ //the columns (second index) are the
eigen vectors
+ if(dimsValidity[k]){
+ largestEigenV[k] = eigenvectors.get(validI, largestEigenIndex);
+ secondLargestEigenV[k] = eigenvectors.get(validI,
secondLargestEigenIndex);
+ validI++;
+ }else{
+ largestEigenV[k] = dataset.getMean(k);
+ secondLargestEigenV[k] = dataset.getMean(k);
+ }
+ }
+ }else{
+ for(int k = 0; k < dims; k++){ //the columns (second index) are the
eigen vectors
+ largestEigenV[k] = eigenvectors.get(k, largestEigenIndex);
+ secondLargestEigenV[k] = eigenvectors.get(k,
secondLargestEigenIndex);
+ }
+ }
Random r = new Random();
int flipLargestEigen =1;
@@ -269,29 +269,29 @@
static private double approxAutoCor(DataSet data, int dim1, int dim2){
double topAvg = 0;
if(data.length() <= 10000){ //do all points
- int ptsSoFar = 0;
+ int ptsSoFar = 0;
for(int i = 0; i < data.length(); i++){
- if(!Float.isNaN(data.getVals(i)[dim1])
&& !Double.isNaN(data.getMean(dim1))
- && !Float.isNaN(data.getVals(i)[dim2])
&& !Double.isNaN(data.getMean(dim2))){
- double nextpt = (data.getVals(i)[dim1] - data.getMean(dim1))
- *(data.getVals(i)[dim2] - data.getMean(dim2));
- //compute rolling average
- topAvg = (topAvg*ptsSoFar)/(ptsSoFar+1) + nextpt / (ptsSoFar+1);
- ptsSoFar++;
- }
+ if(!Float.isNaN(data.getVals(i)[dim1])
&& !Double.isNaN(data.getMean(dim1))
+ && !Float.isNaN(data.getVals(i)[dim2])
&& !Double.isNaN(data.getMean(dim2))){
+ double nextpt = (data.getVals(i)[dim1] - data.getMean(dim1))
+ *(data.getVals(i)[dim2] - data.getMean(dim2));
+ //compute rolling average
+ topAvg = (topAvg*ptsSoFar)/(ptsSoFar+1) + nextpt / (ptsSoFar+1);
+ ptsSoFar++;
+ }
}
}else{ //pick 10,000 random points
- int ptsSoFar = 0;
+ int ptsSoFar = 0;
for(int i = 0; i < 10000; i++){
int index = (int) (Math.random() * data.length());
//compute rolling average
- if(!Float.isNaN(data.getVals(i)[dim1])
&& !Double.isNaN(data.getMean(dim1))
- && !Float.isNaN(data.getVals(i)[dim2])
&& !Double.isNaN(data.getMean(dim2))){
- topAvg = (topAvg*ptsSoFar)/(ptsSoFar+1) +
- (data.getVals(index)[dim1] - data.getMean(dim1))
- *(data.getVals(index)[dim2] - data.getMean(dim2)) / (ptsSoFar+1);
- ptsSoFar++;
- }
+ if(!Float.isNaN(data.getVals(i)[dim1])
&& !Double.isNaN(data.getMean(dim1))
+ && !Float.isNaN(data.getVals(i)[dim2])
&& !Double.isNaN(data.getMean(dim2))){
+ topAvg = (topAvg*ptsSoFar)/(ptsSoFar+1) +
+ (data.getVals(index)[dim1] - data.getMean(dim1))
+ *(data.getVals(index)[dim2] - data.getMean(dim2)) /
(ptsSoFar+1);
+ ptsSoFar++;
+ }
}
}
=======================================
--- /src/ifcSoft/model/som/SOMNode.java Wed Jul 13 16:03:31 2011
+++ /src/ifcSoft/model/som/SOMNode.java Thu Jul 14 11:55:24 2011
@@ -81,9 +81,9 @@
*/
protected void shiftWeights(float[] newWeight, float alpha){
for(int k=0; k < weights.length; k++){
- if(!Float.isNaN(newWeight[k])){
- weights[k] = (1-alpha)*weights[k] + alpha*newWeight[k];
- }
+ if(!Float.isNaN(newWeight[k])){
+ weights[k] = (1-alpha)*weights[k] + alpha*newWeight[k];
+ }
}
}
}
=======================================
--- /src/ifcSoft/view/dialogBox/ifcDialogCheckBox.fx Tue Apr 19 14:14:33
2011
+++ /src/ifcSoft/view/dialogBox/ifcDialogCheckBox.fx Thu Jul 14 11:55:24
2011
@@ -50,13 +50,13 @@
return checkBoxInput.selected;
}
- public function select():Void{
- checkBoxInput.selected = true;
- }
-
- public function unSelect():Void{
- checkBoxInput.selected = false;
- }
+ public function select():Void{
+ checkBoxInput.selected = true;
+ }
+
+ public function unSelect():Void{
+ checkBoxInput.selected = false;
+ }
override function getName():String{
return name;
=======================================
--- /src/ifcSoft/view/dialogBox/ifcDialogDataSetSelectBox.fx Mon May 16
15:24:37 2011
+++ /src/ifcSoft/view/dialogBox/ifcDialogDataSetSelectBox.fx Thu Jul 14
11:55:24 2011
@@ -69,16 +69,16 @@
};
};
- selectAllButton = ifcDialogButton{
- action: selectAll
- text: "Select All"
- }
+ selectAllButton = ifcDialogButton{
+ action: selectAll
+ text: "Select All"
+ }
children = ifcDialogBox{
name:"Select Data Set(s)"
content:[
- selectAllButton,
+ selectAllButton,
ifcDialogScrollView{
node:ifcDialogVBox{content:dataSetCheckBoxes}
maxWidth:400
@@ -92,27 +92,27 @@
};
}
- function selectAll():Void{
- var someUnselected:Boolean = false;
- for(checkBox in dataSetCheckBoxes){
- if(not checkBox.getInput()){
- someUnselected = true;
- }
- }
-
- if(someUnselected){ //select all
- for(checkBox in dataSetCheckBoxes){
- checkBox.select();
- }
- }else{ //unselect all
- for(checkBox in dataSetCheckBoxes){
- checkBox.unSelect();
- }
- }
+ function selectAll():Void{
+ var someUnselected:Boolean = false;
+ for(checkBox in dataSetCheckBoxes){
+ if(not checkBox.getInput()){
+ someUnselected = true;
+ }
+ }
+
+ if(someUnselected){ //select all
+ for(checkBox in dataSetCheckBoxes){
+ checkBox.select();
+ }
+ }else{ //unselect all
+ for(checkBox in dataSetCheckBoxes){
+ checkBox.unSelect();
+ }
+ }
- }
+ }
function okPressed():Void{
=======================================
--- /src/ifcSoft/view/dialogBox/ifcDialogRadioButton.fx Tue Apr 19 14:14:33
2011
+++ /src/ifcSoft/view/dialogBox/ifcDialogRadioButton.fx Thu Jul 14 11:55:24
2011
@@ -54,13 +54,13 @@
return radioButtonInput.selected;
}
- public function select():Void{
- radioButtonInput.selected = true;
- }
-
- public function unSelect():Void{
- radioButtonInput.selected = false;
- }
+ public function select():Void{
+ radioButtonInput.selected = true;
+ }
+
+ public function unSelect():Void{
+ radioButtonInput.selected = false;
+ }
override function getName():String{
return name;
=======================================
--- /src/ifcSoft/view/som/SOMMediator.java Fri Jun 3 11:55:57 2011
+++ /src/ifcSoft/view/som/SOMMediator.java Thu Jul 14 11:55:24 2011
@@ -1259,7 +1259,7 @@
ImageIO.write(screenshot, "png", new File(selectedFile));
}
catch(Exception e){
- e.printStackTrace();
+ e.printStackTrace();
}
}
@@ -1271,7 +1271,7 @@
return bufferedImage;
}
catch(Exception e){
- e.printStackTrace();
+ e.printStackTrace();
return null;
}
}
=======================================
--- /src/ifcSoft/view/synchDataSets/SynchDataTable.fx Fri May 27 13:54:45
2011
+++ /src/ifcSoft/view/synchDataSets/SynchDataTable.fx Thu Jul 14 11:55:24
2011
@@ -407,8 +407,8 @@
}
}
- return false;
- }
+ return false;
+ }
==============================================================================
Revision: 7a26bc04f390
Author: Kyle Thayer@your-0cdc4f5844
Date: Thu Jul 14 12:24:55 2011
Log: Batch SOM now seems to work with missing values.
http://code.google.com/p/ifcsoft/source/detail?r=7a26bc04f390
Modified:
/src/ifcSoft/model/som/SOMCalcFns.java
=======================================
--- /src/ifcSoft/model/som/SOMCalcFns.java Thu Jul 14 11:55:24 2011
+++ /src/ifcSoft/model/som/SOMCalcFns.java Thu Jul 14 12:24:55 2011
@@ -238,15 +238,16 @@
}
}
}
+ float newWeights[] = new float[avgWeights.length];
for(int k=0; k < vectorsplaced.length; k++){
if(vectorsplaced[k] > 0){
- //System.out.println(" node: ("+i+","+j+")
vectorsplaced: "+ vectorsplaced);
//update the node with the new weight
- float newWeights[] = new float[avgWeights.length];
newWeights[k] = (float) (avgWeights[k] / vectorsplaced[k]);
- job.som.SOMnodes[i][j].setWeights(newWeights);
+ }else{ //if no new info, keep old weight
+ newWeights[k] = job.som.SOMnodes[i][j].getWeights()[k];
}
}
+ job.som.SOMnodes[i][j].setWeights(newWeights);
}
}
==============================================================================
Revision: c6f1ea00f569
Author: Kyle Thayer@your-0cdc4f5844
Date: Thu Jul 14 12:58:30 2011
Log: Export csv and data set viewer now show empty spaces for missing
values.
http://code.google.com/p/ifcsoft/source/detail?r=c6f1ea00f569
Modified:
/src/ifcSoft/view/DataSetViewer.fx
/src/ifcSoft/view/dialogBox/ifcDialogDataTable.fx
/src/ifcSoft/view/som/SOMMediator.java
=======================================
--- /src/ifcSoft/view/DataSetViewer.fx Fri Jun 3 08:50:55 2011
+++ /src/ifcSoft/view/DataSetViewer.fx Thu Jul 14 12:58:30 2011
@@ -171,7 +171,10 @@
}
for(j in [0..dsp.getColNames().length-1]){
- bw.write("{dsp.getData().getVals(i)[j]}");
+ var val:Float = dsp.getData().getVals(i)[j];
+ if(not Float.isNaN(val)){ //if it isn't a missing data value
+ bw.write("{val}");
+ }//otherwise we write nothing (empty == missing)
if(indexof j == dsp.getColNames().length-1){
bw.newLine();
}else{
=======================================
--- /src/ifcSoft/view/dialogBox/ifcDialogDataTable.fx Fri Feb 11 10:49:36
2011
+++ /src/ifcSoft/view/dialogBox/ifcDialogDataTable.fx Thu Jul 14 12:58:30
2011
@@ -62,7 +62,11 @@
content:[
Label{text:dataset.getColLabels()[i]},
for(j in [0..numDataPnts-1]){
- Label{text: "{dataset.getVals(j)[i]}" };
+ if(Float.isNaN(dataset.getVals(j)[i])){
+ Label{text: "" };
+ }else{
+ Label{text: "{dataset.getVals(j)[i]}" };
+ }
}
]
}
=======================================
--- /src/ifcSoft/view/som/SOMMediator.java Thu Jul 14 11:55:24 2011
+++ /src/ifcSoft/view/som/SOMMediator.java Thu Jul 14 12:58:30 2011
@@ -1235,7 +1235,10 @@
bw.write(dataSet.getPointName(membMap[i])+",");
}
for(int k = 0; k < dataSet.getDimensions(); k++){
- bw.write(""+dataPt[k]);
+ float val = dataPt[k];
+ if(!Float.isNaN(val)){ //if it isn't a missing data value
+ bw.write(""+val);
+ }//otherwise we write nothing (empty == missing)
if(k != dataSet.getDimensions() - 1){
bw.write(",");
}else{
==============================================================================
Revision: 061e2b67cb90
Author: Kyle Thayer@your-0cdc4f5844
Date: Fri Jul 22 13:34:04 2011
Log: Calculate SOM now has options for how to deal with missing data:
Use only points that are complete in the weighted dimensions, use ones that
are at least half complete, or use all points.
http://code.google.com/p/ifcsoft/source/detail?r=061e2b67cb90
Modified:
/src/ifcSoft/model/som/SOMCalcFns.java
/src/ifcSoft/model/som/SOMSettings.java
/src/ifcSoft/view/som/CalcSOMDialog.fx
=======================================
--- /src/ifcSoft/model/som/SOMCalcFns.java Thu Jul 14 12:24:55 2011
+++ /src/ifcSoft/model/som/SOMCalcFns.java Fri Jul 22 13:34:04 2011
@@ -161,7 +161,6 @@
SOM som = job.som;
DataSetScalar SOMScaledData = job.SOMdata;
- float[][] test = new
float[job.som.SOMnodes.length][job.som.SOMnodes[0].length];
for(int iter = 0; iter < job.iterations; iter++){
//making a 2d array of linked lists is a pain because of generics
=======================================
--- /src/ifcSoft/model/som/SOMSettings.java Mon May 30 19:16:24 2011
+++ /src/ifcSoft/model/som/SOMSettings.java Fri Jul 22 13:34:04 2011
@@ -43,6 +43,10 @@
public static final String CLASSICSOM = "Incremental SOM";
public static final String BATCHSOM = "Batch SOM";
+ public static final String USEALLPOINTS = "Use All";
+ public static final String HALFMISSING = "At least half the used
dimensions present";
+ public static final String COMPLETEPOINTS = "Only points with all
dimensions";
+
public DataSetProxy datasetproxy;
public DataSetScalar datasetscalar;
public String scaleType;
@@ -52,6 +56,8 @@
public String SOMType;
+ public String allowMissingPointsType;
+
public int width;
public int height;
@@ -90,5 +96,7 @@
batchMaxNeighborhood = -1; //default is max dimension / 4
batchMinNeighborhood = 2;
batchPointsPerNode = 100;
+
+ allowMissingPointsType = HALFMISSING;
}
}
=======================================
--- /src/ifcSoft/view/som/CalcSOMDialog.fx Mon May 16 15:24:37 2011
+++ /src/ifcSoft/view/som/CalcSOMDialog.fx Fri Jul 22 13:34:04 2011
@@ -41,6 +41,9 @@
import ifcSoft.model.som.SOMSettings;
import javafx.util.Math;
import ifcSoft.view.dialogBox.ifcDialogItem;
+import ifcSoft.model.dataSet.DataSet;
+import java.util.LinkedList;
+import ifcSoft.model.dataSet.SubsetData;
/**
@@ -114,12 +117,16 @@
return;
}
- var finaldsp:DataSetProxy =
mainMediator.getDataSet(dataSetSelect.getDataSets(),
dataSetSelect.getSynchColumns());
- if(finaldsp == null){
+ var combineddsp:DataSetProxy =
mainMediator.getDataSet(dataSetSelect.getDataSets(),
dataSetSelect.getSynchColumns());
+ if(combineddsp == null){
println("Error in data set combination");
return;
}
+
+ //given the selected way of handling missing data, possibly generate a
new subset of the data
+ var finaldsp:DataSetProxy = handleMissingValsType(combineddsp,
somSettings.allowMissingPointsType, SOMWeights);
somSettings.datasetproxy = finaldsp;
+
//pick the correct scalar
//var datasetscalar:DataSetScalar;
if(somSettings.scaleType == SOMSettings.UNSCALED){
@@ -291,6 +298,9 @@
var batchPntsPerNode:ifcDialogIntInput;
+ var allowMissingValsInput:ifcDialogChoiceBox;
+ var missingValOptions:String[] = [SOMSettings.USEALLPOINTS,
SOMSettings.HALFMISSING, SOMSettings.COMPLETEPOINTS];
+
var advancedContent:ifcDialogItem[] = bind [
rowsInput, colsInput,
scaleTypeInput,
@@ -299,7 +309,8 @@
[classIterInput, classicMaxNbrInput, classicMinNbrInput]
}else{
[batchStepInput,batchMaxNbrInput,batchMinNbrInput,
batchPntsPerNode]
- }
+ },
+ allowMissingValsInput
];
function getAdvancedSettings():Void{
@@ -378,6 +389,12 @@
initialInt: somSettings.batchPointsPerNode
};
+ allowMissingValsInput = ifcDialogChoiceBox{
+ name:"Allow points with missing values:"
+ items: missingValOptions
+ initialSelectedItem: somSettings.allowMissingPointsType
+ };
+
AdvancedBox =ifcDialogBox{
name: "Advanced Settings"
content: bind advancedContent
@@ -411,9 +428,156 @@
somSettings.batchMinNeighborhood = batchMinNbrInput.getInput();
somSettings.batchPointsPerNode = batchPntsPerNode.getInput();
}
+ somSettings.allowMissingPointsType = allowMissingValsInput.getInput()
as String;
+
SOMDialogDisabled = false;
app.removeDialog(AdvancedBox)
}
+
+
+ /**
+ * Given the user options about what data points to allow given what
missing values
+ * they have, this function returns a DataSetProxy of only data the user
allows.
+ *
+ * @param dsp - the original data set
+ * @param allowMissingPointsType - the setting for what to allow
+ * @param weights - the weighting used with the data
+ * @return A DataSetProxy with only points fitting the setting
+ */
+ function handleMissingValsType(dsp:DataSetProxy,
allowMissingPointsType:String, inputweights:Float[]):DataSetProxy{
+ if(allowMissingPointsType == SOMSettings.USEALLPOINTS){ //if we don't
change anything
+ println("Use all points, return old");
+ return dsp;
+ }
+ var weights:Number[] = [];
+ if(inputweights == null){
+ for (names in dsp.getColNames()){
+ insert 1 into weights; //set initial weights all to 1
+ }
+ }else{
+ weights = inputweights;
+ }
+
+
+ var dataset:DataSet = dsp.getData();
+ var numDimsWithMissingVals = 0;
+ var numDimsUsed = 0;
+ println("weights length = {weights.size()}");
+ for(weight in weights){
+ if(weight != 0){ //if the dimension is weighted
+ numDimsUsed++;
+ if(dataset.length() > dataset.getNumValsInDim(indexof weight)){
//if there are missing values
+ numDimsWithMissingVals++;
+ }
+ }
+ }
+
+ //member list
+ var pointsToKeep:LinkedList = new LinkedList(); //this will be of
int[], but JavaFX doesn't allow generics
+ var numPointsRemoved = 0;
+ var numPointsKept = 0;
+ if(allowMissingPointsType == SOMSettings.HALFMISSING){
+ if(numDimsWithMissingVals <= numDimsUsed/2.0){
+ println("less than half missing({numDimsWithMissingVals} of
{numDimsUsed}), return old");
+ return dsp;
+ }
+ //check each point
+ var nextValsToKeep = [];
+ for(i in [0..dataset.length()-1]){
+ if(doesPointHaveHalfDimensions(dataset.getVals(i), weights)){ //if
a valid point
+ numPointsKept++;
+ nextValsToKeep = [nextValsToKeep,i];
+ if(nextValsToKeep.size() > 500){ //if our array is too big, put
it in the linked list and start over
+ pointsToKeep.add(nextValsToKeep);
+ nextValsToKeep = [];
+ }
+ }else{ //the point isn't valid
+ numPointsRemoved++;
+ }
+ }
+ if(nextValsToKeep.size() > 0){
+ pointsToKeep.add(nextValsToKeep);
+ }
+
+ }else if(allowMissingPointsType == SOMSettings.COMPLETEPOINTS){
+ if(numDimsWithMissingVals == 0){
+ println("none missing, return old");
+ return dsp;
+ }
+ //check each point
+ var nextValsToKeep = [];
+ for(i in [0..dataset.length()-1]){
+ if(doesPointHaveAllDimensions(dataset.getVals(i), weights)){ //if
a valid point
+ numPointsKept++;
+ nextValsToKeep = [nextValsToKeep,i];
+ if(nextValsToKeep.size() > 500){ //if our array is too big, put
it in the linked list and start over
+ pointsToKeep.add(nextValsToKeep);
+ nextValsToKeep = [];
+ }
+ }else{ //the point isn't valid
+ numPointsRemoved++;
+ }
+ }
+ if(nextValsToKeep.size() > 0){
+ pointsToKeep.add(nextValsToKeep);
+ }
+ }
+
+ if(numPointsRemoved == 0){ //if nothing was removed, we are done
+ println("none removed, return old");
+ return dsp;
+ }
+
+ //if we get here, then points were removed and we must create a
new "members"
+ //array for making the new subset data set
+ var members:Integer[] =
+ for(array in pointsToKeep){
+ array as Integer[];
+ };
+
+ var newDataSet = new SubsetData(dataset, members);
+
+ var newdsp:DataSetProxy = new DataSetProxy();
+ newdsp.setDataSet(newDataSet);
+
+ println("{numPointsRemoved} removed, return new");
+ return newdsp;
+ }
+
+ function doesPointHaveHalfDimensions(point:Float[],
weights:Float[]):Boolean{
+ var numDims = 0;
+ var numDimsPresent = 0;
+ for(weight in weights){
+ if(weight != 0){
+ numDims++;
+ if(not Float.isNaN(point[indexof weight])){// if number is present
+ numDimsPresent++;
+ }
+ }
+ }
+ if(numDimsPresent >= numDims/2.0){
+ return true;
+ }
+ return false;
+
+ }
+
+ function doesPointHaveAllDimensions(point:Float[],
weights:Float[]):Boolean{
+ var numDims = 0;
+ var numDimsPresent = 0;
+ for(weight in weights){
+ if(weight != 0){
+ numDims++;
+ if(not Float.isNaN(point[indexof weight])){// if number is present
+ numDimsPresent++;
+ }
+ }
+ }
+ if(numDimsPresent == numDims){
+ return true;
+ }
+ return false;
+ }
==============================================================================
Revision: fb98dd398fe8
Author: Kyle Thayer@your-0cdc4f5844
Date: Thu Aug 4 18:08:33 2011
Log: The Synchronize Data Set dialog now is fully functional. It also
handles missing values (and dimensions). A few other related fixes dealing
with missing values and refactoring.
http://code.google.com/p/ifcsoft/source/detail?r=fb98dd398fe8
Modified:
/src/ifcSoft/model/dataSet/UnionData.java
/src/ifcSoft/model/dataSet/rearrangeDimDataSet.java
/src/ifcSoft/view/DataSetViewer.fx
/src/ifcSoft/view/MainMediator.java
/src/ifcSoft/view/RemoveOutliersDialog.fx
/src/ifcSoft/view/ShrinkDataSetDialog.fx
/src/ifcSoft/view/dialogBox/ifcDialogDataSetSelect.fx
/src/ifcSoft/view/dialogBox/ifcDialogDataSetSelectBox.fx
/src/ifcSoft/view/histogram/MakeHistogramDialog.fx
/src/ifcSoft/view/scatterplot/MakeScatterDialog.fx
/src/ifcSoft/view/som/CalcSOMDialog.fx
/src/ifcSoft/view/som/SOMMediator.java
/src/ifcSoft/view/synchDataSets/SynchDataSetDialog.fx
/src/ifcSoft/view/synchDataSets/SynchDataTable.fx
/src/ifcSoft/view/synchDataSets/synchedColumnFX.fx
/src/ifcSoft/view/windrose/MakeWindRoseDialog.fx
=======================================
--- /src/ifcSoft/model/dataSet/UnionData.java Thu Jul 14 11:55:24 2011
+++ /src/ifcSoft/model/dataSet/UnionData.java Thu Aug 4 18:08:33 2011
@@ -19,7 +19,6 @@
package ifcSoft.model.dataSet;
import ifcSoft.model.DataSetProxy;
-import ifcSoft.view.synchDataSets.synchedColumn;
import java.util.Arrays;
import java.util.LinkedList;
@@ -265,13 +264,14 @@
for(int i = 0; i < parentSets.size(); i++){
DataSet currentset = parentSets.get(i).getData();
for(int k = 0; k < getDimensions(); k++){
- means[k]+= (currentset.getNumValsInDim(k)/(double)
numValsInDim[k])* currentset.means[k];
-
- if(currentset.mins[k] < mins[k]){
- mins[k] = currentset.mins[k];
- }
- if(currentset.maxes[k] > maxes[k]){
- maxes[k] = currentset.maxes[k];
+ if(currentset.getNumValsInDim(k) > 0){
+ means[k]+= (currentset.getNumValsInDim(k)/(double)
numValsInDim[k])* currentset.means[k];
+ if(currentset.mins[k] < mins[k]){
+ mins[k] = currentset.mins[k];
+ }
+ if(currentset.maxes[k] > maxes[k]){
+ maxes[k] = currentset.maxes[k];
+ }
}
}
}
=======================================
--- /src/ifcSoft/model/dataSet/rearrangeDimDataSet.java Thu Jul 14 11:55:24
2011
+++ /src/ifcSoft/model/dataSet/rearrangeDimDataSet.java Thu Aug 4 18:08:33
2011
@@ -32,10 +32,17 @@
means= new double[colIndeces.length];
for(int i = 0; i < colIndeces.length; i++){
- numValsInDim[i] = parentSet.getNumValsInDim(colIndeces[i]);
- mins[i] = parentSet.getMin(colIndeces[i]);
- maxes[i] = parentSet.getMax(colIndeces[i]);
- means[i] = parentSet.getMean(colIndeces[i]);
+ if(colIndeces[i] == -1){
+ numValsInDim[i] = 0;
+ mins[i] = Float.NaN;
+ maxes[i] = Float.NaN;
+ means[i] = Float.NaN;
+ }else{
+ numValsInDim[i] = parentSet.getNumValsInDim(colIndeces[i]);
+ mins[i] = parentSet.getMin(colIndeces[i]);
+ maxes[i] = parentSet.getMax(colIndeces[i]);
+ means[i] = parentSet.getMean(colIndeces[i]);
+ }
}
@@ -47,7 +54,11 @@
System.out.print("from old:");
for(int i = 0; i < colIndeces.length; i++){
- System.out.print(parentSet.getColLabels()[colIndeces[i]] + ", ");
+ if(colIndeces[i] == -1){
+ System.out.print("Missing Dimension,");
+ }else{
+ System.out.print(parentSet.getColLabels()[colIndeces[i]] + ", ");
+ }
}
System.out.println();
@@ -64,7 +75,11 @@
float[] parentvals = parentSet.getVals(index);
float[] newvals = new float[getDimensions()];
for(int i = 0; i < colIndeces.length; i++){
- newvals[i] = parentvals[colIndeces[i]];
+ if(colIndeces[i] == -1){
+ newvals[i] = Float.NaN;
+ }else{
+ newvals[i] = parentvals[colIndeces[i]];
+ }
}
return newvals;
}
=======================================
--- /src/ifcSoft/view/DataSetViewer.fx Thu Jul 14 12:58:30 2011
+++ /src/ifcSoft/view/DataSetViewer.fx Thu Aug 4 18:08:33 2011
@@ -88,7 +88,7 @@
function getTable():ifcDialogDataTable{
return ifcDialogDataTable{
- dataset: dataSetSelect.getDataSets()[0].getData()
+ dataset: dataSetSelect.getDataSet().getData()
}
}
@@ -105,14 +105,8 @@
}
public function getCurrentDataSet():DataSetProxy{
- var datasets = (dataSetSelect.getDataSets());
- if(datasets.size() == 0){
- mainApp.alert("No data set selected");
- mainApp.unblockContent();
- return null;
- }
-
- var finaldsp:DataSetProxy =
mainMediator.getDataSet(dataSetSelect.getDataSets(),
dataSetSelect.getSynchColumns());
+
+ var finaldsp:DataSetProxy = dataSetSelect.getDataSet();
if(finaldsp == null){
println("Error in data set combination");
return null;
=======================================
--- /src/ifcSoft/view/MainMediator.java Mon May 16 15:24:37 2011
+++ /src/ifcSoft/view/MainMediator.java Thu Aug 4 18:08:33 2011
@@ -430,30 +430,22 @@
* @return
*/
public DataSetProxy getDataSet(Boolean[] selectedDataSets,
synchedColumn[] synchCols){
- LinkedList<DataSetProxy> dataSets = new LinkedList<DataSetProxy>();
+ LinkedList<DataSetProxy> dataSetsLL = new LinkedList<DataSetProxy>();
for(int i = 0; i < selectedDataSets.length; i++){
if(selectedDataSets[i]){
- dataSets.add(getDSP(i));
+ dataSetsLL.add(getDSP(i));
}
}
- System.out.println(dataSets.size() +" data set selected");
- if(dataSets.size() == 0){
+ if(dataSetsLL.size() == 0){
return null;
}
- if(dataSets.size() == 1){
- return dataSets.get(0);
- }
- DataSetProxy newDSP;
- try {
- newDSP = new DataSetProxy();
- newDSP.setDataSet(new UnionData(dataSets));
-
- } catch (Exception ex) {
- newDSP = null;
- facade.sendNotification(ApplicationFacade.EXCEPTIONALERT, ex, null);
+
+ DataSetProxy[] dataSetArray = new DataSetProxy[dataSetsLL.size()];
+ for(int i = 0; i < dataSetsLL.size(); i++){
+ dataSetArray[i] = dataSetsLL.get(i);
}
- return newDSP;
+ return getDataSet(dataSetArray, synchCols);
}
@@ -471,6 +463,10 @@
if(synchCols != null && synchCols.length > 0){
selectedDataSets = synchronizeDataSets(selectedDataSets,
synchCols);
}
+ if(selectedDataSets.length == 0){
+ getApp().alert("Error: No data sets to combine.");
+ return null;
+ }
newDSP.setDataSet(new UnionData(selectedDataSets));
} catch (Exception ex) {
@@ -487,37 +483,41 @@
DataSet ds = selectedDataSets[i].getData();
String[] newColNames = new String[synchCols.length];
int[] colIndeces = new int[synchCols.length];
- boolean matched = true;
- String missingCol = "";
+ boolean columnDoubled = false;
+ String doubleColumnMessage = "";
for(int j = 0; j < synchCols.length; j++){
boolean colPlaced = false;
+ String colMatchString = "";
newColNames[j] = synchCols[j].colName;
for(int k = 0; k < synchCols[j].sourceNames.length; k++){
for(int m=0; m < ds.getDimensions(); m++){
if(ds.getColLabels()[m].equals(synchCols[j].sourceNames[k])){
- colIndeces[j] = m;
- colPlaced = true;
- break;
+ if(!colPlaced){ // if this is the first value we are adding
+ colIndeces[j] = m;
+ colMatchString = ds.getColLabels()[m];
+ colPlaced = true;
+ break;
+ }else{
+ columnDoubled = true;
+ doubleColumnMessage+="Column "+synchCols[j].colName+" had
both " +
+ colMatchString + " and " +
ds.getColLabels()[m]+".\n";
+ }
}
}
- if(colPlaced){
- break;
- }
}
if(!colPlaced){
- matched = false;
- missingCol = newColNames[j];
+ colIndeces[j] = -1; //if nothing matched, we will return NaNss
break;
}
}
- if(matched){
+ if(!columnDoubled){
DataSet newds = new rearrangeDimDataSet(ds, newColNames,
colIndeces);
DataSetProxy newdsp = new DataSetProxy();
newdsp.setDataSet(newds);
ll.add(newdsp);
}else{
- getApp().alert("Couldn't add "+ ds.getName() +" because it was
missing "+missingCol);
+ getApp().alert("Couldn't add "+ ds.getName() +"
because: "+doubleColumnMessage);
}
}
=======================================
--- /src/ifcSoft/view/RemoveOutliersDialog.fx Thu Apr 14 12:55:27 2011
+++ /src/ifcSoft/view/RemoveOutliersDialog.fx Thu Aug 4 18:08:33 2011
@@ -84,7 +84,7 @@
var finaldsp:DataSetProxy;
if(dsp == null){
- finaldsp = mainMediator.getDataSet(dataSetSelect.getDataSets());
+ finaldsp = dataSetSelect.getDataSet();
}else{
finaldsp = dsp;
}
=======================================
--- /src/ifcSoft/view/ShrinkDataSetDialog.fx Thu Apr 14 12:55:27 2011
+++ /src/ifcSoft/view/ShrinkDataSetDialog.fx Thu Aug 4 18:08:33 2011
@@ -72,7 +72,7 @@
function shrinkDatsetOK():Void{
if(dsp == null){
- dsp = mainMediator.getDataSet(dataSetSelect.getDataSets());
+ dsp = dataSetSelect.getDataSet();
}
mainMediator.shrinkDatset(dsp, shrinkAmtInput.getInput());
=======================================
--- /src/ifcSoft/view/dialogBox/ifcDialogDataSetSelect.fx Mon May 16
15:24:37 2011
+++ /src/ifcSoft/view/dialogBox/ifcDialogDataSetSelect.fx Thu Aug 4
18:08:33 2011
@@ -109,8 +109,9 @@
}
- public function getDataSets():DataSetProxy[]{
- return datasets;
+ public function getDataSet():DataSetProxy{
+ return mainApp.mainMediator.getDataSet(datasets,synchColumns);
+ //return datasets;
}
public function getSynchColumns():synchedColumn[]{
=======================================
--- /src/ifcSoft/view/dialogBox/ifcDialogDataSetSelectBox.fx Thu Jul 14
11:55:24 2011
+++ /src/ifcSoft/view/dialogBox/ifcDialogDataSetSelectBox.fx Thu Aug 4
18:08:33 2011
@@ -25,9 +25,7 @@
import javafx.util.Sequences;
import javafx.stage.Alert;
import ifcSoft.view.synchDataSets.SynchDataSetDialog;
-import javafx.scene.control.ScrollView;
import ifcSoft.view.synchDataSets.synchedColumn;
-import ifcSoft.view.synchDataSets.synchedColumnFX;
/**
* @author Kyle Thayer
@@ -146,7 +144,7 @@
if(isDataSetSelected){
if(doDataColumnsMatch){
okAction();
- }else{
+ }else{ //data sets don't align
var synchD:SynchDataSetDialog = SynchDataSetDialog{
mainMediator:mainApp.getMainMediator()
mainApp:mainApp
=======================================
--- /src/ifcSoft/view/histogram/MakeHistogramDialog.fx Fri Feb 11 10:49:36
2011
+++ /src/ifcSoft/view/histogram/MakeHistogramDialog.fx Thu Aug 4 18:08:33
2011
@@ -58,14 +58,8 @@
}
function histOK():Void{
- var datasets = (dataSetSelect.getDataSets());
- if(datasets.size() == 0){
- app.alert("No data set selected");
- app.unblockContent();
- return;
- }
-
- var finaldsp:DataSetProxy =
mainMediator.getDataSet(dataSetSelect.getDataSets());
+
+ var finaldsp:DataSetProxy = dataSetSelect.getDataSet();
if(finaldsp == null){
println("Error in data set combination");
return;
=======================================
--- /src/ifcSoft/view/scatterplot/MakeScatterDialog.fx Wed May 25 08:28:15
2011
+++ /src/ifcSoft/view/scatterplot/MakeScatterDialog.fx Thu Aug 4 18:08:33
2011
@@ -43,10 +43,13 @@
var scatterDialog:ifcDialogBox;
var dimensions:String[];
var dataSetSelect:ifcDialogDataSetSelect;
- var datasets:DataSetProxy[] = bind dataSetSelect.getDataSets();
- var dataset1:DataSetProxy = bind datasets[0] on replace{
- dimensions = dataset1.getColNames();
- };
+ var dsp:DataSetProxy = bind dataSetSelect.getDataSet() on replace{
+ dimensions = dsp.getColNames();
+ };;
+ // var datasets:DataSetProxy[] = bind dataSetSelect.getDataSets();
+ // var dataset1:DataSetProxy = bind datasets[0] on replace{
+ // dimensions = dataset1.getColNames();
+ // };
var dim1Input:ifcDialogChoiceBox;
@@ -80,14 +83,7 @@
}
function scatterOK():Void{
- var datasets = (dataSetSelect.getDataSets());
- if(datasets.size() == 0){
- app.alert("No data set selected");
- app.unblockContent();
- return;
- }
-
- var finaldsp:DataSetProxy =
mainMediator.getDataSet(dataSetSelect.getDataSets());
+ var finaldsp:DataSetProxy = dataSetSelect.getDataSet();
if(finaldsp == null){
println("Error in data set combination");
return;
=======================================
--- /src/ifcSoft/view/som/CalcSOMDialog.fx Fri Jul 22 13:34:04 2011
+++ /src/ifcSoft/view/som/CalcSOMDialog.fx Thu Aug 4 18:08:33 2011
@@ -110,14 +110,7 @@
function SOMOK(){
- var datasets = (dataSetSelect.getDataSets());
- if(datasets.size() == 0){
- app.alert("No data set selected");
- app.unblockContent();
- return;
- }
-
- var combineddsp:DataSetProxy =
mainMediator.getDataSet(dataSetSelect.getDataSets(),
dataSetSelect.getSynchColumns());
+ var combineddsp:DataSetProxy = dataSetSelect.getDataSet();
if(combineddsp == null){
println("Error in data set combination");
return;
@@ -206,25 +199,13 @@
var SOMWeightsTextBoxes:ifcDialogFloatInput[];
function getSOMWeights(){
- var dataSets = dataSetSelect.getDataSets();
- if(dataSets.size() == 0){
+ var dataSet = dataSetSelect.getDataSet();
+ if(dataSet == null){
app.alert("Error: No data set selected");
return;
}
- var SOMColNames:String[];
-
- if(dataSetSelect.getSynchColumns() == null){
- SOMColNames = dataSets.get(0).getColNames();
- }else{
- for(col in dataSetSelect.getSynchColumns()){
- insert col.colName into SOMColNames;
- }
-
- }
-
-
-
+ var SOMColNames:String[] = dataSet.getColNames();
if(SOMWeights == null or SOMColNames.size() != SOMWeights.size()){
for (names in SOMColNames){
@@ -477,8 +458,7 @@
var numPointsRemoved = 0;
var numPointsKept = 0;
if(allowMissingPointsType == SOMSettings.HALFMISSING){
- if(numDimsWithMissingVals <= numDimsUsed/2.0){
- println("less than half missing({numDimsWithMissingVals} of
{numDimsUsed}), return old");
+ if(numDimsWithMissingVals <= numDimsUsed/2.0){ //over half fully
present, so original dsp is safe
return dsp;
}
//check each point
=======================================
--- /src/ifcSoft/view/som/SOMMediator.java Thu Jul 14 12:58:30 2011
+++ /src/ifcSoft/view/som/SOMMediator.java Thu Aug 4 18:08:33 2011
@@ -1358,16 +1358,6 @@
return mainMed.getDSPSize(index);
}
- /**
- * Returns (and creates if needed) a combination of the given data sets.
- * @param selectedDataSets
- * @return
- */
- public DataSetProxy getDataSet(Boolean[] selectedDataSets){
- return mainMed.getDataSet(selectedDataSets);
-
- }
-
/**
* Returns the MainApp object
* @return
=======================================
--- /src/ifcSoft/view/synchDataSets/SynchDataSetDialog.fx Mon May 16
15:24:37 2011
+++ /src/ifcSoft/view/synchDataSets/SynchDataSetDialog.fx Thu Aug 4
18:08:33 2011
@@ -22,13 +22,8 @@
import ifcSoft.MainApp;
import ifcSoft.view.dialogBox.ifcDialogBox;
import ifcSoft.view.dialogBox.ifcDialogText;
-import ifcSoft.view.dialogBox.ifcDialogHBox;
-import ifcSoft.view.dialogBox.ifcDialogButton;
import ifcSoft.view.MainMediator;
-/**
- * @author Kyle Thayer
- */
public class SynchDataSetDialog {
public-init var mainMediator:MainMediator;
@@ -45,7 +40,10 @@
name: "Synchronize Data Sets"
content:[
ifcDialogText{
- text:"The data sets selected have different dimension labels.
(Note: This is only partially functional)"
+ text:"The data sets selected have different dimension labels.
Drag source names to appropriate column."
+ },
+ ifcDialogText{
+ text:"Double click to change dimension titles. Control+click a
dimension column to delete column."
}
//interactive table with what column names are equivalent
synchTable = SynchDataTable{
@@ -115,70 +113,7 @@
}
- //var shrinkAmtInput:ifcDialogFloatInput;
- /*var dataSetSelect:ifcDialogDataSetSelect= ifcDialogDataSetSelect{
- mainApp:mainApp,
- okAction: function():Void{dataSetTable = getTable()}
- };
- var dataSetTable:ifcDialogDataTable = getTable();*/
- //var saveAsNewDS:ifcDialogRadioButtons;
- /*var dataSetViewerDlg:ifcDialogBox =
- ifcDialogBox{
- name: "Data Set Viewer"
- content:bind [
- dataSetSelect,
- ifcDialogHBox{
- content:[
- ifcDialogButton{
- text:"Save\nData Set"
- action:function(){saveDataSet();}
- },
- ifcDialogButton{
- text:"Remove\nOutliers"
- action:
function(){mainApp.outliersDialog(getCurrentDataSet());}
- },
- ifcDialogButton{
- text:"Shrink\nData Set"
-
action:function(){mainApp.shrinkDatasetDialog(getCurrentDataSet());}
- },
- ]
- },
- dataSetTable
- ]
- cancelName: "Close"
- cancelAction: function():Void{mainApp.removeDialog(dataSetViewerDlg)}
- };*/
-
-
-
-
- /**
- * Create and display the data Set Viewer.
- */
- /*public function dataSetViewer():Void{
- if(mainMediator.getDSP(0) == null){
- mainApp.alert("No Data Set Loaded");
- return;
- }
- mainApp.addDialog(dataSetViewerDlg);
- }*/
-
-/* public function getCurrentDataSet():DataSetProxy{
- var datasets = (dataSetSelect.getDataSets());
- if(datasets.size() == 0){
- mainApp.alert("No data set selected");
- mainApp.unblockContent();
- return null;
- }
-
- var finaldsp:DataSetProxy =
mainMediator.getDataSet(dataSetSelect.getDataSets());
- if(finaldsp == null){
- println("Error in data set combination");
- return null;
- }
-
- return finaldsp;
- }*/
+
=======================================
--- /src/ifcSoft/view/synchDataSets/SynchDataTable.fx Thu Jul 14 11:55:24
2011
+++ /src/ifcSoft/view/synchDataSets/SynchDataTable.fx Thu Aug 4 18:08:33
2011
@@ -24,7 +24,6 @@
import javafx.scene.layout.HBox;
import javafx.scene.shape.Rectangle;
import ifcSoft.view.dialogBox.ifcDialogScrollView;
-import javafx.scene.Node;
import javafx.scene.paint.Color;
import javafx.scene.layout.Stack;
import javafx.scene.text.Text;
@@ -32,6 +31,7 @@
import javafx.scene.input.MouseEvent;
import javafx.scene.control.TextBox;
import javafx.scene.input.InputMethodEvent;
+import javafx.stage.Alert;
@@ -40,17 +40,15 @@
public-init var initialColNames:String[];
public var width:Integer = 600;
var cols:synchedColumnFX[];
- var notPlaced:String[];
- //how do I store current col thingies?
-
- //put editable labels at top for final column titles.
-
- //below that have places where you can drag around the different column
names
- //that match up with it
-
- //option needed to replace column names in data sets
-
- //put the whole thing in a scrollable area? have input max size thingies?
+ var notPlacedCol:synchedColumnFX =
+ synchedColumnFX{
+ colName: "Unused"
+ sourceNames: []
+ boxWidth:bind boxWidth
+ highlightBox: highlightBox
+ moveString: moveString
+ };
+ var scrollArea:ifcDialogScrollView;
var boxWidth:Integer = 85;
var unusedBoxWidth:Integer = bind boxWidth;
@@ -81,6 +79,7 @@
}
}
+
function updateDimText(colNum:Integer):Void{
cols[colNum].colName = dimInputTextBoxes[colNum].rawText;
@@ -114,7 +113,7 @@
}else if (e.controlDown) {
delete col from cols;
for(name in col.sourceNames){
- insert name into notPlaced;
+ insert name into notPlacedCol.sourceNames;
}
}
@@ -155,38 +154,16 @@
HBox{ //col labels associated with dimension name
layoutInfo:LayoutInfo{hfill:false} //so it doesn't widen this
content: bind for(col in cols){
- Stack{
- content:[
- Rectangle{
- height:200
- width: boxWidth
- fill: Color.rgb(179,159,132)
- stroke: Color.BLACK
- onMouseClicked: tableClicked
- },
- VBox{
- translateX:5
- content: bind for(string in col.sourceNames){
- Text{
- content:string
- wrappingWidth:boxWidth - 30
- }
- }
- }
-
-
-
- ]
- }
+ col.entryColumn
}
}
-
]
}
var unPlacedColNode = VBox{
+ blocksMouse:true
layoutInfo:LayoutInfo{vfill:false} //so it doesn't widen this
- content:[
+ content:bind [
Stack{
content:[
Rectangle{
@@ -197,51 +174,30 @@
},
Text{
x:5
- content:"Unused"
+ content:notPlacedCol.colName
wrappingWidth:boxWidth - 10
onMouseClicked: tableClicked
}
]
},
- Stack{
- content:[
- Rectangle{
- height:200
- width: boxWidth
- fill: Color.rgb(179,159,132)
- stroke: Color.BLACK
- onMouseClicked: tableClicked
- },
- VBox{
- translateX:5
- content: bind for(string in notPlaced){
- Text{
- content:string
- wrappingWidth:boxWidth - 10
- }
- }
- }
- ]
- }
+ notPlacedCol.entryColumn
]
}
+ scrollArea = ifcDialogScrollView{
+ maxHeight: 300;
+ maxWidth: usedBoxesSpaceLeft
+ node:colNodes
+ }
+
children =
VBox{
spacing: 4
content:[
- //Text {content: name},
- //description line?
- //editable column labels, with ability to add new one and a
place for unused
HBox{
- content:[
- ifcDialogScrollView{
-
- maxHeight: 300;
- maxWidth: usedBoxesSpaceLeft
- node:colNodes
- },
+ content: bind[
+ scrollArea,
Rectangle{
onMouseClicked: tableClicked
height:1
@@ -270,16 +226,68 @@
function addColumn(e:MouseEvent):Void{
- insert synchedColumnFX{colName: "Dim {cols.size()}" sourceNames: []}
into cols;
+ insert synchedColumnFX{
+ colName: "Dim {cols.size()}"
+ sourceNames: []
+ boxWidth:bind boxWidth
+ highlightBox: highlightBox
+ moveString: moveString
+ } into cols;
}
- function tableClicked(e:MouseEvent):Void{
- if(dimLabelBeingEdited != -1){
- updateDimText(dimLabelBeingEdited);
- }
-
- }
+ function tableClicked(e:MouseEvent):Void{
+ if(dimLabelBeingEdited != -1){
+ updateDimText(dimLabelBeingEdited);
+ }
+ }
+
+ function highlightBox(sourceCol:synchedColumnFX, e:MouseEvent):Void{
+ for(col in cols){
+ //see if it is over the column
+ if(e != null and sourceCol != col
+ and scrollArea.contains(scrollArea.sceneToLocal(e.sceneX,
e.sceneY))
+ and
col.colRectangle.contains(col.colRectangle.sceneToLocal(e.sceneX,
e.sceneY))){
+ col.colRectangle.fill = Color.LIGHTGRAY
+ }else{
+ col.colRectangle.fill = Color.rgb(179,159,132)
+ }
+ }
+
+ if(e != null and sourceCol != notPlacedCol
+ and
notPlacedCol.colRectangle.contains(notPlacedCol.colRectangle.sceneToLocal(e.sceneX,
e.sceneY))){
+ notPlacedCol.colRectangle.fill = Color.LIGHTGRAY
+ }else{
+ notPlacedCol.colRectangle.fill = Color.rgb(179,159,132)
+ }
+
+
+
+ }
+
+ function moveString(sourceCol:synchedColumnFX, name:String,
e:MouseEvent):Void{
+ var columnIn = -1;
+ if(scrollArea.contains(scrollArea.sceneToLocal(e.sceneX, e.sceneY))){
// if it's in the scroll area
+ for(col in cols){ //check to see if it's over any of the columns
+ if(e != null and sourceCol != col
+ and
col.colRectangle.contains(col.colRectangle.sceneToLocal(e.sceneX,
e.sceneY))){
+ columnIn = indexof col;
+ }
+ }
+ }
+
+ if(columnIn != -1){ //if we need to move it to one of the main columns
+ insert name into cols[columnIn].sourceNames;
+ delete name from sourceCol.sourceNames;
+
+ }else if(e != null and sourceCol != notPlacedCol //if moved to not
placed column
+ and
notPlacedCol.colRectangle.contains(notPlacedCol.colRectangle.sceneToLocal(e.sceneX,
e.sceneY))){
+
+ insert name into notPlacedCol.sourceNames;
+ delete name from sourceCol.sourceNames;
+ }
+ }
+
public function getInput():synchedColumnFX[]{
@@ -288,7 +296,17 @@
}
override function validate():Boolean{
- //check if all files will have all columns
+ //check to make sure each column has at least one thing linked to it
+ var emptyCols:synchedColumnFX[] = [];
+ for(col in cols){
+ if(col.sourceNames.size() == 0){
+ insert col into emptyCols;
+ }
+ }
+ if(emptyCols.size() > 0){
+ Alert.inform("Error: Some Dimensions Empty: {for(col in
emptyCols){"{col.colName},"}}");
+ return false;
+ }
return true;
}
@@ -298,6 +316,9 @@
var newCol = synchedColumnFX{
colName: colName
sourceNames: colName
+ boxWidth: bind boxWidth
+ highlightBox: highlightBox
+ moveString: moveString
};
insert newCol into cols;
}
@@ -327,9 +348,8 @@
}
if(not hasBeenPlaced){
- println("Not placed: {dimName}");
var isInCol:Boolean = false;
- for(name in notPlaced){
+ for(name in notPlacedCol.sourceNames){
if(dimName.equalsIgnoreCase(name)){
hasBeenPlaced = true;
isInCol = true;
@@ -337,22 +357,23 @@
}
}
if(not isInCol){
- if(notPlaced.size() < 1){
- notPlaced = [dimName];
- println("length: {notPlaced.size()} and for fun:
{[dimName].size()}");
+ if(notPlacedCol.sourceNames.size() < 1){
+ notPlacedCol.sourceNames = [dimName];
}else{
- insert dimName into notPlaced;
- }
- println("adding: {dimName}");
+ insert dimName into notPlacedCol.sourceNames;
+ }
}
}
}
-
- println("All unplaced: {for(string in notPlaced){"{string}, "}}");
- println("length: {notPlaced.size()}");
}
+
+ /**
+ * This function checks to see if two dimension names are close enough
for the
+ * program to guess that they are really the same. This is particularly
made
+ * to handle names that come with Flow Cytometry files.
+ */
function areAproxSame(s1:String, s2:String):Boolean{
if(s1.equalsIgnoreCase(s2)){//first, normal equals
return true;
=======================================
--- /src/ifcSoft/view/synchDataSets/synchedColumnFX.fx Mon May 16 15:24:37
2011
+++ /src/ifcSoft/view/synchDataSets/synchedColumnFX.fx Thu Aug 4 18:08:33
2011
@@ -1,15 +1,95 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+/**
+ * Copyright (C) 2011 Kyle Thayer <kyle.thayer AT gmail.com>
+ *
+ * This file is part of the IFCSoft project (http://ifcsoft.com)
+ *
+ * IFCSoft is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ifcSoft.view.synchDataSets;
-/**
- * @author kthayer
- */
+import javafx.scene.shape.Rectangle;
+import javafx.scene.paint.Color;
+import javafx.scene.input.MouseEvent;
+import javafx.scene.layout.Stack;
+import javafx.scene.layout.VBox;
+import javafx.scene.text.Text;
+
public class synchedColumnFX {
public var colName: String;
- public var sourceNames:String[];
-}
+ public var sourceNames:String[] on replace OldVal
+ {entryColumn = makeEntryColumn();}; // this is because
the
+ //auto-binding is sometimes not catching this
change
+ public var boxWidth:Number;
+ public var highlightBox:function(col:synchedColumnFX, e:MouseEvent):Void;
+ public var moveString:function(col:synchedColumnFX, name:String,
e:MouseEvent):Void;
+
+ public var colRectangle:Rectangle;
+
+ public var entryRectangle:Rectangle[] =
+ bind for (name in sourceNames){
+ Rectangle{
+ height: 20
+ width: bind boxWidth - 30
+ fill: Color.LIGHTGRAY
+ opacity: 0
+ onMouseDragged: function(e:MouseEvent):Void{
+ entryRectangle[indexof name].opacity = 1;
+ highlightBox(this, e);
+ }
+ onMouseReleased: function(e:MouseEvent):Void{
+ entryRectangle[indexof name].opacity = 0;
+ highlightBox(this, null);
+ moveString(this, name, e)
+ }
+ }
+ }
+
+
+ public var entryColumn:Stack = makeEntryColumn();
+
+ public function makeEntryColumn():Stack{
+ Stack{
+ content: [
+ colRectangle = Rectangle{
+ height:200
+ width: bind boxWidth
+ fill: Color.rgb(179,159,132)
+ stroke: Color.BLACK
+ },
+ VBox{
+ translateX:5
+ content: bind for(string in sourceNames){
+ Stack{
+ content:[
+ entryRectangle[indexof string],
+ Text{
+ content:string
+ wrappingWidth:boxWidth - 30
+ }
+ ]
+ }
+ }
+ }
+ ]
+ };
+
+ }
+
+
+
+
+
+}
=======================================
--- /src/ifcSoft/view/windrose/MakeWindRoseDialog.fx Fri Feb 11 10:49:36
2011
+++ /src/ifcSoft/view/windrose/MakeWindRoseDialog.fx Thu Aug 4 18:08:33
2011
@@ -59,14 +59,8 @@
}
function windroseOK():Void{
- var datasets = (dataSetSelect.getDataSets());
- if(datasets.size() == 0){
- app.alert("No data set selected");
- app.unblockContent();
- return;
- }
-
- var finaldsp:DataSetProxy =
mainMediator.getDataSet(dataSetSelect.getDataSets());
+
+ var finaldsp:DataSetProxy = dataSetSelect.getDataSet();
if(finaldsp == null){
println("Error in data set combination");
return;
==============================================================================
Revision: f0b292458805
Author: Kyle Thayer@your-0cdc4f5844
Date: Fri Aug 5 11:41:27 2011
Log: In Synchronize Data Set dialog, make highlighting work for
strings that take multiple lines. Also all items in columns are at top, not
spread evenly throughout.
http://code.google.com/p/ifcsoft/source/detail?r=f0b292458805
Modified:
/src/ifcSoft/view/synchDataSets/synchedColumnFX.fx
=======================================
--- /src/ifcSoft/view/synchDataSets/synchedColumnFX.fx Thu Aug 4 18:08:33
2011
+++ /src/ifcSoft/view/synchDataSets/synchedColumnFX.fx Fri Aug 5 11:41:27
2011
@@ -25,6 +25,7 @@
import javafx.scene.layout.Stack;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
+import javafx.geometry.VPos;
public class synchedColumnFX {
@@ -38,10 +39,12 @@
public var colRectangle:Rectangle;
- public var entryRectangle:Rectangle[] =
+ public var entryText:Text[];
+
+ public var entryRectangle:Rectangle[] = //both for detecting mouse
events on entries and highlighting
bind for (name in sourceNames){
Rectangle{
- height: 20
+ height: bind entryText[indexof name].boundsInLocal.height
width: bind boxWidth - 30
fill: Color.LIGHTGRAY
opacity: 0
@@ -61,7 +64,15 @@
public var entryColumn:Stack = makeEntryColumn();
public function makeEntryColumn():Stack{
+ entryText = for(string in sourceNames){
+ Text{
+ content:string
+ wrappingWidth:boxWidth - 30
+ }
+ }
+
Stack{
+ nodeVPos: VPos.TOP
content: [
colRectangle = Rectangle{
height:200
@@ -70,15 +81,15 @@
stroke: Color.BLACK
},
VBox{
+ //prevent the VBox from stretching out to fill the whole
space (keeps items at top)
+ height: bind sumList(for(text in
entryText){text.boundsInLocal.height + 3})
+ spacing: 3
translateX:5
content: bind for(string in sourceNames){
Stack{
content:[
entryRectangle[indexof string],
- Text{
- content:string
- wrappingWidth:boxWidth - 30
- }
+ entryText[indexof string]
]
}
}
@@ -88,7 +99,22 @@
}
-
+ function sumList(list:Number[]){
+ var sum:Number = 0;
+ for(num in list){
+ sum+= num;
+ }
+ return sum;
+ }
+
+
+
+ var testStack:Stack = Stack{};
+ //var test = testStack.managed; //possibly set to false
+ //var test = testStack.
+
+ //var testBox:VBox = VBox{};
+ //var temp = testBox.
==============================================================================
Revision: 9f07e08e095a
Author: Kyle Thayer@your-0cdc4f5844
Date: Tue Aug 9 14:02:03 2011
Log: Histogram, Scatterplot and Wind Rose Plots now handle missing
data.
http://code.google.com/p/ifcsoft/source/detail?r=9f07e08e095a
Modified:
/src/ifcSoft/model/histogram/Histogram.java
/src/ifcSoft/model/scatterplot/ScatterPlot.java
/src/ifcSoft/view/histogram/HistTab.fx
/src/ifcSoft/view/windrose/WindRoseTile.fx
=======================================
--- /src/ifcSoft/model/histogram/Histogram.java Fri Feb 11 10:49:36 2011
+++ /src/ifcSoft/model/histogram/Histogram.java Tue Aug 9 14:02:03 2011
@@ -199,25 +199,27 @@
double min = lowerLimits[0];
double max = lowerLimits[numBars];
for(int i = 0; i < ds.length(); i++){
- int barNum = (int) ((ds.getVals(i)[dimension] - min) / barWidth);
-
- if(barNum >= numBars){ //if it placed it out of our range
- if(ds.getVals(i)[dimension] > max){
- System.out.println("point "+i+" truly too large");
- }
- barNum = numBars - 1;
- }
- if(barNum < 0){
- if(ds.getVals(i)[dimension] < min){
- System.out.println("point "+i+" truly too small");
- }
- barNum = 0;
- }
-
- barTotalSizes[barNum]++;
- String set = ds.getPointSetName(i);
- int setNum = rawSetNames.indexOf(set);
- barSetSizes[setNum][barNum]++;
+ if(!Float.isNaN(ds.getVals(i)[dimension])){
+ int barNum = (int) ((ds.getVals(i)[dimension] - min) / barWidth);
+
+ if(barNum >= numBars){ //if it placed it out of our range
+ if(ds.getVals(i)[dimension] > max){
+ System.out.println("point "+i+" truly too large");
+ }
+ barNum = numBars - 1;
+ }
+ if(barNum < 0){
+ if(ds.getVals(i)[dimension] < min){
+ System.out.println("point "+i+" truly too small");
+ }
+ barNum = 0;
+ }
+
+ barTotalSizes[barNum]++;
+ String set = ds.getPointSetName(i);
+ int setNum = rawSetNames.indexOf(set);
+ barSetSizes[setNum][barNum]++;
+ }
}
}
@@ -225,28 +227,30 @@
double min = lowerLimits[0];
double max = lowerLimits[numBars];
for(int i = 0; i < ds.length(); i++){
- int barNum = (int) (
- Math.log10(
- (ds.getVals(i)[dimension] - min)*9.0 / (max - min) + 1
- )
- / logBarWidth);
- if(barNum >= numBars){ //if it placed it out of our range
- if(ds.getVals(i)[dimension] > max){
- System.out.println("point "+i+" truly too large");
- }
- barNum = numBars - 1;
- }
- if(barNum < 0){
- if(ds.getVals(i)[dimension] < min){
- System.out.println("point "+i+" truly too small");
- }
- barNum = 0;
- }
-
- barTotalSizes[barNum]++;
- String set = ds.getPointSetName(i);
- int setNum = rawSetNames.indexOf(set);
- barSetSizes[setNum][barNum]++;
+ if(!Float.isNaN(ds.getVals(i)[dimension])){
+ int barNum = (int) (
+ Math.log10(
+ (ds.getVals(i)[dimension] - min)*9.0 / (max - min) + 1
+ )
+ / logBarWidth);
+ if(barNum >= numBars){ //if it placed it out of our range
+ if(ds.getVals(i)[dimension] > max){
+ System.out.println("point "+i+" truly too large");
+ }
+ barNum = numBars - 1;
+ }
+ if(barNum < 0){
+ if(ds.getVals(i)[dimension] < min){
+ System.out.println("point "+i+" truly too small");
+ }
+ barNum = 0;
+ }
+
+ barTotalSizes[barNum]++;
+ String set = ds.getPointSetName(i);
+ int setNum = rawSetNames.indexOf(set);
+ barSetSizes[setNum][barNum]++;
+ }
}
}
=======================================
--- /src/ifcSoft/model/scatterplot/ScatterPlot.java Thu Apr 28 09:35:18 2011
+++ /src/ifcSoft/model/scatterplot/ScatterPlot.java Tue Aug 9 14:02:03 2011
@@ -264,39 +264,40 @@
double yWidth = ylowerLimits[1] - ylowerLimits[0];
for(int i = 0; i < ds.length(); i++){
-
- int xNum = (int) ((ds.getVals(i)[xDim] - minX) / xWidth);
- int yNum = (int) ((ds.getVals(i)[yDim] - minY) / yWidth);
-
- if(xNum >= xRes){ //if it placed it out of our range on x
- if(ds.getVals(i)[xDim] > maxX){
- //System.out.println("point "+i+" truly too large");
- }
- xNum = xRes - 1;
- }
- if(xNum < 0){
- if(ds.getVals(i)[xDim] < minX){
- //System.out.println("point "+i+" truly too small");
- }
- xNum = 0;
- }
- if(yNum >= yRes){ //if it placed it out of our range on x
- if(ds.getVals(i)[yDim] > maxY){
- //System.out.println("point "+i+" truly too large");
- }
- yNum = yRes - 1;
- }
- if(yNum < 0){
- if(ds.getVals(i)[yDim] < minY){
- //System.out.println("point "+i+" truly too small");
- }
- yNum = 0;
- }
-
- pntTotalSizes[xNum][yNum]++;
- String set = ds.getPointSetName(i);
- int setNum = rawSetNames.indexOf(set);
- pntSetSizes[setNum][xNum][yNum]++;
+ if(!Float.isNaN(ds.getVals(i)[xDim])|
| !Float.isNaN(ds.getVals(i)[yDim])){
+ int xNum = (int) ((ds.getVals(i)[xDim] - minX) / xWidth);
+ int yNum = (int) ((ds.getVals(i)[yDim] - minY) / yWidth);
+
+ if(xNum >= xRes){ //if it placed it out of our range on x
+ if(ds.getVals(i)[xDim] > maxX){
+ //System.out.println("point "+i+" truly too large");
+ }
+ xNum = xRes - 1;
+ }
+ if(xNum < 0){
+ if(ds.getVals(i)[xDim] < minX){
+ //System.out.println("point "+i+" truly too small");
+ }
+ xNum = 0;
+ }
+ if(yNum >= yRes){ //if it placed it out of our range on x
+ if(ds.getVals(i)[yDim] > maxY){
+ //System.out.println("point "+i+" truly too large");
+ }
+ yNum = yRes - 1;
+ }
+ if(yNum < 0){
+ if(ds.getVals(i)[yDim] < minY){
+ //System.out.println("point "+i+" truly too small");
+ }
+ yNum = 0;
+ }
+
+ pntTotalSizes[xNum][yNum]++;
+ String set = ds.getPointSetName(i);
+ int setNum = rawSetNames.indexOf(set);
+ pntSetSizes[setNum][xNum][yNum]++;
+ }
}
}
=======================================
--- /src/ifcSoft/view/histogram/HistTab.fx Fri Feb 11 10:49:36 2011
+++ /src/ifcSoft/view/histogram/HistTab.fx Tue Aug 9 14:02:03 2011
@@ -90,7 +90,7 @@
}
};
- var numBars = 40; //defualt is 20
+ var numBars = 40; //defualt is 40
/*********** Interactive Selection Elements ***********/
@@ -395,7 +395,7 @@
var axisVals:Node[];
if(scaleType == 0){//linear scale
var min = histogram.getBarLowerLim(0);
- var max = histogram.getBarUpperLim(numBars-1);
+ var max = histogram.getBarUpperLim(histogram.numBars()-1);
var delta = max-min;
var maxGap = delta / 5; // min of 5 labeled points
@@ -425,7 +425,7 @@
}
}else if (scaleType == 1){//log scale
var min = histogram.getBarLowerLim(0);
- var max = histogram.getBarUpperLim(numBars-1);
+ var max = histogram.getBarUpperLim(histogram.numBars()-1);
var delta = max-min;
//var logDelta = Math.log10(delta);
=======================================
--- /src/ifcSoft/view/windrose/WindRoseTile.fx Wed Apr 13 12:29:11 2011
+++ /src/ifcSoft/view/windrose/WindRoseTile.fx Tue Aug 9 14:02:03 2011
@@ -190,12 +190,13 @@
Arc {
centerX: bind unitRadius + explodeAmt * Math.cos(
(dim+.5)*6.28318531/dimensions )
centerY: bind unitRadius - explodeAmt * Math.sin(
(dim+.5)*6.28318531/dimensions )
- radiusX: bind unitRadius*lengths[dim]
- radiusY: bind unitRadius*lengths[dim]
+ radiusX: bind if(not
Float.isNaN(lengths[dim])){unitRadius*lengths[dim]} else{unitRadius*.5}
+ radiusY: bind if(not
Float.isNaN(lengths[dim])){unitRadius*lengths[dim]} else{unitRadius*.5}
startAngle: (dim*1.0)/dimensions * 360.0
length: 360.0 / dimensions
fill: colors[dim]
type: ArcType.ROUND
+ opacity: if(not Float.isNaN(lengths[dim])){1} else{.15}
}
}
]
==============================================================================
Revision: 844c8fd08100
Author: Kyle Thayer@your-0cdc4f5844
Date: Tue Aug 9 14:14:40 2011
Log: Reworded SOM point selection depending on missing data (still too
wordy, but a bit clearer).
http://code.google.com/p/ifcsoft/source/detail?r=844c8fd08100
Modified:
/src/ifcSoft/model/som/SOMSettings.java
/src/ifcSoft/view/som/CalcSOMDialog.fx
=======================================
--- /src/ifcSoft/model/som/SOMSettings.java Fri Jul 22 13:34:04 2011
+++ /src/ifcSoft/model/som/SOMSettings.java Tue Aug 9 14:14:40 2011
@@ -43,9 +43,9 @@
public static final String CLASSICSOM = "Incremental SOM";
public static final String BATCHSOM = "Batch SOM";
- public static final String USEALLPOINTS = "Use All";
- public static final String HALFMISSING = "At least half the used
dimensions present";
- public static final String COMPLETEPOINTS = "Only points with all
dimensions";
+ public static final String USEALLPOINTS = "Use all points regardless.";
+ public static final String HALFMISSING = "Only points with at least half
the used dimensions";
+ public static final String COMPLETEPOINTS = "Only points with all used
dimensions present";
public DataSetProxy datasetproxy;
public DataSetScalar datasetscalar;
=======================================
--- /src/ifcSoft/view/som/CalcSOMDialog.fx Thu Aug 4 18:08:33 2011
+++ /src/ifcSoft/view/som/CalcSOMDialog.fx Tue Aug 9 14:14:40 2011
@@ -371,7 +371,7 @@
};
allowMissingValsInput = ifcDialogChoiceBox{
- name:"Allow points with missing values:"
+ name:"Use points depending on missing dimensions:"
items: missingValOptions
initialSelectedItem: somSettings.allowMissingPointsType
};