### Question:
ChiSquaredFeatureRanker extends AbstractFeatureRanker { @Override public FeatureRanking rankFeatures(Dataset dataset, ProgressReporter progress) { Validate.notNull(dataset, "dataset must not be null"); NumericMatrix<String> chiSquareMatrix = calculateChiSquareValues(dataset, progress); return mergingStrategy.merge(chiSquareMatrix); } ChiSquaredFeatureRanker(SelectedFeatureMergingStrategy mergingStrategy); static NumericMatrix<String> calculateChiSquareValues(Dataset dataset, ProgressReporter progress); @Override FeatureRanking rankFeatures(Dataset dataset, ProgressReporter progress);  }### Answer:
@Test public void testInformationGain_wineData_average() throws FileNotFoundException { File testFile = getResourceFile("/classifier/wineData.csv"); List<Instance> dataset = new CsvDatasetReader(testFile).readAll(); FeatureRanking result = new ChiSquaredFeatureRanker(new AverageMergingStrategy()).rankFeatures(dataset, new ProgressMonitor()); assertEquals(125.9867, result.getFeature("od280/od315ofDilutedWines").getScore(), DELTA); assertEquals(128.5980, result.getFeature("colorIntensity").getScore(), DELTA); assertEquals(124.7087, result.getFeature("proline").getScore(), DELTA); assertEquals(160.0524, result.getFeature("flavanoids").getScore(), DELTA); assertEquals(105.8876, result.getFeature("alcohol").getScore(), DELTA); assertEquals(95.2166, result.getFeature("hue").getScore(), DELTA); assertEquals(97.2884, result.getFeature("totalPhenols").getScore(), DELTA); assertEquals(62.9867, result.getFeature("alcalinityOfAsh").getScore(), DELTA); assertEquals(79.7351, result.getFeature("malicAcid").getScore(), DELTA); assertEquals(56.2174, result.getFeature("magnesium").getScore(), DELTA); assertEquals(60.1322, result.getFeature("proanthocyanins").getScore(), DELTA); assertEquals(35.6311, result.getFeature("ash").getScore(), DELTA); assertEquals(46.9911, result.getFeature("nonflavanoidPhenols").getScore(), DELTA); }
@Test public void testInformationGain_wineData_roundRobin() throws FileNotFoundException { File testFile = getResourceFile("/classifier/wineData.csv"); List<Instance> dataset = new CsvDatasetReader(testFile).readAll(); FeatureRanking result = new ChiSquaredFeatureRanker(new RoundRobinMergingStrategy()).rankFeatures(dataset, new ProgressMonitor()); assertEquals(37, result.getFeature("od280/od315ofDilutedWines").getScore(), DELTA); assertEquals(37, result.getFeature("colorIntensity").getScore(), DELTA); assertEquals(37, result.getFeature("proline").getScore(), DELTA); assertEquals(36, result.getFeature("flavanoids").getScore(), DELTA); assertEquals(36, result.getFeature("alcohol").getScore(), DELTA); assertEquals(35, result.getFeature("hue").getScore(), DELTA); assertEquals(35, result.getFeature("totalPhenols").getScore(), DELTA); assertEquals(33, result.getFeature("alcalinityOfAsh").getScore(), DELTA); assertEquals(32, result.getFeature("malicAcid").getScore(), DELTA); assertEquals(32, result.getFeature("magnesium").getScore(), DELTA); assertEquals(30, result.getFeature("proanthocyanins").getScore(), DELTA); assertEquals(28, result.getFeature("ash").getScore(), DELTA); assertEquals(23, result.getFeature("nonflavanoidPhenols").getScore(), DELTA); }