Add Nn::ScaledLabelScorer and update Nn::CombineLabelScorer to use it#171
Merged
Add Nn::ScaledLabelScorer and update Nn::CombineLabelScorer to use it#171
Conversation
curufinwe
approved these changes
Dec 18, 2025
ScaledLabelScorer class
hannah220
approved these changes
Jan 5, 2026
|
|
||
| std::optional<LabelScorer::ScoreWithTime> ScaledLabelScorer::computeScoreWithTimeInternal(Request const& request) { | ||
| auto result = scorer_->computeScoreWithTime(request); | ||
| if (result) { |
Contributor
There was a problem hiding this comment.
Just for consistency, better to change to
if (result and scale_ != 1) {
larissakl
approved these changes
Jan 6, 2026
| namespace Nn { | ||
|
|
||
| /* | ||
| * Wraps a sub label scorer and scaled all the scores by a given factor |
Contributor
There was a problem hiding this comment.
Suggested change
| * Wraps a sub label scorer and scaled all the scores by a given factor | |
| * Wraps a sub label scorer and scales all the scores by a given factor |
| virtual void addInputs(DataView const& input, size_t nTimesteps) override; | ||
|
|
||
| protected: | ||
| // Extended ScoringContext from sub-scorer |
Contributor
There was a problem hiding this comment.
Suggested change
| // Extended ScoringContext from sub-scorer | |
| // Extend ScoringContext from sub-scorer |
Comment on lines
24
to
+25
| $(OBJDIR)/ScoringContext.o \ | ||
| $(OBJDIR)/ScaledLabelScorer.o \ |
Contributor
There was a problem hiding this comment.
Suggested change
| $(OBJDIR)/ScoringContext.o \ | |
| $(OBJDIR)/ScaledLabelScorer.o \ | |
| $(OBJDIR)/ScaledLabelScorer.o \ | |
| $(OBJDIR)/ScoringContext.o \ |
"ScaledLabelScorer" is alphabetically before "ScoringContext"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a new class
ScaledLabelScorerwhich wraps a sub-label-scorer and multiplies all its scores by a given configured scale. TheLabelScorerFactoryis modified to return aScaledLabelScorerversion so that every scorer constructed viaNn::Module::instance().labelScorerFactory().createLabelScorer(config)(which is the standard way) is scaled. TheCombineLabelScoreris also modified accordingly and no longer applies any scaled to its sub-scorers itself.