### Question:
ConditionalEntropy extends AbstractJob { @Override public int run(String[] args) throws IOException, ClassNotFoundException, InterruptedException { prepareArguments(args); groupAndCountByKeyAndValue(); calculateSpecificConditionalEntropy(); calculateConditionalEntropy(); return 0; }  static void main(String[] args); @Override int run(String[] args);  }### Answer:
@Test public void testConditionalEntropy() throws Exception { Configuration configuration = new Configuration(); Path input = getTestTempFilePath("input"); Path output = getTestTempFilePath("output"); FileSystem fileSystem = FileSystem.get(input.toUri(), configuration); String[] keys = { "Math", "History", "CS", "Math", "Math", "CS", "History", "Math" }; String[] values = { "Yes", "No", "Yes", "No", "No", "Yes", "No", "Yes" }; SequenceFile.Writer writer = new SequenceFile.Writer(fileSystem, configuration, input, Text.class, Text.class); try { for (int i = 0; i < keys.length; i++) { writer.append(new Text(keys[i]), new Text(values[i])); } } finally { Closeables.closeQuietly(writer); } Tool job = new ConditionalEntropy(); String[] args = { "-i", input.toString(), "-o", output.toString(), "--tempDir", getTestTempDirPath("tmp").toString() }; ToolRunner.run(job, args); Iterator<DoubleWritable> iteratorNodes = new SequenceFileDirValueIterator<DoubleWritable>(output, PathType.LIST, PathFilters.logsCRCFilter(), null, false, new Configuration()); while (iteratorNodes.hasNext()) { assertEquals(0.5, iteratorNodes.next().get(), EPSILON); } }