Commit d448b710 authored by balanche's avatar balanche

work in progess : cleaning of the old distance implementation

parent 587f6028
......@@ -88,9 +88,7 @@ public abstract class Data implements Cloneable, Serializable, Iterable<DataObje
private double[] stdDeviations = null;
private Data sequence = null;
protected DistanceModel model = null;
/** the sampler used to generate the Data */
private Sampler sampler = null;
......@@ -329,29 +327,17 @@ public abstract class Data implements Cloneable, Serializable, Iterable<DataObje
* Constructeur a partir d'un nombre d'objets.
* @param data les objets contenus dans cet ensemble de donnees
* @param structure la structure des donnees
* @deprecated should specify a model;use rather {@link #Data(DataObject[], DistanceModel)}
*/
public Data(final List<DataObject> data) {
this.currentView = data;
}
/**
* Constructor from a set of objects.
* @param data the dataset
* @param model the model of the desired dataset
*/
public Data(final List<DataObject> data,DistanceModel model) {
this.currentView = data;
this.model = model;
}
/**
* @param data
* @param structure
* @param knownResult
* @param nbClusters
* @deprecated should specify a model;use rather {@link #Data(DataObject[], int[], int, DistanceModel)}
*/
public Data(final List<DataObject> data, final int[] knownResult, final int nbClusters) {
this.currentView = data;
......@@ -359,23 +345,9 @@ public abstract class Data implements Cloneable, Serializable, Iterable<DataObje
new GlobalWeights(this), nbClusters, this, null, null);
}
/**
* @param data
* @param structure
* @param knownResult
* @param nbClusters
*/
public Data(final List<DataObject> data, final int[] knownResult, final int nbClusters,DistanceModel model) {
this.currentView = data;
this.knownResult = ClusteringResult.gerenerateDefaultClusteringResult(null, knownResult,
new GlobalWeights(this), nbClusters, this, null, null);
this.model = model;
}
/**
* Constructeur a partir d'un nombre d'objets.
* @param nbObjects le nombre d'objets dans les donnees
* @deprecated should specify a model;use rather {@link #Data(int, Model))}
*/
public Data(final int nbObjects) {
this.currentView = new ArrayList<DataObject>(nbObjects);
......@@ -385,19 +357,6 @@ public abstract class Data implements Cloneable, Serializable, Iterable<DataObje
this.locked = new boolean[nbObjects];
}
/**
* Constructor using the number of objects
* @param nbObjects #nbObjects
* @param model the model to be used for the dataset
*/
public Data(final int nbObjects,DistanceModel model) {
this.currentView = new ArrayList<DataObject>(nbObjects);
for(int i = 0 ; i < nbObjects ; i++) {
currentView.add(null);
}
this.locked = new boolean[nbObjects];
this.model = model;
}
/**
* Return a new Data identical to the current data but
......@@ -1648,15 +1607,6 @@ public abstract class Data implements Cloneable, Serializable, Iterable<DataObje
}
abstract public DataObject mean();
public DistanceModel getModel() {
return model;
}
public void setModel(DistanceModel model) {
this.model = model;
}
@Override
protected void finalize(){
......
......@@ -3,6 +3,9 @@ package jcl.data;
import java.io.Serializable;
import jcl.data.attribute.Attribute;
import jcl.data.distance.Distance;
import jcl.data.distance.DistanceParameter;
import jcl.data.distance.MetaDistance;
import jcl.weights.Weights;
/**
......@@ -332,6 +335,24 @@ public class DataObject implements Cloneable, Serializable {
this.attributes[i].diff(dataObject.getAttribute(i));
}
}
/**
* <p>
* Methode calculant la distance entre l'objet courant et l'objet dataObject en utilisant le DistanceModel.
* </p>
*
* @param dataObject
* le second objet
* @return la distance entre les deux objets
*/
public double distance(DataObject dataObject, DistanceModel model, DistanceParameter[] parameters) {
double res = 0;
MetaDistance metaDistance = model.getMetaDistance();
Distance<Attribute, DistanceParameter>[] distances = model.getDistances();
res = metaDistance.compute(this, dataObject, distances, parameters);
return res;
}
/**
* <p>
......@@ -361,7 +382,7 @@ public class DataObject implements Cloneable, Serializable {
* le numero de l'attribut a traiter
* @return la distance entre les attributs numero index des deux objets
*/
public double distance(final DataObject dataObject, final int attribute) {
public double distance(final DataObject dataObject, final int attribute) {
final double tmp = this.attributes[attribute].distance(dataObject
.getAttribute(attribute));
return tmp;
......
......@@ -4,7 +4,9 @@ import static java.lang.Math.PI;
import static java.lang.Math.cos;
import static java.lang.Math.sin;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
......@@ -18,6 +20,7 @@ import jcl.data.distance.DistanceParameter;
import jcl.data.distance.EmptyDistanceParameter;
import jcl.data.distance.MetaDistance;
import jcl.data.distance.MetaDistanceEuclidean;
import jcl.data.distance.MetaDistanceWeightedSquaredEuclidean;
import jcl.data.distance.NumericalEuclideanDistance;
import jcl.data.distance.average.Average;
import jcl.data.distance.average.AverageEuclidean;
......@@ -34,6 +37,7 @@ import jcl.learning.methods.monostrategy.kmeans.ClassifierKmeans;
import jcl.learning.methods.monostrategy.kmeans.LearningResultKmeans;
import jcl.learning.methods.monostrategy.kmeans.LightHardSeed;
import jcl.learning.methods.monostrategy.kmeans.ParametersKmeans;
import jcl.weights.ClassificationWeights;
/**
* This class represents a classification model.
......@@ -103,7 +107,7 @@ public class DistanceModel {
* @param dataObject the DataObject from which it will create the default model
* @return the default model
*/
public static DistanceModel generateDefaultModel(DataObject dataObject) {
public static DistanceModel generateDefaultModel(DataObject dataObject, ClassificationWeights weights) {
Distance[] distances=new Distance[dataObject.getNbAttributes()];
Average[] averages = new Average[dataObject.getNbAttributes()];
for (int i=0; i<distances.length;i++) {
......@@ -119,7 +123,11 @@ public class DistanceModel {
averages[i] = AverageEuclidean.getInstance();// ... and classic euclidean mean for numerical attributes
}
}
MetaDistance metaDistance = MetaDistanceEuclidean.getInstance(); //defines the way the two scores are combined, by default it is euclidean
double[] dWeights = new double[weights.getNbAttributes()];
for (int i = 0; i < dWeights.length; i++) {
dWeights[i]=weights.getWeights(0).getWeight(i);//?
}
MetaDistance metaDistance = new MetaDistanceWeightedSquaredEuclidean(dWeights); //defines the way the two scores are combined, by default it is euclidean
DistanceModel model = new DistanceModel(distances, metaDistance, averages);
return model;
}
......@@ -129,7 +137,7 @@ public class DistanceModel {
* @param dataObject the DataObject from which it will create the model
* @return the naive model
*/
public static DistanceModel generateNaiveModel(DataObject dataObject) {
public static DistanceModel generateNaiveModel(DataObject dataObject, ClassificationWeights weights) {
Distance[] distances=new Distance[dataObject.getNbAttributes()];
Average[] averages = new Average[dataObject.getNbAttributes()];
......@@ -141,10 +149,15 @@ public class DistanceModel {
averages[i] = AverageEuclidean.getInstance();// and classic euclidean mean for numerical attributes
}
MetaDistance metaDistance = MetaDistanceEuclidean.getInstance(); // defines the way the two scores are combined, by default it is Euclidian
double[] dWeights = new double[weights.getNbAttributes()];
for (int i = 0; i < dWeights.length; i++) {
dWeights[i]=weights.getWeights(0).getWeight(i);//?
}
MetaDistance metaDistance = new MetaDistanceWeightedSquaredEuclidean(dWeights); // defines the way the two scores are combined, by default it is Euclidian
DistanceModel model = new DistanceModel(distances, metaDistance, averages);
return model;
}
/**
* returns the medoid from a set of DataObjects
* @param tabObj the set of objects
......@@ -177,8 +190,11 @@ public class DistanceModel {
* @param args
*/
public static void main(String[] args) {
int NB_OBJECTS = 10;
int NB_OBJECTS = 2000000;
int SEQUENCE_LENGTH = 5;
Date start = new Date();
System.out.println("beginning NB_OBJECTS = "+NB_OBJECTS+" : "+ new SimpleDateFormat("HH:mm:ss.SSS").format(start.getTime()));
DataObject[] objects = new DataObject[NB_OBJECTS];
......@@ -220,7 +236,7 @@ public class DistanceModel {
distances[1] = DistanceDTWMD.getInstance(); // second attribute (sequential) compared with the DTW distance
averages[1] = AverageMDDBAMean.getInstance();
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)
DistanceModel model = new DistanceModel(distances, metaDistance, averages);
// DistanceParameter[][] distanceParameters = new DistanceParameter[NB_THREADS][2];
......@@ -247,8 +263,15 @@ public class DistanceModel {
for (int j = 0; j < NB_OBJECTS; j++) {
tabAttr[j] = objects[j].getAttribute(1);
}
Attribute oldResAttrSeq = AttributeMultiDimSequence.mean(tabAttr, (AttributeMultiDimSequence)center.getAttribute(1));
// Attribute oldResAttrSeq = AttributeMultiDimSequence.mean(tabAttr, (AttributeMultiDimSequence)center.getAttribute(1));
Attribute newResAttrSeq = model.getAverages()[1].mean(tabAttr, center.getAttribute(1), new ParameterDBAMean(1025,15));
System.out.println("end");
for (int j = 0; j < NB_OBJECTS; j++) {
tabAttr[j] = objects[j].getAttribute(0);
}
Attribute newResAttrNum = model.getAverages()[0].mean(tabAttr, center.getAttribute(0), EmptyAverageParameter.getInstance());
Date end = new Date();
System.out.println("end NB_OBJECTS = "+NB_OBJECTS+" : "+ new SimpleDateFormat("HH:mm:ss.SSS").format(end.getTime()));
System.out.println("Total in ms : "+ (end.getTime() - start.getTime()));
}
}
......@@ -75,8 +75,7 @@ public class ImageMultiDimSequenceData extends SimpleData implements Serializabl
}
public void setProperties(int mode, int simplifyFrom) {
AttributeMultiDimSequence.setMode(mode);
public void setProperties(int simplifyFrom) {
AttributeMultiDimSequence.setSimplifyFrom(simplifyFrom);
}
......
......@@ -102,9 +102,7 @@ public class SimpleData extends Data {
/* if(data.model==null){
System.err.println("No model in the data");
}
*/
this.model = data.model;
*/
this.estimatedMinDistance = data.getEstimatedMinDistance();
this.estimatedMaxDistance = data.getEstimatedMaxDistance();
this.extremaComputed = true;
......@@ -159,7 +157,6 @@ public class SimpleData extends Data {
System.err.println("No model in the data");
}
*/
this.model = data.model;
this.estimatedMinDistance = data.getEstimatedMinDistance();
this.estimatedMaxDistance = data.getEstimatedMaxDistance();
......@@ -336,7 +333,6 @@ public class SimpleData extends Data {
System.err.println("No model in the data");
}
*/
this.model = data.model;
setSampler(data.getSampler());
setMask(data.getMask());
......@@ -345,53 +341,27 @@ public class SimpleData extends Data {
/**
* Constructor from a List of DataObjects
* @param data les objets contenus dans cet ensemble de donnees
* @deprecated should specify a model;use rather {@link #Data(DataObject[], DistanceModel)}
*/
public SimpleData(final List<DataObject> data) {
this.currentView = data;
this.wholeDataNbObjects = data.size();
}
/**
* Constructor from a set of objects.
* @param data the dataset
* @param model the model of the desired dataset
*/
public SimpleData(final List<DataObject> data,DistanceModel model) {
this.currentView = data;
this.model = model;
this.wholeDataNbObjects = data.size();
}
/**
* Constructor from a Sampler
* @param sampler the sampler to use to generate the list of DataObjects
* @deprecated should specify a model;use rather {@link #Data(DataObject[], DistanceModel)}
*/
public SimpleData(final Sampler sampler) {
this.currentView = sampler.getDataObjects();
this.wholeDataNbObjects = sampler.getDataSize();
setSampler(sampler);
}
/**
* Constructor from a Sampler.
* @param sampler the sampler to use to generate the list of DataObjects
* @param model the model of the desired dataset
*/
public SimpleData(final Sampler sampler, DistanceModel model) {
this.currentView = sampler.getDataObjects();
this.wholeDataNbObjects = sampler.getDataSize();
this.model = model;
setSampler(sampler);
}
/**
* @param data
* @param structure
* @param knownResult
* @param nbClusters
* @deprecated should specify a model;use rather {@link #Data(List<DataObject>, int[], int, Model)}
*/
public SimpleData(final List<DataObject> data, final int[] knownResult, final int nbClusters) {
this.currentView = data;
......@@ -399,43 +369,16 @@ public class SimpleData extends Data {
new GlobalWeights(this), nbClusters, this, null, null);
this.wholeDataNbObjects = data.size();
}
/**
* @param data
* @param structure
* @param knownResult
* @param nbClusters
*/
public SimpleData(final List<DataObject> data, final int[] knownResult, final int nbClusters,DistanceModel model) {
this.currentView = data;
this.knownResult = ClusteringResult.gerenerateDefaultClusteringResult(null, knownResult,
new GlobalWeights(this), nbClusters, this, null, null);
this.model = model;
this.wholeDataNbObjects = data.size();
}
/**
* Constructeur a partir d'un nombre d'objets.
* @param nbObjects le nombre d'objets dans les donnees
* @deprecated should specify a model;use rather {@link #Data(int, Model))}
*/
public SimpleData(final int nbObjects) {
this.currentView = new ArrayList<DataObject>(nbObjects);
this.locked = new boolean[nbObjects];
this.wholeDataNbObjects = nbObjects;
}
/**
* Constructor using the number of objects
* @param nbObjects #nbObjects
* @param model the model to be used for the dataset
*/
public SimpleData(final int nbObjects,DistanceModel model) {
this.currentView = new ArrayList<DataObject>(nbObjects);
this.locked = new boolean[nbObjects];
this.model = model;
this.wholeDataNbObjects = nbObjects;
}
@Override
public Object clone() {
......@@ -576,7 +519,7 @@ public class SimpleData extends Data {
}
List<DataObject> objects = this.currentView.subList(0, currentView.size()-1);
objects.remove(index);
final Data loo = new SimpleData(objects,model);
final Data loo = new SimpleData(objects);
final ClusteringResult result = ClusteringResult.gerenerateDefaultClusteringResult(null,
groundTruth, new GlobalWeights(this), 2, loo, new int[0], null);
loo.setKnownResult(result);
......
......@@ -2,8 +2,6 @@ package jcl.data.attribute;
import java.io.Serializable;
import jcl.data.distance.Distance;
/**
* <p>
* Classe abstraite representant un attribut d'un objet a classer.
......@@ -82,19 +80,6 @@ public abstract class Attribute implements Serializable {
*/
abstract public void mul(double d);
/**
* <p>
* Methode abstraite calculant la distance entre l'attribut courant et
* l'attribut a.
* </p>
*
* @param a -
* le second attribut
* @return la distance entre l'attribut courant et l'attribut a
* @deprecated use rather the {@link Distance} framework
*/
abstract public double distance(Attribute a);
/**
* <p>
* Methode de test si l'attribut courant est plus grand que l'attribut a.
......
This source diff could not be displayed because it is too large. You can view the blob instead.
package jcl.data.attribute;
import jcl.data.distance.EmptyDistanceParameter;
import jcl.data.distance.NumericalEuclideanDistance;
public class AttributeNumerical extends Attribute {
......@@ -79,11 +76,6 @@ public class AttributeNumerical extends Attribute {
this.value -= att.value;
}
@Override
public double distance(final Attribute a) {
return NumericalEuclideanDistance.getInstance().compute(this,(AttributeNumerical)a,EmptyDistanceParameter.getInstance());
}
@Override
public boolean greater(final Attribute a) {
final AttributeNumerical att = (AttributeNumerical) a;
......
......@@ -25,5 +25,4 @@ public class MetaDistanceWeightedSquaredEuclidean implements MetaDistance {
}
return res;
}
}
......@@ -5,6 +5,8 @@ import java.util.Vector;
import jcl.data.DataObject;
import jcl.data.DistanceModel;
import jcl.data.distance.Distance;
import jcl.data.distance.DistanceParameter;
import jcl.weights.ClassificationWeights;
/**
......@@ -26,15 +28,26 @@ public abstract class LearningParameters implements Serializable {
public boolean hClustering = false;
private Vector<DataObject> samples = null;
/**
* Model which contains the distance algorithm to use for each attribute
* (see the {@link Distance} framework)
*/
protected DistanceModel model = null;
/**
* Parameters used for the comparison of {@link DataObject}.
* Dimension 1: #threads.
* Dimension 2: #attributes.
* (see the {@link Distance} framework)
*/
public DistanceParameter[][] distanceParameters=null;
/**
*
* @param weights
*/
public LearningParameters(final ClassificationWeights weights) {
public LearningParameters(final DistanceModel model, DistanceParameter[][] distParam) {
this.weights = weights;
}
......@@ -147,4 +160,12 @@ public abstract class LearningParameters implements Serializable {
public void setModel(DistanceModel model) {
this.model = model;
}
public DistanceParameter[][] getDistanceParameters() {
return distanceParameters;
}
public void setParameters(DistanceParameter[][] distanceParameters) {
this.distanceParameters = distanceParameters;
}
}
......@@ -62,6 +62,7 @@ public class ClassifierAHC extends LearningMethod {
/* on crée un vecteur d'agglomérats */
final Vector<Agglomerate> v = new Vector<Agglomerate>(data
.getNbObjects());
this.parameters
/* on assigne chaque objet à un agglomérat */
Iterator<DataObject> iter = data.iterator();
......@@ -94,24 +95,21 @@ public class ClassifierAHC extends LearningMethod {
public ClusteringResult merge(final LearningResult learningResult,
final ClusteringResult result, final Data data, final Vector cr)
throws MethodNotImplementedException {
// TODO Auto-generated method stub
return null;
throw new MethodNotImplementedException();
}
@Override
public ClusteringResult reclass(final LearningResult learningResult,
final ClusteringResult result, final Data data, final int c)
throws MethodNotImplementedException {
// TODO Auto-generated method stub
return null;
throw new MethodNotImplementedException();
}
@Override
public ClusteringResult split(final LearningResult learningResult,
final ClusteringResult result, final Data data, final int c,
final int n) throws MethodNotImplementedException {
// TODO Auto-generated method stub
return null;
throw new MethodNotImplementedException();
}
}
......@@ -274,7 +274,7 @@ public class ClassifierGNG extends LearningMethod {
final NodeGNG n = (NodeGNG) this.nodes[n1].clone();
for (int i = 0; i < n.center.getNbAttributes(); i++) {
final Attribute att = new AttributeNumerical(nd1.center.getValue(i)
- nd1.center.distance(nd2.center, i));
- nd1.center.distance(nd2.center, this.getParameters().getModel()));
n.center.setAttribute(i, att);
}
......
......@@ -5,6 +5,8 @@ import java.util.Iterator;
import jcl.data.Data;
import jcl.data.DataObject;
import jcl.data.DistanceModel;
import jcl.data.distance.average.AverageParameter;
/**
* <p>
......@@ -82,7 +84,7 @@ public class FuzzySeed extends KmeansSeed implements Cloneable, Serializable {
}
@Override
public void redefine() {
public void redefine(DistanceModel model, AverageParameter[] averageParameters) {
this.center.setZero();
double total = 0.0;
......
......@@ -549,7 +549,8 @@ public class LearningResultKmeans extends LearningResult {
} else {
mask = new DummyMask(card);
}
newSeed.redefineFromMask(mask);
ParametersKmeans paramsk = (ParametersKmeans) params;
newSeed.redefineFromMask(mask, params.getModel(), paramsk.getAverageParameters());
this.seeds.add(newSeed);
((ParametersKmeans) this.params).nbClusters = this.seeds.size();
......
......@@ -413,175 +413,27 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable
return str;
}
public void redefineFromMask(Mask mask) {
int card = 0;
//Dans le cas des AttributeSequence, on a besoin de fournir l'ancien centre pour calculer le nouveau
if (data.getOneDataObject().getAttribute(0) instanceof AttributeSequence && AttributeSequence.getMode() == AttributeSequence.DTW_BARYCENTRE) {
int nbAttributes = data.getOneDataObject().getNbAttributes();
final DataObject res = new DataObject(nbAttributes);
final AttributeSequence[][] tab = new AttributeSequence[nbAttributes][mask.getCarinality()];
Iterator<DataObject> iter = data.iterator(mask);
int i = 0;
while(iter.hasNext()) {
DataObject current = iter.next();
for (int a = 0; a < nbAttributes; a++) {
tab[a][i] = (AttributeSequence) current.getAttribute(a);
}
i++;
card++;
}
for (int a = 0; a < nbAttributes; a++) {
res.setAttribute(a, AttributeSequence.mean(tab[a], (AttributeSequence) center.getAttribute(a)));
}
this.center = res;
} else if (data.getOneDataObject().getAttribute(0) instanceof AttributeMultiDimSequence &&
AttributeMultiDimSequence.getMode() == AttributeMultiDimSequence.DTW_BARYCENTRE) {
int nbAttributes = data.getOneDataObject().getNbAttributes();
final DataObject res = new DataObject(nbAttributes);
final AttributeMultiDimSequence[] tab = new AttributeMultiDimSequence[mask.getCarinality()];
Iterator<DataObject> iter = data.iterator(mask);
int i = 0;
while(iter.hasNext()) {
tab[i] = (AttributeMultiDimSequence) iter.next().getAttribute(0);
i++;
card++;
}
res.setAttribute(0, AttributeMultiDimSequence.mean(tab, (AttributeMultiDimSequence) center.getAttribute(0)));
this.center = res;
} else if (data.getOneDataObject().getAttribute(0) instanceof AttributeHardConstrainedMultiDimSequence) {
int nbAttributes = data.getOneDataObject().getNbAttributes();
final DataObject res = new DataObject(nbAttributes);
final AttributeHardConstrainedMultiDimSequence[] tab = new AttributeHardConstrainedMultiDimSequence[mask.getCarinality()];
Iterator<DataObject> iter = data.iterator(mask);
int i = 0;
while(iter.hasNext()) {
tab[i] = (AttributeHardConstrainedMultiDimSequence) iter.next().getAttribute(0);
i++;
card++;
}
res.setAttribute(0, AttributeHardConstrainedMultiDimSequence.mean(tab, (AttributeHardConstrainedMultiDimSequence) center.getAttribute(0)));
this.center = res;
} else if (data.getOneDataObject().getAttribute(0) instanceof AttributeDSCMDSequence) {
int nbAttributes = data.getOneDataObject().getNbAttributes();
final DataObject res = new DataObject(nbAttributes);
final AttributeDSCMDSequence[] tab = new AttributeDSCMDSequence[mask.getCarinality()];
Iterator<DataObject> iter = data.iterator(mask);
int i = 0;
while(iter.hasNext()) {
tab[i] = (AttributeDSCMDSequence) iter.next().getAttribute(0);
i++;
card++;
}
res.setAttribute(0, AttributeDSCMDSequence.mean(tab, (AttributeDSCMDSequence) center.getAttribute(0)));
this.center = res;
this.center = res;
} else if (data.getOneDataObject().getAttribute(0) instanceof AttributeDCMDSequence) {
int nbAttributes = data.getOneDataObject().getNbAttributes();
final DataObject res = new DataObject(nbAttributes);
final AttributeDCMDSequence[] tab = new AttributeDCMDSequence[count];
Iterator<DataObject> iter = data.iterator(mask);
int i = 0;
while(iter.hasNext()) {
tab[i] = (AttributeDCMDSequence) iter.next().getAttribute(0);
i++;
card++;
}
res.setAttribute(0, AttributeDCMDSequence.mean(tab, (AttributeDCMDSequence) center.getAttribute(0)));
this.center = res;
} else if (data.getOneDataObject().getAttribute(0) instanceof AttributeMDMRSequence) {
public void redefineFromMask(Mask mask, DistanceModel model, AverageParameter[] averageParameters) {
if (count > 0) {
int nbAttributes = data.getOneDataObject().getNbAttributes();
final DataObject res = new DataObject(nbAttributes);
final AttributeMDMRSequence[] tab = new AttributeMDMRSequence[mask.getCarinality()];
Iterator<DataObject> iter = data.iterator(mask);
int i = 0;
while(iter.hasNext()) {
tab[i] = (AttributeMDMRSequence) iter.next().getAttribute(0);
i++;
card++;
}
res.setAttribute(0, AttributeMDMRSequence.mean(tab, (AttributeMDMRSequence) center.getAttribute(0)));
this.center = res;
} else if (data.getOneDataObject().getAttribute(0) instanceof AttributeMDMRHSequence) {
int nbAttributes = data.getOneDataObject().getNbAttributes();
final DataObject res = new DataObject(nbAttributes);
final AttributeMDMRHSequence[] tab = new AttributeMDMRHSequence[mask.getCarinality()];
Iterator<DataObject> iter = data.iterator(mask);
Attribute[] tab;