Commit 1997372b authored by lafabregue's avatar lafabregue

tmp commit

parent c73b71a5
......@@ -8,7 +8,7 @@ import java.util.Arrays;
import java.util.Observable;
import java.util.Vector;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import jcl.clustering.Cluster;
import jcl.clustering.ClusteringResult;
......@@ -49,7 +49,7 @@ public abstract class Classification extends Observable implements
public SSHParameters sshParameters = null;
/** panel ou il faut afficher la non disponibiliter du server rmi */
transient public JInternalFrame container_;
transient public JPanel container_;
/** titre de la classid pour le tabedpane en hybridclassification */
public String title;
......
......@@ -193,7 +193,7 @@ public class SimpleClusteringResult extends ClusteringResult {
}
this.weights = (ClassificationWeights) weights.clone();
ClustersColorizer.colorize(this);
ClustersColorizer.colorizeRandom(this);
}
/**
......
......@@ -677,7 +677,7 @@ public class AttributeMultiDimSequence extends Attribute {
final AttributeMultiDimSequence tmp = (AttributeMultiDimSequence) res.clone();
AttributeMultiDimSequence best;
System.out.println("Debut reduction centre");
// System.out.println("Debut reduction centre");
do {
best = (AttributeMultiDimSequence) tmp.clone();
distance = distanceTmp;
......
......@@ -5,7 +5,7 @@ import java.io.IOException;
import java.io.Serializable;
import java.util.Vector;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import jcl.clustering.ClusteringResult;
import jcl.data.Data;
......@@ -60,7 +60,7 @@ public abstract class LearningMethod implements Progressable, Cloneable,
public Vector<Viewer> viewers = null;
/** panel ou il faut afficher la non disponibiliter du server rmi */
transient public JInternalFrame container_ = null;
transient public JPanel container_ = null;
/** paramtre de la connection ssh si besoin */
public SSHParameters sshparameters = null;
......
......@@ -299,7 +299,7 @@ public class ClassifierKmeans extends LearningMethod {
// System.out.println("distance globale initiale = " + distanceGlobale);
this.display();
//boolean log = (!(data.getOneDataObject().getAttribute(0) instanceof AttributeNumerical));
boolean log = true;
boolean log = false;
if (log) System.out.println("Initial: distance globale = " + distanceGlobale);
for (int i = 0; i < this.getNbIters(); i++) {
......@@ -363,7 +363,7 @@ public class ClassifierKmeans extends LearningMethod {
@Override
public ClusteringResult merge(LearningResult learningResult, ClusteringResult _result, Data data, Vector cr) {
if ((LearningResultKmeans) learningResult != null) {
((LearningResultKmeans) learningResult).mergeSeeds(cr);
((LearningResultKmeans) learningResult).mergeSeeds(cr, _result.getClusterMap());
return ((LearningResultKmeans) learningResult).classify(data, false);
}
return null;
......
......@@ -126,6 +126,11 @@ public class LearningResultKmeans extends LearningResult {
@Override
public ClusteringResult classify(Data data, boolean fromSample) {
for (int i = 0 ; i < this.seeds.size() ; i++) {
if (this.seeds.get(i) instanceof LightHardSeed) {
((LightHardSeed) this.seeds.get(i)).setId(i);
}
}
// long startT = System.nanoTime();
// System.out.println("start at "+startT);
int clusterMap[] = this.clusterAffectation(data,fromSample);
......@@ -533,11 +538,11 @@ public class LearningResultKmeans extends LearningResult {
*
* @param cr les noyaux a fusionner
*/
public void mergeSeeds(Vector cr) {
public void mergeSeeds(Vector cr, int[] clustermap) {
// int [] newClusterMap = ((LightHardSeed) this.seeds.get(0)).getClusterMap();
LightHardSeed newSeed = new LightHardSeed((LightHardSeed) this.seeds.get(0));
int[] idsToMerge = new int[cr.size()];
int card = newSeed.getClusterMap().length;
int card = clustermap.length;
Vector<KmeansSeed> seedsToMerge = new Vector<KmeansSeed>();
newSeed.initialize();
newSeed.setId(this.seeds.size());
......@@ -560,8 +565,7 @@ public class LearningResultKmeans extends LearningResult {
// }
Mask mask;
if (this.seeds.size() > 0) {
mask = new MultiIDIntArrayMask(((LightHardSeed) this.seeds.get(0)).getClusterMap()
,idsToMerge, false);
mask = new MultiIDIntArrayMask(clustermap, idsToMerge, false);
} else {
mask = new DummyMask(card);
}
......
......@@ -196,7 +196,7 @@ public class ClassifierKmeansGenetic extends LearningMethod {
public ClusteringResult merge(final LearningResult learningResult,
final ClusteringResult _result, final Data data, final Vector cr) {
if ((LearningResultKmeans) learningResult != null) {
((LearningResultKmeans) learningResult).mergeSeeds(cr);
((LearningResultKmeans) learningResult).mergeSeeds(cr, _result.getClusterMap());
return ((LearningResultKmeans) learningResult).classify(data, true);
}
return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment