Commit 965162f4 authored by balanche's avatar balanche

Ajout de la gestion de moyennes dans le DistanceModel

parent 440ce305
......@@ -23,6 +23,9 @@ import jcl.data.attribute.AttributeSequence;
import jcl.data.distance.Distance;
import jcl.data.distance.DistanceParameter;
import jcl.data.distance.EmptyDistanceParameter;
import jcl.data.distance.average.AverageParameter;
import jcl.data.distance.average.EmptyAverageParameter;
import jcl.data.distance.average.ParameterDBAMean;
import jcl.data.distance.sequential.DistanceDTW;
import jcl.data.distance.sequential.DistanceDTWMD;
import jcl.data.distance.sequential.ParameterDTW;
......@@ -1022,23 +1025,29 @@ public class ClassifierPanel extends JPanel {
int nbIters = Integer.valueOf(((JTextField) comp[3]).getText()).intValue();
int nbThreads = 2;
DistanceParameter[][] distanceParameters = new DistanceParameter[nbThreads][model.getDistances().length];
AverageParameter[] averageParameters = new AverageParameter[model.getDistances().length];
for (int th = 0; th < nbThreads; th++) {
int i = 0;
for (Distance d : model.getDistances()) {
if(d instanceof DistanceDTWMD) {
AttributeMultiDimSequence seq = (AttributeMultiDimSequence) data.getOneDataObject().getAttribute(i);//need the corresponding attribute to get the sequence length
distanceParameters[th][i] = new ParameterDTW(new double[seq.getNbTuples()][seq.getNbTuples()]); //special attribute for DTW distances (requires a matrix to work in)
averageParameters[i] = new ParameterDBAMean(seq.getNbTuples(), 15);
}
else if(d instanceof DistanceDTW) {
AttributeSequence seq = (AttributeSequence) data.getOneDataObject().getAttribute(i);//need the corresponding attribute to get the sequence length
distanceParameters[th][i] = new ParameterDTW(new double[seq.getNbTuples()][seq.getNbTuples()]); //special attribute for DTW distances (requires a matrix to work in)
averageParameters[i] = new ParameterDBAMean(seq.getNbTuples(), 15);
}
else
else {
distanceParameters[th][i] = EmptyDistanceParameter.getInstance();//no parameter for a numerical euclidean distance
averageParameters[i] = EmptyAverageParameter.getInstance();
}
i++;
}
}
params = new ParametersKmeans(nbClusters, nbIters, nbThreads, weights, distanceParameters);
params = new ParametersKmeans(nbClusters, nbIters, nbThreads, weights, distanceParameters, averageParameters);
params.setModel(model);
break;
}
......
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