Commit 9a666520 authored by lafabregue's avatar lafabregue

modification of index computation dialogs

parent 5d079fbd
...@@ -18,6 +18,9 @@ public class DistanceDTWMD implements Distance<AttributeMultiDimSequence,Paramet ...@@ -18,6 +18,9 @@ public class DistanceDTWMD implements Distance<AttributeMultiDimSequence,Paramet
@Override @Override
public double compute(AttributeMultiDimSequence S, AttributeMultiDimSequence T, ParameterDTW p) { public double compute(AttributeMultiDimSequence S, AttributeMultiDimSequence T, ParameterDTW p) {
if (S == null || T == null) {
return 0;
}
final int tailleS = S.getNbTuples(); final int tailleS = S.getNbTuples();
final int tailleT = T.getNbTuples(); final int tailleT = T.getNbTuples();
......
...@@ -501,13 +501,15 @@ public class ImageSampler extends Sampler { ...@@ -501,13 +501,15 @@ public class ImageSampler extends Sampler {
index = iter.next(); index = iter.next();
iterPos --; iterPos --;
} }
} else {
index = iter.next();
} }
selectedIndexes.set(i, index); selectedIndexes.set(i, index);
} else { } else {
index = getIndex(i); index = getIndex(i);
} }
x = getStartX() + ((int) index) % imageWidth; x = getStartX() + ((int) index) % (imageWidth+1);
y = getStartY() + ((int) index) / imageWidth; y = getStartY() + ((int) index) / (imageWidth+1);
result.add(new DataObject(1)); result.add(new DataObject(1));
List<double[]> values = new ArrayList<double[]>(); List<double[]> values = new ArrayList<double[]>();
......
...@@ -391,7 +391,7 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable ...@@ -391,7 +391,7 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable
int nbAttributes = data.getOneDataObject().getNbAttributes(); int nbAttributes = data.getOneDataObject().getNbAttributes();
final DataObject res = new DataObject(nbAttributes); final DataObject res = new DataObject(nbAttributes);
final AttributeSequence[][] tab = new AttributeSequence[nbAttributes][count]; final AttributeSequence[][] tab = new AttributeSequence[nbAttributes][mask.getCarinality()];
Iterator<DataObject> iter = data.iterator(mask); Iterator<DataObject> iter = data.iterator(mask);
int i = 0; int i = 0;
...@@ -409,12 +409,13 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable ...@@ -409,12 +409,13 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable
} }
this.center = res; this.center = res;
} else if (data.getOneDataObject().getAttribute(0) instanceof AttributeMultiDimSequence && AttributeMultiDimSequence.getMode() == AttributeMultiDimSequence.DTW_BARYCENTRE) { } else if (data.getOneDataObject().getAttribute(0) instanceof AttributeMultiDimSequence &&
AttributeMultiDimSequence.getMode() == AttributeMultiDimSequence.DTW_BARYCENTRE) {
int nbAttributes = data.getOneDataObject().getNbAttributes(); int nbAttributes = data.getOneDataObject().getNbAttributes();
final DataObject res = new DataObject(nbAttributes); final DataObject res = new DataObject(nbAttributes);
final AttributeMultiDimSequence[] tab = new AttributeMultiDimSequence[count]; final AttributeMultiDimSequence[] tab = new AttributeMultiDimSequence[mask.getCarinality()];
Iterator<DataObject> iter = data.iterator(mask); Iterator<DataObject> iter = data.iterator(mask);
int i = 0; int i = 0;
...@@ -432,7 +433,7 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable ...@@ -432,7 +433,7 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable
int nbAttributes = data.getOneDataObject().getNbAttributes(); int nbAttributes = data.getOneDataObject().getNbAttributes();
final DataObject res = new DataObject(nbAttributes); final DataObject res = new DataObject(nbAttributes);
final AttributeHardConstrainedMultiDimSequence[] tab = new AttributeHardConstrainedMultiDimSequence[count]; final AttributeHardConstrainedMultiDimSequence[] tab = new AttributeHardConstrainedMultiDimSequence[mask.getCarinality()];
Iterator<DataObject> iter = data.iterator(mask); Iterator<DataObject> iter = data.iterator(mask);
int i = 0; int i = 0;
...@@ -450,7 +451,7 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable ...@@ -450,7 +451,7 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable
int nbAttributes = data.getOneDataObject().getNbAttributes(); int nbAttributes = data.getOneDataObject().getNbAttributes();
final DataObject res = new DataObject(nbAttributes); final DataObject res = new DataObject(nbAttributes);
final AttributeDSCMDSequence[] tab = new AttributeDSCMDSequence[count]; final AttributeDSCMDSequence[] tab = new AttributeDSCMDSequence[mask.getCarinality()];
Iterator<DataObject> iter = data.iterator(mask); Iterator<DataObject> iter = data.iterator(mask);
int i = 0; int i = 0;
...@@ -486,7 +487,7 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable ...@@ -486,7 +487,7 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable
int nbAttributes = data.getOneDataObject().getNbAttributes(); int nbAttributes = data.getOneDataObject().getNbAttributes();
final DataObject res = new DataObject(nbAttributes); final DataObject res = new DataObject(nbAttributes);
final AttributeMDMRSequence[] tab = new AttributeMDMRSequence[count]; final AttributeMDMRSequence[] tab = new AttributeMDMRSequence[mask.getCarinality()];
Iterator<DataObject> iter = data.iterator(mask); Iterator<DataObject> iter = data.iterator(mask);
int i = 0; int i = 0;
...@@ -503,7 +504,7 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable ...@@ -503,7 +504,7 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable
int nbAttributes = data.getOneDataObject().getNbAttributes(); int nbAttributes = data.getOneDataObject().getNbAttributes();
final DataObject res = new DataObject(nbAttributes); final DataObject res = new DataObject(nbAttributes);
final AttributeMDMRHSequence[] tab = new AttributeMDMRHSequence[count]; final AttributeMDMRHSequence[] tab = new AttributeMDMRHSequence[mask.getCarinality()];
Iterator<DataObject> iter = data.iterator(mask); Iterator<DataObject> iter = data.iterator(mask);
int i = 0; int i = 0;
...@@ -541,7 +542,7 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable ...@@ -541,7 +542,7 @@ public class LightHardSeed extends KmeansSeed implements Cloneable, Serializable
this.center = res; this.center = res;
} else { } else {
List<DataObject> array = new ArrayList<DataObject>(count); List<DataObject> array = new ArrayList<DataObject>(mask.getCarinality());
Iterator<DataObject> iter = data.iterator(mask); Iterator<DataObject> iter = data.iterator(mask);
while(iter.hasNext()) { while(iter.hasNext()) {
......
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