Skip to content
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

Add counters reference-getters for PrecisionRecallLayer #594

Merged
merged 2 commits into from Mar 31, 2022

Conversation

zimka
Copy link
Contributor

@zimka zimka commented Mar 25, 2022

There are many ML problems where TP/FP/FN/TN counters make sense, however they differ in terms of how these counters should be calculated. It would be nice to re-use PrecisionRecallLayer through inheritance for these ML problems.

Currently PrecisionRecallLayer counters are private, so they are inaccessible in the inherited classes, and one can not change the way these counters are calculated.

PR adds virtual reference-getters and uses them instead of direct changes of member variables. Now inherited classes have an access to the counters, and if this access is not sufficient somehow, it is possible to override the getters to use some other member variables.

Signed-off-by: Boris Zimka <boris.zimka@abbyy.com>
@zimka
Copy link
Contributor Author

zimka commented Mar 25, 2022

@FedyuninV

@zimka
Copy link
Contributor Author

zimka commented Mar 31, 2022

Speaking of virtual getters, the idea was that in some cases it would be reasonable to have more than 4 counters. For example, in case of multi-class classification metrics it could be a whole confusion matrix instead.

On the other hand, reference-getters need a member varable anyway, and may be non-virtual getters would be enough in practice.

@FedyuninV FedyuninV merged commit 658e059 into neoml-lib:master Mar 31, 2022
nismohl2 pushed a commit to nismohl2/neoml that referenced this pull request Apr 19, 2022
Signed-off-by: Boris Zimka <boris.zimka@abbyy.com>

Co-authored-by: Boris Zimka <boris.zimka@abbyy.com>
Co-authored-by: Valeriy Fedyunin <valery.fedyunin@abbyy.com>
Signed-off-by: Michael Zatsepin <michael.zatsepin@abbyy.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants