Commit 32156493 authored by lafabregue's avatar lafabregue

fiw on KMeans import

parent 7c38e5b9
Pipeline #1828 failed with stages
in 39 seconds
......@@ -11,11 +11,13 @@ import jcl.Classification;
import jcl.clustering.ClusteringResult;
import jcl.data.Data;
import jcl.data.DataObject;
import jcl.data.SimpleData;
import jcl.data.attribute.Attribute;
import jcl.data.distance.Distance;
import jcl.data.distance.DistanceModel;
import jcl.data.distance.DistanceParameter;
import jcl.data.distance.MetaDistance;
import jcl.data.distance.average.AverageParameter;
import jcl.data.mask.DummyMask;
import jcl.data.mask.Mask;
import jcl.data.mask.MultiIDIntArrayMask;
......@@ -886,6 +888,7 @@ public class LearningResultKmeans extends LearningResult {
Vector<KmeansSeed> seeds = null;
Weights weights = null;
LearningResult result = null;
Data defaultData = null;
for (String s : sections) {
switch (JCLModelExchange.getSectionTitle(s)) {
......@@ -897,6 +900,7 @@ public class LearningResultKmeans extends LearningResult {
seeds = new Vector<KmeansSeed>();
List<DataObject> dataObjects = JCLModelExchange
.arffToDataObjects(JCLModelExchange.getSectionBody(s));
defaultData = new SimpleData(dataObjects, null, null);
for(int i = 0 ; i < dataObjects.size() ; i++) {
seeds.add(new LightHardSeed(dataObjects.get(i), null, i));
}
......@@ -913,11 +917,11 @@ public class LearningResultKmeans extends LearningResult {
if (weights == null) {
weights = new Weights(seeds.get(0).getCenter().getNbAttributes());
}
DistanceModel distanceModel = DistanceModel.generateDefaultModel(seeds.get(0).getCenter(), new GlobalWeights(weights));
DistanceParameter[][] distParameters = DistanceModel.generateDefaultDistanceParameters(4, distanceModel, defaultData);
AverageParameter[] avgParameters = DistanceModel.generateDefaultAverageParameters(distanceModel, defaultData);
result = new LearningResultKmeans(seeds, new ParametersKmeans(seeds.size(),
0, this.getLearningParameters().getModel(),
this.getLearningParameters().getDistanceParameters(),
this.getLearningParameters().getAverageParameters()));
0, distanceModel, distParameters, avgParameters));
if (colors != null) {
result.setColors(colors);
......
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