@Test public void testIdenticalLabelFalse() throws Exception { int n = 10; for (int nloop = 0; nloop < n; nloop++) { String descriptor = Utils.randomDescriptor(rng, ATTRIBUTE_COUNT); int label = Utils.findLabel(descriptor); double[][] source = Utils.randomDoublesWithSameLabel(rng, descriptor, false, DATA_SIZE, rng.nextInt()); int index = rng.nextInt(DATA_SIZE); source[index][label]++; String[] sData = Utils.double2String(source); Dataset dataset = DataLoader.generateDataset(descriptor, false, sData); Data data = DataLoader.loadData(dataset, sData); assertFalse(data.identicalLabel()); } }
public boolean identicalLabel() { if (isEmpty()) { return true; } double label = dataset.getLabel(get(0)); for (int index = 1; index < size(); index++) { if (dataset.getLabel(get(index)) != label) { return false; } } return true; }
Data implements Cloneable { public boolean identicalLabel() { if (isEmpty()) { return true; } double label = dataset.getLabel(get(0)); for (int index = 1; index < size(); index++) { if (dataset.getLabel(get(index)) != label) { return false; } } return true; } }
Data implements Cloneable { public boolean identicalLabel() { if (isEmpty()) { return true; } double label = dataset.getLabel(get(0)); for (int index = 1; index < size(); index++) { if (dataset.getLabel(get(index)) != label) { return false; } } return true; } Data(Dataset dataset);  Data(Dataset dataset, List<Instance> instances); }
Data implements Cloneable { public boolean identicalLabel() { if (isEmpty()) { return true; } double label = dataset.getLabel(get(0)); for (int index = 1; index < size(); index++) { if (dataset.getLabel(get(index)) != label) { return false; } } return true; } 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 boolean identicalLabel() { if (isEmpty()) { return true; } double label = dataset.getLabel(get(0)); for (int index = 1; index < size(); index++) { if (dataset.getLabel(get(index)) != label) { return false; } } return true; } 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();  }