@Test public void testValues() throws Exception { for (int attr = 0; attr < classifierData.getDataset().nbAttributes(); attr++) { double[] values = classifierData.values(attr); for (int index = 0; index < DATA_SIZE; index++) { assertEquals(1, count(values, classifierData.get(index).get(attr))); } } for (int attr = 0; attr < regressionData.getDataset().nbAttributes(); attr++) { double[] values = regressionData.values(attr); for (int index = 0; index < DATA_SIZE; index++) { assertEquals(1, count(values, regressionData.get(index).get(attr))); } } }
public double[] values(int attr) { Collection<Double> result = Sets.newHashSet(); for (Instance instance : instances) { result.add(instance.get(attr)); } double[] values = new double[result.size()]; int index = 0; for (Double value : result) { values[index++] = value; } return values; }
Data implements Cloneable { public double[] values(int attr) { Collection<Double> result = Sets.newHashSet(); for (Instance instance : instances) { result.add(instance.get(attr)); } double[] values = new double[result.size()]; int index = 0; for (Double value : result) { values[index++] = value; } return values; } }
Data implements Cloneable { public double[] values(int attr) { Collection<Double> result = Sets.newHashSet(); for (Instance instance : instances) { result.add(instance.get(attr)); } double[] values = new double[result.size()]; int index = 0; for (Double value : result) { values[index++] = value; } return values; } Data(Dataset dataset);  Data(Dataset dataset, List<Instance> instances); }
Data implements Cloneable { public double[] values(int attr) { Collection<Double> result = Sets.newHashSet(); for (Instance instance : instances) { result.add(instance.get(attr)); } double[] values = new double[result.size()]; int index = 0; for (Double value : result) { values[index++] = value; } return values; } Data(Dataset dataset);  Data(Dataset dataset, List<Instance> instances); int size(); boolean isEmpty(); boolean contains(Instance v); Instance get(int index); Data subset(Condition condition); Data bagging(Random rng); Data bagging(Random rng, boolean[] sampled); Data rsplit(Random rng, int subsize); boolean isIdentical(); boolean identicalLabel(); double[] values(int attr); @Override Data clone(); @Override boolean equals(Object obj); @Override int hashCode(); double[] extractLabels(); int majorityLabel(Random rng); void countLabels(int[] counts); Dataset getDataset(); }
Data implements Cloneable { public double[] values(int attr) { Collection<Double> result = Sets.newHashSet(); for (Instance instance : instances) { result.add(instance.get(attr)); } double[] values = new double[result.size()]; int index = 0; for (Double value : result) { values[index++] = value; } return values; } Data(Dataset dataset);  Data(Dataset dataset, List<Instance> instances); int size(); boolean isEmpty(); boolean contains(Instance v); Instance get(int index); Data subset(Condition condition); Data bagging(Random rng); Data bagging(Random rng, boolean[] sampled); Data rsplit(Random rng, int subsize); boolean isIdentical(); boolean identicalLabel(); double[] values(int attr); @Override Data clone(); @Override boolean equals(Object obj); @Override int hashCode(); double[] extractLabels(); int majorityLabel(Random rng); void countLabels(int[] counts); Dataset getDataset();  }