Commit 5f890291 authored by lafabregue's avatar lafabregue

fix local merge

parents 7320b50c 79997ae5
......@@ -154,11 +154,17 @@ public class DistanceModel {
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)
int size = seq.getNbTuples();
if (size < 50)
size = 50;
distanceParameters[th][i] = new ParameterDTW(new double[size][size]); //special attribute for DTW distances (requires a matrix to work in)
}
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)
int size = seq.getNbTuples();
if (size < 50)
size = 50;
distanceParameters[th][i] = new ParameterDTW(new double[size][size]); //special attribute for DTW distances (requires a matrix to work in)
}
else {
distanceParameters[th][i] = EmptyDistanceParameter.getInstance();//no parameter for a numerical euclidean distance
......@@ -175,11 +181,17 @@ public class DistanceModel {
for (Distance d : model.getDistances()) {
if(d instanceof DistanceDTWMD) {
AttributeMultiDimSequence seq = (AttributeMultiDimSequence) data.getOneDataObject().getAttribute(j);//need the corresponding attribute to get the sequence length
averageParameters[j] = new ParameterDBAMean(seq.getNbTuples(), 15);
int size = seq.getNbTuples();
if (size < 50)
size = 50;
averageParameters[j] = new ParameterDBAMean(size, 15);
}
else if(d instanceof DistanceDTW) {
AttributeSequence seq = (AttributeSequence) data.getOneDataObject().getAttribute(j);//need the corresponding attribute to get the sequence length
averageParameters[j] = new ParameterDBAMean(seq.getNbTuples(), 15);
int size = seq.getNbTuples();
if (size < 50)
size = 50;
averageParameters[j] = new ParameterDBAMean(size, 15);
}
else {
averageParameters[j] = EmptyAverageParameter.getInstance();
......
......@@ -56,8 +56,8 @@ public class AverageMDDBAMean implements Average<AttributeMultiDimSequence,Param
* L'idée de cette méthode est de calculer la moyenne d'un ensemble de séquences, comme la mise-à-jour de l'ancienne moyenne, en calculant le
* barycentre des points ayant été associé à chaque point de cette dernière.
*
* @param oldCenter ancien centre du cluster
* @param attributesTab séquences associées au cluster
* @param oldCenter ancien centre du cluster
* @param p paramètres utilisés pour le calcul
* @return le nouveau centre, comme l'approximation des séquences
*/
......
......@@ -223,6 +223,10 @@ public class HybridClassification extends Classification implements Runnable, It
@Override
public void classify() {
File directory = new File("log");
if (! directory.exists() && directory.isDirectory()){
directory.mkdir();
}
if (this.useRmi()) {
this.learnRMI();
}
......@@ -1228,7 +1232,7 @@ public class HybridClassification extends Classification implements Runnable, It
* @return the unification result
*/
public ClusteringResult unification(boolean onSample) {
return unification(this.data, onSample);
return unification_relative(this.data, onSample);
}
/**
......@@ -1405,7 +1409,7 @@ public class HybridClassification extends Classification implements Runnable, It
int[] ff;
int[] ag;
int[] cl;
int[][] vote;
double[][] vote;
int[][] clustermaps;
// nombre d'agents au total
......@@ -1431,10 +1435,10 @@ public class HybridClassification extends Classification implements Runnable, It
cl[p] = -1;
}
vote = new int[nbre_agents][];
vote = new double[nbre_agents][];
for (int i = 0; i < nbre_agents; i++) {
a = this.getAgent(i);
vote[i] = new int[a.getNbClusters()];
vote[i] = new double[a.getNbClusters()];
}
// compute the cluster map for each agent
......@@ -1471,7 +1475,9 @@ public class HybridClassification extends Classification implements Runnable, It
a = this.getAgent(j);
final int kj = clustermaps[j][p];
vote[j][km] += 1;
// we weight the impact of the vote
vote[j][km] += this.evalMax.alpha[i][j].column(k)[km];
if (kj == km) {
stat[p] += 1;
}
......@@ -1479,7 +1485,7 @@ public class HybridClassification extends Classification implements Runnable, It
}
}
int max = vote[0][0];
double max = vote[0][0];
for (int i = 0; i < nbre_agents; i++) {
a = this.getAgent(i);
for (int j = 0; j < a.getNbClusters(); j++) {
......
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