Ejemplo n.º 1
0
 /**
  * Pobiera funkcje odleglosci, ktora jest aktualnie w uzyciu.
  *
  * @return Obiekt zawierajacy m.in. funkcje dystansu, wszystkie instancje, a takze pozwalajacy na
  *     obliczenie odleglosci miedzy poszczegolnymi instancjami.
  */
 public DistanceFunction getDistanceFunction() {
   DistanceFunction d = new EuclideanDistance();
   d.setAttributeIndices(attributeIndicesForDistanceFunction);
   BufferedReader reader = new BufferedReader(new StringReader(instancesForDistanceFunction));
   ArffReader arff = null;
   try {
     arff = new ArffReader(reader);
   } catch (IOException e) {
     e.printStackTrace();
   }
   d.setInstances(arff.getData());
   d.setInvertSelection(invertSelectionForDistanceFunction);
   return d;
 }