@Test
public void testComputeSplit() throws DescriptorException {

  Data[] datas = generateTrainingData();
  RegressionSplit igSplit = new RegressionSplit();
  Split split = igSplit.computeSplit(datas[0], 1);
  assertEquals(180.0, split.getIg(), EPSILON);
  assertEquals(38.0, split.getSplit(), EPSILON);
  split = igSplit.computeSplit(datas[0].subset(Condition.lesser(1, 38.0)), 1);
  assertEquals(76.5, split.getIg(), EPSILON);
  assertEquals(21.5, split.getSplit(), EPSILON);
  split = igSplit.computeSplit(datas[1], 0);
  assertEquals(2205.0, split.getIg(), EPSILON);
  assertEquals(Double.NaN, split.getSplit(), EPSILON);
  split = igSplit.computeSplit(datas[1].subset(Condition.equals(0, 0.0)), 1);
  assertEquals(250.0, split.getIg(), EPSILON);
  assertEquals(41.0, split.getSplit(), EPSILON);
}