@Test
public void testGenerateDatasetFromFile() throws Exception {

  int nbAttributes = 10;
  int datasize = 100;
  // prepare the descriptors
  String descriptor = Utils.randomDescriptor(rng, nbAttributes);
  Attribute[] attrs = DescriptorUtils.parseDescriptor(descriptor);
  // prepare the data
  double[][] source = Utils.randomDoubles(rng, descriptor, false, datasize);
  Collection<Integer> missings = Lists.newArrayList();
  String[] sData = prepareData(source, attrs, missings);
  Dataset expected = DataLoader.generateDataset(descriptor, false, sData);
  Path path = Utils.writeDataToTestFile(sData);
  FileSystem fs = path.getFileSystem(new Configuration());
  
  Dataset dataset = DataLoader.generateDataset(descriptor, false, fs, path);
  
  assertEquals(expected, dataset);
  // regression
  source = Utils.randomDoubles(rng, descriptor, false, datasize);
  missings = Lists.newArrayList();
  sData = prepareData(source, attrs, missings);
  expected = DataLoader.generateDataset(descriptor, false, sData);
  path = Utils.writeDataToTestFile(sData);
  fs = path.getFileSystem(new Configuration());
  
  dataset = DataLoader.generateDataset(descriptor, false, fs, path);
  
  assertEquals(expected, dataset);
}