Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug in APLExplanation#toDataFrame
Browse files Browse the repository at this point in the history
fabuzaid21 committed Feb 9, 2018
1 parent aa0b185 commit 16235f6
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -113,25 +113,30 @@ public DataFrame toDataFrame(final List<String> attrsToInclude) {
}

final Map<String, Double> metricValsInRow = result.getMetricsAsMap();
for (String colName : doubleResultsByCol.keySet()) {
for (String colName : metricValsInRow.keySet()) {
doubleResultsByCol.get(colName)[i] = metricValsInRow.get(colName);
}

final Map<String, Double> aggregateValsInRow = result
.getAggregatesAsMap(aggregateNames);
for (String colName : doubleResultsByCol.keySet()) {
for (String colName : aggregateNames) {
doubleResultsByCol.get(colName)[i] = aggregateValsInRow.get(colName);
}
++i;
}

// Generate DataFrame with results
final DataFrame df = new DataFrame();
for (String attr : stringResultsByCol.keySet()) {
df.addColumn(attr, stringResultsByCol.get(attr));
for (String colName : stringResultsByCol.keySet()) {
df.addColumn(colName, stringResultsByCol.get(colName));
}
for (String attr : doubleResultsByCol.keySet()) {
df.addColumn(attr, doubleResultsByCol.get(attr));
// Add metrics first, then aggregates (otherwise, we'll get arbitrary orderings)
for (QualityMetric metric : metrics) {
df.addColumn(metric.name(), doubleResultsByCol.get(metric.name()));
}
for (String colName : aggregateNames) {
// Aggregates are capitalized for some reason
df.addColumn(colName.toLowerCase(), doubleResultsByCol.get(colName));
}
return df;
}

0 comments on commit 16235f6

Please sign in to comment.