@Test
public void testConvert() throws Exception {

  Random rng = RandomUtils.getRandom();
  
  String descriptor = Utils.randomDescriptor(rng, ATTRIBUTE_COUNT);
  double[][] source = Utils.randomDoubles(rng, descriptor, false, INSTANCE_COUNT);
  String[] sData = Utils.double2String(source);
  Dataset dataset = DataLoader.generateDataset(descriptor, false, sData);
  Data data = DataLoader.loadData(dataset, sData);
  
  DataConverter converter = new DataConverter(dataset);
  
  for (int index = 0; index < data.size(); index++) {
    assertEquals(data.get(index), converter.convert(sData[index]));
  }
  // regression
  source = Utils.randomDoubles(rng, descriptor, true, INSTANCE_COUNT);
  sData = Utils.double2String(source);
  dataset = DataLoader.generateDataset(descriptor, true, sData);
  data = DataLoader.loadData(dataset, sData);
  
  converter = new DataConverter(dataset);
  
  for (int index = 0; index < data.size(); index++) {
    assertEquals(data.get(index), converter.convert(sData[index]));
  }
}