Commit b8f42088 authored by lafabregue's avatar lafabregue

Add agent constrained samarah

parent f960b309
No preview for this file type
...@@ -6,6 +6,7 @@ import java.io.Serializable; ...@@ -6,6 +6,7 @@ import java.io.Serializable;
import jcl.data.Data; import jcl.data.Data;
import jcl.data.DataObject; import jcl.data.DataObject;
import jcl.weights.Weights; import jcl.weights.Weights;
import multiCube.tools.util.exceptions.MethodNotImplementedException;
/** /**
* <p> * <p>
...@@ -28,7 +29,7 @@ abstract public class Cluster implements Serializable { ...@@ -28,7 +29,7 @@ abstract public class Cluster implements Serializable {
protected Color color = new Color(0); protected Color color = new Color(0);
/** The cluster's father node color*/ /** The cluster's father node color*/
protected Color couleur_pere = new Color(0); protected Color couleur_pere = null;
/** L'index qui correspond a la place du cluster dans result */ /** L'index qui correspond a la place du cluster dans result */
protected int id = -1; protected int id = -1;
...@@ -204,17 +205,21 @@ abstract public class Cluster implements Serializable { ...@@ -204,17 +205,21 @@ abstract public class Cluster implements Serializable {
* *
* @param o * @param o
* l'index de l'objet * l'index de l'objet
* @return le degre d'appartenance du o-ieme objet e la classe * @return le degre d'appartenance du o-ieme objet e la classe *
* @throws MethodNotImplementedException
* si la methode n'implante pas cet operateur
*/ */
abstract public double getMembership(final int o); abstract public double getMembership(final int o) throws MethodNotImplementedException;
/** /**
* <p> * <p>
* Probabilite de la classe. * Probabilite de la classe.
* </p> * </p>
* *
* @return la probabilite de la classe * @return la probabilite de la classe *
* @throws MethodNotImplementedException
* si la methode n'implante pas cet operateur
*/ */
abstract public double getMembershipProbabilityEM(); abstract public double getMembershipProbabilityEM() throws MethodNotImplementedException;
/** /**
* <p> * <p>
......
...@@ -7,6 +7,7 @@ import jcl.data.mask.IntArrayMask.IntMaskIterator; ...@@ -7,6 +7,7 @@ import jcl.data.mask.IntArrayMask.IntMaskIterator;
import jcl.data.mask.Mask; import jcl.data.mask.Mask;
import jcl.weights.Weights; import jcl.weights.Weights;
import jj2000.j2k.NotImplementedError; import jj2000.j2k.NotImplementedError;
import multiCube.tools.util.exceptions.MethodNotImplementedException;
public class LightCluster extends Cluster { public class LightCluster extends Cluster {
...@@ -147,13 +148,13 @@ public class LightCluster extends Cluster { ...@@ -147,13 +148,13 @@ public class LightCluster extends Cluster {
@Override @Override
public double getMembership(int o) { public double getMembership(int o) throws MethodNotImplementedException{
throw new NotImplementedError("method not Implemented for LighCluster class"); throw new MethodNotImplementedException("method not Implemented for LighCluster class");
} }
@Override @Override
public double getMembershipProbabilityEM() { public double getMembershipProbabilityEM() throws MethodNotImplementedException{
throw new NotImplementedError("method not Implemented for LighCluster class"); throw new MethodNotImplementedException("method not Implemented for LighCluster class");
} }
@Override @Override
......
...@@ -6,6 +6,7 @@ import jcl.data.Data; ...@@ -6,6 +6,7 @@ import jcl.data.Data;
import jcl.data.DataObject; import jcl.data.DataObject;
import jcl.data.SimpleData; import jcl.data.SimpleData;
import jcl.weights.Weights; import jcl.weights.Weights;
import multiCube.tools.util.exceptions.MethodNotImplementedException;
/** /**
* <p> * <p>
...@@ -44,7 +45,11 @@ public class SimpleCluster extends Cluster { ...@@ -44,7 +45,11 @@ public class SimpleCluster extends Cluster {
} }
this.membershipDegree = new double[cluster.membershipDegree.length]; this.membershipDegree = new double[cluster.membershipDegree.length];
for (int i = 0; i < this.membershipDegree.length; i++) { for (int i = 0; i < this.membershipDegree.length; i++) {
this.membershipDegree[i] = cluster.getMembership(i); try {
this.membershipDegree[i] = cluster.getMembership(i);
} catch (MethodNotImplementedException e) {
e.printStackTrace();
}
} }
this.membershipProbabilityEM = cluster.membershipProbabilityEM; this.membershipProbabilityEM = cluster.membershipProbabilityEM;
} }
...@@ -230,18 +235,22 @@ public class SimpleCluster extends Cluster { ...@@ -230,18 +235,22 @@ public class SimpleCluster extends Cluster {
this.data = (Data) cluster.getData(fromSample).clone(); this.data = (Data) cluster.getData(fromSample).clone();
} }
if(cluster instanceof SimpleCluster) { try {
this.membershipDegree = new double[((SimpleCluster)cluster).membershipDegree.length]; if(cluster instanceof SimpleCluster) {
for (int i = 0; i < this.membershipDegree.length; i++) { this.membershipDegree = new double[((SimpleCluster)cluster).membershipDegree.length];
this.membershipDegree[i] = cluster.getMembership(i); for (int i = 0; i < this.membershipDegree.length; i++) {
} this.membershipDegree[i] = cluster.getMembership(i);
this.membershipProbabilityEM = ((SimpleCluster)cluster).membershipProbabilityEM; }
this.membershipProbabilityEM = ((SimpleCluster)cluster).membershipProbabilityEM;
} else {
this.membershipDegree = new double[cluster.getCard()]; } else {
for (int i = 0; i < this.membershipDegree.length; i++) { this.membershipDegree = new double[cluster.getCard()];
this.membershipDegree[i] = cluster.getMembership(i); for (int i = 0; i < this.membershipDegree.length; i++) {
this.membershipDegree[i] = cluster.getMembership(i);
}
} }
} catch (MethodNotImplementedException e) {
e.printStackTrace();
} }
if (this.clusterCenter == null) if (this.clusterCenter == null)
...@@ -322,7 +331,7 @@ public class SimpleCluster extends Cluster { ...@@ -322,7 +331,7 @@ public class SimpleCluster extends Cluster {
* l'index de l'objet * l'index de l'objet
* @return le degre d'appartenance du o-ieme objet e la classe * @return le degre d'appartenance du o-ieme objet e la classe
*/ */
public double getMembership(final int o) { public double getMembership(final int o) throws MethodNotImplementedException {
double degree = 0; double degree = 0;
if ((o >= 0) && (o < this.membershipDegree.length)) { if ((o >= 0) && (o < this.membershipDegree.length)) {
degree = this.membershipDegree[o]; degree = this.membershipDegree[o];
...@@ -337,7 +346,7 @@ public class SimpleCluster extends Cluster { ...@@ -337,7 +346,7 @@ public class SimpleCluster extends Cluster {
* *
* @return la probabilite de la classe * @return la probabilite de la classe
*/ */
public double getMembershipProbabilityEM() { public double getMembershipProbabilityEM() throws MethodNotImplementedException {
return this.membershipProbabilityEM; return this.membershipProbabilityEM;
} }
......
...@@ -853,7 +853,7 @@ public class AttributeMultiDimSequence extends Attribute { ...@@ -853,7 +853,7 @@ public class AttributeMultiDimSequence extends Attribute {
} }
public static int ArgMin3(final double a, final double b, final double c) { public static int ArgMin3(final double a, final double b, final double c) {
return (a < b) ? ((a < c) ? 0 : 2) : (b < c) ? 1 : 2; return (a <= b) ? ((a <= c) ? 0 : 2) : (b <= c) ? 1 : 2;
} }
public static int getMode() { public static int getMode() {
...@@ -3351,8 +3351,11 @@ public class AttributeMultiDimSequence extends Attribute { ...@@ -3351,8 +3351,11 @@ public class AttributeMultiDimSequence extends Attribute {
// AttributeMultiDimSequence seq1 = new AttributeMultiDimSequence(new double[][] { { 1.0 }, { 10.0 }, { 10.0 }, { 10.0 }, { 1.0 }, { 1.0 }, { // AttributeMultiDimSequence seq1 = new AttributeMultiDimSequence(new double[][] { { 1.0 }, { 10.0 }, { 10.0 }, { 10.0 }, { 1.0 }, { 1.0 }, {
// 1.0 } }); // 1.0 } });
// AttributeMultiDimSequence seq2 = new AttributeMultiDimSequence(new double[][] { { 1.0 }, { 1.0 }, { 1.0 }, { 10.0 }, { 1.0 } }); // AttributeMultiDimSequence seq2 = new AttributeMultiDimSequence(new double[][] { { 1.0 }, { 1.0 }, { 1.0 }, { 10.0 }, { 1.0 } });
AttributeMultiDimSequence seq1 = new AttributeMultiDimSequence(new double[][] { { 0.0 }, { 1.0 }, { 1.0 }, { 0.0 } }); AttributeMultiDimSequence seq1 = new AttributeMultiDimSequence(new double[][] { { 0.0 }, { 0.0 }, { 0.0 }, { 3.0 }, { 1.0 } });
AttributeMultiDimSequence seq2 = new AttributeMultiDimSequence(new double[][] { { 0.0 }, { 0.0 }, { 1.0 }, { 0.0 }, { 0.0 } }); AttributeMultiDimSequence seq2 = new AttributeMultiDimSequence(new double[][] { { 0.0 }, { 0.0 }, { 3.0 }, { 1.0 }, { 0.0 } });
AttributeMultiDimSequence seq3 = new AttributeMultiDimSequence(new double[][] { { 0.0 }, { 0.0 }, { 3.0 }, { 3.0 }, { 1.0 } });
AttributeMultiDimSequence seq4 = new AttributeMultiDimSequence(new double[][] { { 0.0 }, { 1.0 }, { 1.0 }, { 1.0 }, { 0.0 } });
AttributeMultiDimSequence seq5 = new AttributeMultiDimSequence(new double[][] { { 0.0 }, { 0.0 }, { 0.0 }, { 3.0 }, { 0.0 } });
// System.out.println(DTWPageRank(seq1, seq2)); // System.out.println(DTWPageRank(seq1, seq2));
// System.out.println(DTWDistanceToDiagonal(seq1, seq2)); // System.out.println(DTWDistanceToDiagonal(seq1, seq2));
// System.out.println(DTWDistanceToDiagonal(seq2, seq1)); // System.out.println(DTWDistanceToDiagonal(seq2, seq1));
...@@ -3365,7 +3368,12 @@ public class AttributeMultiDimSequence extends Attribute { ...@@ -3365,7 +3368,12 @@ public class AttributeMultiDimSequence extends Attribute {
// System.out.println(DTWDatedTimeToGo(seq1, new short[] { 0, 2, 3, 4 }, seq2, new short[] { 0, 1, 2, 3, 4 })); // System.out.println(DTWDatedTimeToGo(seq1, new short[] { 0, 2, 3, 4 }, seq2, new short[] { 0, 1, 2, 3, 4 }));
// System.out.println(DTWDatedMeanSpeed(seq1, new short[] { 0, 2, 3, 4 }, seq2, new short[] { 0, 1, 2, 3, 4 })); // System.out.println(DTWDatedMeanSpeed(seq1, new short[] { 0, 2, 3, 4 }, seq2, new short[] { 0, 1, 2, 3, 4 }));
AttributeMultiDimSequence.setMode(DTW_BARYCENTRE); AttributeMultiDimSequence.setMode(DTW_BARYCENTRE);
System.out.println(seq1.distance(seq2)); // System.out.println(seq1.distance(seq2));
AttributeMultiDimSequence[] tabSequence = { seq1, seq2, seq3, seq4, seq5 };
AttributeMultiDimSequence avg = DBAMean(seq2, tabSequence);
System.out.println("DBA mean : " +avg);
} }
......
...@@ -13,6 +13,7 @@ import jcl.data.DataObject; ...@@ -13,6 +13,7 @@ import jcl.data.DataObject;
import jcl.evaluation.QualityIndex; import jcl.evaluation.QualityIndex;
import jcl.utils.MathTools; import jcl.utils.MathTools;
import jcl.weights.Weights; import jcl.weights.Weights;
import multiCube.tools.util.exceptions.MethodNotImplementedException;
/** /**
* @author Alexandre BLANSCHE * @author Alexandre BLANSCHE
...@@ -544,7 +545,11 @@ public class ClusteringEvaluation { ...@@ -544,7 +545,11 @@ public class ClusteringEvaluation {
int i = 0; int i = 0;
while(iter.hasNext()) { while(iter.hasNext()) {
final double distance = cluster.distance(iter.next()); final double distance = cluster.distance(iter.next());
sum += distance * distance * cluster.getMembership(i); try {
sum += distance * distance * cluster.getMembership(i);
} catch (MethodNotImplementedException e) {
e.printStackTrace();
}
i++; i++;
} }
...@@ -608,9 +613,13 @@ public class ClusteringEvaluation { ...@@ -608,9 +613,13 @@ public class ClusteringEvaluation {
for (int i = 0; i < clusteringResult.getNbObjects(); i++) { for (int i = 0; i < clusteringResult.getNbObjects(); i++) {
double proba = 0; double proba = 0;
for (int k = 0; k < clusteringResult.getNbClusters(); k++) { for (int k = 0; k < clusteringResult.getNbClusters(); k++) {
proba += clusteringResult.getCluster(k) try {
.getMembershipProbabilityEM() proba += clusteringResult.getCluster(k)
* clusteringResult.getCluster(k).getMembership(i); .getMembershipProbabilityEM()
* clusteringResult.getCluster(k).getMembership(i);
} catch (MethodNotImplementedException e) {
e.printStackTrace();
}
} }
sum += Math.log(proba); sum += Math.log(proba);
} }
...@@ -757,7 +766,11 @@ public class ClusteringEvaluation { ...@@ -757,7 +766,11 @@ public class ClusteringEvaluation {
for (int i = 0; i < clusteringResult.getNbObjects(); i++) { for (int i = 0; i < clusteringResult.getNbObjects(); i++) {
double sum = 0; double sum = 0;
for (int k = 0; k < membership.length; k++) { for (int k = 0; k < membership.length; k++) {
membership[k] = clusteringResult.getCluster(k).getMembership(i); try {
membership[k] = clusteringResult.getCluster(k).getMembership(i);
} catch (MethodNotImplementedException e) {
e.printStackTrace();
}
sum += membership[k]; sum += membership[k];
} }
for (int k = 0; k < membership.length; k++) { for (int k = 0; k < membership.length; k++) {
...@@ -1016,7 +1029,11 @@ public class ClusteringEvaluation { ...@@ -1016,7 +1029,11 @@ public class ClusteringEvaluation {
for (int i = 0; i < clusteringResult.getNbObjects(); i++) { for (int i = 0; i < clusteringResult.getNbObjects(); i++) {
double sum = 0; double sum = 0;
for (int k = 0; k < membership.length; k++) { for (int k = 0; k < membership.length; k++) {
membership[k] = clusteringResult.getCluster(k).getMembership(i); try {
membership[k] = clusteringResult.getCluster(k).getMembership(i);
} catch (MethodNotImplementedException e) {
e.printStackTrace();
}
sum += membership[k]; sum += membership[k];
} }
for (int k = 0; k < membership.length; k++) { for (int k = 0; k < membership.length; k++) {
......
...@@ -52,36 +52,35 @@ public class Kmeans { ...@@ -52,36 +52,35 @@ public class Kmeans {
Random randGenerator = new Random(); Random randGenerator = new Random();
for (int i = 0; i < NB_OBJECTS; i++) { //~ Initialization of objects (random) for (int i = 0; i < NB_OBJECTS; i++) { //~ Initialization of objects (random)
Attribute[] attributes = new Attribute[2]; Attribute[] attributes = new Attribute[1];
if (randGenerator.nextDouble() < 0.5) { // first cluster if (randGenerator.nextDouble() < 0.5) { // first cluster
attributes[0] = new AttributeNumerical(randGenerator.nextGaussian() + .5); // attributes[0] = new AttributeNumerical(randGenerator.nextGaussian() + .5);
double[] sequence = new double[SEQUENCE_LENGTH]; double[] sequence = new double[SEQUENCE_LENGTH];
for (int l = 0; l < sequence.length; l++) { for (int l = 0; l < sequence.length; l++) {
double p = l + randGenerator.nextGaussian(); double p = l + randGenerator.nextGaussian();
sequence[l] = cos(p / SEQUENCE_LENGTH * 2 * PI); sequence[l] = cos(p / SEQUENCE_LENGTH * 2 * PI);
} }
attributes[1] = new AttributeSequence(sequence); attributes[0] = new AttributeSequence(sequence);
} else { } else {
attributes[0] = new AttributeNumerical(randGenerator.nextGaussian() - .5); // attributes[0] = new AttributeNumerical(randGenerator.nextGaussian() - .5);
double[] sequence = new double[SEQUENCE_LENGTH]; double[] sequence = new double[SEQUENCE_LENGTH];
for (int l = 0; l < sequence.length; l++) { for (int l = 0; l < sequence.length; l++) {
double p = l + randGenerator.nextGaussian(); double p = l + randGenerator.nextGaussian();
sequence[l] = sin(p / SEQUENCE_LENGTH * 2 * PI); sequence[l] = sin(p / SEQUENCE_LENGTH * 2 * PI);
} }
attributes[1] = new AttributeSequence(sequence); attributes[0] = new AttributeSequence(sequence);
} }
objects.add(new DataObject(attributes)); objects.add(new DataObject(attributes));
} }
//~ In order to create a dataset, a model of comparison has to be set //~ In order to create a dataset, a model of comparison has to be set
Distance[] distances = new Distance[2]; // a distance is set for every attribute Distance[] distances = new Distance[1]; // a distance is set for every attribute
distances[0] = NumericalEuclideanDistance.getInstance(); // first attribute compared with an euclidean distance between numericals // distances[0] = NumericalEuclideanDistance.getInstance(); // first attribute compared with an euclidean distance between numericals
distances[1] = jcl.data.distance.sequential.DistanceDTW.getInstance(); // second attribute (sequential) compared with the DTW distance distances[0] = jcl.data.distance.sequential.DistanceDTW.getInstance(); // second attribute (sequential) compared with the DTW distance
MetaDistance metaDistance = MetaDistanceEuclidean.getInstance(); // defines the way the two scores are combined (possibility to weight) MetaDistance metaDistance = MetaDistanceEuclidean.getInstance(); // defines the way the two scores are combined (possibility to weight)
Model model = new Model(distances, metaDistance); Model model = new Model(distances, metaDistance);
...@@ -94,8 +93,8 @@ public class Kmeans { ...@@ -94,8 +93,8 @@ public class Kmeans {
DistanceParameter[][] distanceParameters = new DistanceParameter[NB_THREADS][2]; DistanceParameter[][] distanceParameters = new DistanceParameter[NB_THREADS][2];
for (int th = 0; th < NB_THREADS; th++) { for (int th = 0; th < NB_THREADS; th++) {
distanceParameters[th][0] = EmptyDistanceParameter.getInstance(); //no parameter for a numerical euclidean distance // distanceParameters[th][0] = EmptyDistanceParameter.getInstance(); //no parameter for a numerical euclidean distance
distanceParameters[th][1] = new ParameterDTW(new double[SEQUENCE_LENGTH][SEQUENCE_LENGTH]); //but yes for DTW (requires a matrix to work in) distanceParameters[th][0] = new ParameterDTW(new double[SEQUENCE_LENGTH][SEQUENCE_LENGTH]); //but yes for DTW (requires a matrix to work in)
} }
param = new ParametersKmeans(NB_CLUSTERS, NB_TURNS, NB_THREADS, new GlobalWeights(dataset), distanceParameters); param = new ParametersKmeans(NB_CLUSTERS, NB_TURNS, NB_THREADS, new GlobalWeights(dataset), distanceParameters);
......
...@@ -8,6 +8,7 @@ import java.util.Vector; ...@@ -8,6 +8,7 @@ import java.util.Vector;
import javax.swing.JPanel; import javax.swing.JPanel;
import jcl.clustering.ClusteringResult; import jcl.clustering.ClusteringResult;
import jcl.clustering.constraints.Constraint;
import jcl.data.Data; import jcl.data.Data;
import jcl.jcld.RmiServer; import jcl.jcld.RmiServer;
import jcl.jcld.database.SSHParameters; import jcl.jcld.database.SSHParameters;
...@@ -277,60 +278,103 @@ public abstract class LearningMethod implements Progressable, Cloneable, ...@@ -277,60 +278,103 @@ public abstract class LearningMethod implements Progressable, Cloneable,
/** /**
* <p> * <p>
* Methode de fusion d'un ensemble de classes. * Method to merge a set of clusters
* </p> * </p>
* *
* @param learningResult * @param learningResult
* resultat d'apprentissage * the learned model
*
* @param result * @param result
* le resultat e modifier * the result to modify
* @param data * @param data
* les donnees d'apprentrissage * the data to train the model on
* @param cr * @param cr
* l'ensemble des classes representatives e fusionner * the set of clusters to merge
* @return le resultat modifie * @return the modified result
* @throws MethodNotImplementedException * @throws MethodNotImplementedException
* si la methode n'implante pas cet operateur * if the LearningMethod does not implement this method
*/ */
public abstract ClusteringResult merge(LearningResult learningResult, public abstract ClusteringResult merge(LearningResult learningResult,
ClusteringResult result, Data data, Vector cr) ClusteringResult result, Data data, Vector cr)
throws MethodNotImplementedException; throws MethodNotImplementedException;
/** /**
* affichage dans la console, deux cas possible: execution local, algorithme * <p>
* effetue par le client, affichage direct. execution deporte, renvoie du * Method to split a cluster
* resultat par RMI * </p>
* *
* @param s * @param learningResult
* the learned model
* @param result
* the result to modify
* @param data
* the data to train the model on
* @param c
* the cluster to remove id
* @param n
* the number of cluster to split the cluster into
* @return the modified result
* @throws MethodNotImplementedException
* if the LearningMethod does not implement this method
*/ */
public void print(final String s) { public abstract ClusteringResult split(LearningResult learningResult,
for (int i = 0; i < this.viewers.size(); i++) { ClusteringResult result, Data data, int c, int n)
this.viewers.get(i).print(s); throws MethodNotImplementedException;
}
}
/** /**
* <p> * <p>
* Methode de suppresion d'une classe. * Method to remove a cluster a classify its element
* in the other ones
* </p> * </p>
* *
* @param learningResult * @param learningResult
* resultat d'apprentissage * the learned model
*
* @param result * @param result
* le resultat a modifier * the result to modify
* @param data * @param data
* les donnees d'apprentrissage * the data to train the model on
* @param c * @param c
* le numero de la classe a supprimer * the cluster to remove id
* @return le resultat modifie * @return the modified result
* @throws MethodNotImplementedException * @throws MethodNotImplementedException
* si la methode d'apprentissage n'implante pas cet operateur * if the LearningMethod does not implement this method
*/ */
public abstract ClusteringResult reclass(LearningResult learningResult, public abstract ClusteringResult reclass(LearningResult learningResult,
ClusteringResult result, Data data, int c) ClusteringResult result, Data data, int c)
throws MethodNotImplementedException; throws MethodNotImplementedException;
/**
* <p>
* Method to compute a new clustering from the existing one that respect the constraints
* </p>
*
* @param learningResult
* the learned model
* @param result
* the result to modify
* @param data
* the data to train the model on
* @param constraints
* the set of Constraints to use
* @return the modified result
* @throws MethodNotImplementedException
* if the LearningMethod does not implement this method
*/
public abstract ClusteringResult injectConstraints(LearningResult learningResult,
ClusteringResult result, Data data, Vector<Constraint> constraints)
throws MethodNotImplementedException;
/**
* affichage dans la console, deux cas possible: execution local, algorithme
* effetue par le client, affichage direct. execution deporte, renvoie du
* resultat par RMI
*
* @param s
*/
public void print(final String s) {
for (int i = 0; i < this.viewers.size(); i++) {
this.viewers.get(i).print(s);
}
}
/** /**
* <p> * <p>
...@@ -381,30 +425,6 @@ public abstract class LearningMethod implements Progressable, Cloneable, ...@@ -381,30 +425,6 @@ public abstract class LearningMethod implements Progressable, Cloneable,
return statusName; return statusName;
} }
/**
* <p>
* Methode de decoupage d'une classe en sous-classes.
* </p>
*
* @param learningResult
* le resultat d'apprentissage
* @param result
* le resultat a modifier
* @param data
* les donnees d'apprentissage
* @param c
* le numero de la classe a scinder
* @param n
* le nombre de sous-classes desire
* @return le resultat modifie
* @throws MethodNotImplementedException
* si la methode d'apprentissage n'implante pas cet operateur
*/
public abstract ClusteringResult split(LearningResult learningResult,
ClusteringResult result, Data data, int c, int n)
throws MethodNotImplementedException;
@Override @Override
public String toString() { public String toString() {
return this.getStringParams(); return this.getStringParams();
......
...@@ -3,10 +3,12 @@ package jcl.learning.methods; ...@@ -3,10 +3,12 @@ package jcl.learning.methods;
import java.util.Vector; import java.util.Vector;
import jcl.clustering.ClusteringResult; import jcl.clustering.ClusteringResult;
import jcl.clustering.constraints.Constraint;
import jcl.data.Data; import jcl.data.Data;
import jcl.learning.LearningMethod; import jcl.learning.LearningMethod;
import jcl.learning.LearningParameters; import jcl.learning.LearningParameters;
import jcl.learning.LearningResult; import jcl.learning.LearningResult;
import multiCube.tools.util.exceptions.MethodNotImplementedException;
/** /**
* <p> * <p>
...@@ -165,4 +167,10 @@ public class ClassifierUnified extends LearningMethod implements Cloneable { ...@@ -165,4 +167,10 @@ public class ClassifierUnified extends LearningMethod implements Cloneable {
"Method split() not yet implemented."); "Method split() not yet implemented.");
} }
@Override
public ClusteringResult injectConstraints(LearningResult learningResult, ClusteringResult result, Data data,
Vector<Constraint> constraints) throws MethodNotImplementedException {
throw new MethodNotImplementedException();
}
} }
...@@ -87,6 +87,11 @@ public class ClassifierUtils { ...@@ -87,6 +87,11 @@ public class ClassifierUtils {
*/ */
public final static int SAMARAHV4 = 121; public final static int SAMARAHV4 = 121;
/**
* Identification of the SMARAH algorithm where constraints are handled at agent level
*/
public final static int SAMARAH_CONSTRAINED = 122;
public final static int MACLAW = 125; public final static int MACLAW = 125;
/** /**
* Constante representant un classifieur SAMARAH : Ne pas modifier car correspond à l'indice de * Constante representant un classifieur SAMARAH : Ne pas modifier car correspond à l'indice de
......
...@@ -7,7 +7,6 @@ import java.io.IOException; ...@@ -7,7 +7,6 @@ import java.io.IOException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.Vector; import java.util.Vector;
import javax.naming.Context; import javax.naming.Context;
...@@ -17,6 +16,7 @@ import javax.swing.JOptionPane; ...@@ -17,6 +16,7 @@ import javax.swing.JOptionPane;
import jcl.Classification; import jcl.Classification;
import jcl.clustering.Cluster; import jcl.clustering.Cluster;
import jcl.clustering.ClusteringResult; import jcl.clustering.ClusteringResult;
import jcl.clustering.constraints.Constraint;
import jcl.data.Data; import jcl.data.Data;
import jcl.data.SimpleData; import jcl.data.SimpleData;
import jcl.jcld.interJcld; import jcl.jcld.interJcld;
...@@ -27,7 +27,6 @@ import jcl.learning.methods.ClassifierUtils; ...@@ -27,7 +27,6 @@ import jcl.learning.methods.ClassifierUtils;
import jcl.learning.methods.monostrategy.ahc.LearningResultAHC; import jcl.learning.methods.monostrategy.ahc.LearningResultAHC;
import jcl.learning.methods.monostrategy.ahc.ParametersAHC; import jcl.learning.methods.monostrategy.ahc.ParametersAHC;
import jcl.learning.methods.monostrategy.kmeans.LearningResultKmeans; import jcl.learning.methods.monostrategy.kmeans.LearningResultKmeans;
import jcl.utils.Progressable;
import jcl.utils.exceptions.JCLFormatException; import jcl.utils.exceptions.JCLFormatException;
import jcl.weights.ClassificationWeights; import jcl.weight