Skip to content

Commit 45b4f69

Browse files
committed
Add a useful comment from the commit message
1 parent 02644ce commit 45b4f69

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/edu/stanford/nlp/stats/MultiClassPrecisionRecallStats.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public <F> double score(Classifier<L,F> classifier, GeneralDataset<L,F> data) {
7171
labels.add(labelIndex.get(labelsArr[i]));
7272
}
7373

74+
// Handle the case when the dataset does not have all possible labels
7475
labelIndex = new HashIndex<>();
7576
labelIndex.addAll(data.labelIndex().objectsList());
7677
labelIndex.addAll(classifier.labels());
@@ -233,7 +234,7 @@ public String getDescription(int numDigits) {
233234
sb.append("--- PR Stats ---").append("\n");
234235
for (L label : labelIndex) {
235236
if (label == null || label.equals(negLabel)) { continue; }
236-
sb.append("** ").append(label.toString()).append(" **\n");
237+
sb.append("** ").append(label).append(" **\n");
237238
sb.append("\tPrec: ").append(getPrecisionDescription(numDigits, label)).append("\n");
238239
sb.append("\tRecall: ").append(getRecallDescription(numDigits, label)).append("\n");
239240
sb.append("\tF1: ").append(getF1Description(numDigits, label)).append("\n");

0 commit comments

Comments
 (0)