Skip to content

feature/pretty-MultiLabelConfusionMatrix-toString #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

nezda
Copy link
Contributor

@nezda nezda commented Apr 27, 2021

Description

Easier to read MultiLabelConfusionMatrix.toString(). (Subset of PR [#128] which includes other work.)

Motivation

Such a feature would make analysis of MultiLabel models simpler: in particular MultiLabelConfusionMatrix toString() is hard to interpret. Compare

[DenseMatrix(dim1=2,dim2=2,values=
	row 0 [ 3.000000000000000, 0.000000000000000];
	row 1 [ 0.000000000000000, 1.000000000000000];
)
DenseMatrix(dim1=2,dim2=2,values=
	row 0 [ 0.000000000000000, 1.000000000000000];
	row 1 [ 1.000000000000000, 2.000000000000000];
)
DenseMatrix(dim1=2,dim2=2,values=
	row 0 [ 2.000000000000000, 1.000000000000000];
	row 1 [ 1.000000000000000, 0.000000000000000];
)
]

to

(LabelSet={a})
    [tn: 3 fn: 0]
    [fp: 0 tp: 1]
(LabelSet={b})
    [tn: 0 fn: 1]
    [fp: 1 tp: 2]
(LabelSet={c})
    [tn: 2 fn: 1]
    [fp: 1 tp: 0]

cc @Craigacp

@Craigacp Craigacp added the OCA signed This PR is from a person/organisation who has signed the OCA label Apr 27, 2021
Copy link
Member

@Craigacp Craigacp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

}
sb.append("]");
return sb.toString();
return getDomain().getDomain().stream()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sensitive to the iteration order of the HashSet inside the domain, whereas the old one was fixed on construction (though when it was constructed it was fixed based on the iteration order of the HashSet in the domain).

This comment is more a todo for later when the label domains have consistent iteration order (probably lexicographic like the features).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point. That variable iteration order has confused me several times. There's always LinkedHashSet? Or maybe https://docs.oracle.com/javase/9/docs/api/java/util/Set.html#of-E...- would have stable iteration order like Guava's ImmutableHashSet? How long will Java 8 be required?

@Craigacp
Copy link
Member

I'm trying to figure out why the CI hasn't run, once I've sorted that out and it passes I'll merge in this PR.

@Craigacp
Copy link
Member

Seems like the recent change to GH Actions which limits PR workflow runs from new contributors is causing trouble. I've ran the CI tests locally and everything passes, so I'm going to merge this now.

@Craigacp Craigacp merged commit 0cbf236 into oracle:main Apr 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA signed This PR is from a person/organisation who has signed the OCA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants