Author: scooter
Date: 2011-08-19 17:23:14 -0700 (Fri, 19 Aug 2011)
New Revision: 26611

Modified:
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/attributeClusterers/kmeans/KMeansCluster.java
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/attributeClusterers/kmedoid/KMCluster.java
   
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/attributeClusterers/kmedoid/KMedoidCluster.java
Log:
kmedoid clean-up.  Also force "ignoreMissing" for kmedoid and kmeans.


Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/attributeClusterers/kmeans/KMeansCluster.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/attributeClusterers/kmeans/KMeansCluster.java
 2011-08-19 21:37:01 UTC (rev 26610)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/attributeClusterers/kmeans/KMeansCluster.java
 2011-08-20 00:23:14 UTC (rev 26611)
@@ -145,10 +145,12 @@
                                                  "Cluster attributes as well 
as nodes", 
                                                  Tunable.BOOLEAN, new 
Boolean(false)));
 
+/*
                // For expression data, we might want to exclude missing data
                clusterProperties.add(new Tunable("ignoreMissing",
                                                  "Ignore nodes with no data",
-                                                 Tunable.BOOLEAN, new 
Boolean(false)));
+                                                 Tunable.BOOLEAN, new 
Boolean(true)));
+*/
 
                // Whether or not to create groups
                clusterProperties.add(new Tunable("createGroups",
@@ -187,9 +189,11 @@
                if ((t != null) && (t.valueChanged() || force))
                        selectedOnly = ((Boolean) t.getValue()).booleanValue();
 
+/*
                t = clusterProperties.get("ignoreMissing");
                if ((t != null) && (t.valueChanged() || force))
                        ignoreMissing = ((Boolean) t.getValue()).booleanValue();
+*/
 
                t = clusterProperties.get("createGroups");
                if ((t != null) && (t.valueChanged() || force))
@@ -223,7 +227,7 @@
 
                KCluster algorithm = new KCluster(attributeArray, 
distanceMetric, logger, monitor);
                algorithm.setCreateGroups(createGroups);
-               algorithm.setIgnoreMissing(ignoreMissing);
+               algorithm.setIgnoreMissing(true);
                algorithm.setSelectedOnly(selectedOnly);
                algorithm.setDebug(debug);
 

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/attributeClusterers/kmedoid/KMCluster.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/attributeClusterers/kmedoid/KMCluster.java
    2011-08-19 21:37:01 UTC (rev 26610)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/attributeClusterers/kmedoid/KMCluster.java
    2011-08-20 00:23:14 UTC (rev 26611)
@@ -117,7 +117,7 @@
                // Start by calculating the pairwise distances
                double[][] distances = new 
double[matrix.nRows()][matrix.nRows()];
                for (int i = 0; i < matrix.nRows(); i++) {
-                       for (int j = i; j < matrix.nRows(); j++) {
+                       for (int j = 0; j < matrix.nRows(); j++) {
                                distances[i][j] = metric.getMetric(matrix, 
matrix, matrix.getWeights(), i, j);
                        }
                }
@@ -182,8 +182,10 @@
                for (int row = 0; row < matrix.nRows(); row++) {
                        if (clusterid[row] == cluster) {
                                double distance = metric.getMetric(matrix, 
cdata, matrix.getWeights(), row, cluster);
-                               if (distance < minDistance)
+                               if (distance < minDistance) {
                                        medoid = row;
+                                       minDistance = distance;
+                               }
                        }
                }
                return medoid;

Modified: 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/attributeClusterers/kmedoid/KMedoidCluster.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/attributeClusterers/kmedoid/KMedoidCluster.java
       2011-08-19 21:37:01 UTC (rev 26610)
+++ 
csplugins/trunk/ucsf/scooter/clusterMaker/src/clusterMaker/algorithms/attributeClusterers/kmedoid/KMedoidCluster.java
       2011-08-20 00:23:14 UTC (rev 26611)
@@ -146,10 +146,12 @@
                                                  "Cluster attributes as well 
as nodes", 
                                                  Tunable.BOOLEAN, new 
Boolean(false)));
 
+/*
                // For expression data, we might want to exclude missing data
                clusterProperties.add(new Tunable("ignoreMissing",
                                                  "Ignore nodes with no data",
                                                  Tunable.BOOLEAN, new 
Boolean(false)));
+*/
 
                // Whether or not to create groups
                clusterProperties.add(new Tunable("createGroups",
@@ -188,9 +190,11 @@
                if ((t != null) && (t.valueChanged() || force))
                        selectedOnly = ((Boolean) t.getValue()).booleanValue();
 
+/*
                t = clusterProperties.get("ignoreMissing");
                if ((t != null) && (t.valueChanged() || force))
                        ignoreMissing = ((Boolean) t.getValue()).booleanValue();
+*/
 
                t = clusterProperties.get("createGroups");
                if ((t != null) && (t.valueChanged() || force))
@@ -224,7 +228,7 @@
 
                KMCluster algorithm = new KMCluster(attributeArray, 
distanceMetric, logger, monitor);
                algorithm.setCreateGroups(createGroups);
-               algorithm.setIgnoreMissing(ignoreMissing);
+               algorithm.setIgnoreMissing(true);       // KMedoid doesn't 
handle missing data well
                algorithm.setSelectedOnly(selectedOnly);
                algorithm.setDebug(debug);
 

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to