### Question:
FunctionalDependencyRanking extends Ranking { protected void calculateInformationGainBytes(FunctionalDependencyResult result, TableInformation tableInformation) { long rowCount = tableInformation.getRowCount(); long informationGainTable = tableInformation.getInformationContent(); Map<String, ColumnInformation> columnInformationMap = tableInformation.getColumnInformationMap(); Set<String> dependantColumnNames = new HashSet<>(); for (ColumnIdentifier column : result.getExtendedDependant().getColumnIdentifiers()) { dependantColumnNames.add(column.getColumnIdentifier()); } long informationGainTableWithoutDependant = 0L; for (String columnName : columnInformationMap.keySet()) { if (!dependantColumnNames.contains(columnName)) { informationGainTableWithoutDependant += columnInformationMap.get(columnName).getInformationContent(rowCount); } } long uniqueRowsCount = rowCount - calculateKeyError(result.getDeterminantAsBitSet()); long informationGainNewTable = 0L; for (ColumnIdentifier column : result.getDeterminant().getColumnIdentifiers()) { informationGainNewTable += columnInformationMap.get(column.getColumnIdentifier()) .getInformationContent(uniqueRowsCount); } for (ColumnIdentifier column : result.getExtendedDependant().getColumnIdentifiers()) { informationGainNewTable += columnInformationMap.get(column.getColumnIdentifier()) .getInformationContent(uniqueRowsCount); } result.setInformationGainBytes(informationGainTable - (informationGainTableWithoutDependant + informationGainNewTable)); } FunctionalDependencyRanking(List<FunctionalDependencyResult> results,
                                     Map<String, TableInformation> tableInformationMap); @Override void calculateDataIndependentRankings(); @Override void calculateDataDependentRankings(); Map<BitSet, PositionListIndex> createPLIs(TableInformation tableInformation);  }### Answer:
@Test public void testCalculateInformationGainBytes() throws Exception { setUpInformationGain(); FunctionalDependencyRanking ranking = new FunctionalDependencyRanking(functionalDependencyResults, tableInformationMap); FunctionalDependencyResult result = functionalDependencyResults.get(0); TableInformation tableInformation = tableInformationMap.values().iterator().next(); Map<BitSet, PositionListIndex> plis = ranking.createPLIs(tableInformation); ranking.PLIs = plis; ranking.calculateInformationGainBytes(result, tableInformation); assertEquals(-4.0, result.getInformationGainBytes(), 0.00); }