@Test
  public void testBagging() {

    Data bag = classifierData.bagging(rng);

    // the bag should have the same size as the data
    assertEquals(classifierData.size(), bag.size());

    // at least one element from the data should not be in the bag
    boolean found = false;
    for (int index = 0; index < classifierData.size() && !found; index++) {
      found = !bag.contains(classifierData.get(index));
    }
    
    assertTrue("some instances from data should not be in the bag", found);

    // regression
    bag = regressionData.bagging(rng);

    // the bag should have the same size as the data
    assertEquals(regressionData.size(), bag.size());

    // at least one element from the data should not be in the bag
    found = false;
    for (int index = 0; index < regressionData.size() && !found; index++) {
      found = !bag.contains(regressionData.get(index));
    }
    
    assertTrue("some instances from data should not be in the bag", found);
}