public TrainingSet(Instance[] instances) { int instanceId = 0; instanceSet = new HashMap<Integer, Instance>(); conceptSet = new HashSet<Concept>(); attributeNameSet = new HashSet<String>(); Concept c; for (Instance i : instances) { // System.out.println("Instance Added: "); // i.print(); instanceSet.put(instanceId, i); c = i.getConcept(); if (!conceptSet.contains(c)) { conceptSet.add(c); } for (Attribute a : i.getAtrributes()) { if (a != null) { attributeNameSet.add(a.getName()); } } instanceId++; } if (verbose) { System.out.println("-------------------------------------------------------------"); System.out.print("Loaded " + getSize() + " instances that belong into "); System.out.println(this.getNumberOfConcepts() + " concepts"); System.out.println("-------------------------------------------------------------"); } }
public void print() { for (Instance i : instanceSet.values()) { i.print(); } }