Skip to content

Add Nn::ScaledLabelScorer and update Nn::CombineLabelScorer to use it#171

Merged
SimBe195 merged 3 commits intomasterfrom
scaled_label_scorer
Jan 9, 2026
Merged

Add Nn::ScaledLabelScorer and update Nn::CombineLabelScorer to use it#171
SimBe195 merged 3 commits intomasterfrom
scaled_label_scorer

Conversation

@SimBe195
Copy link
Copy Markdown
Collaborator

This PR introduces a new class ScaledLabelScorer which wraps a sub-label-scorer and multiplies all its scores by a given configured scale. The LabelScorerFactory is modified to return a ScaledLabelScorer version so that every scorer constructed via Nn::Module::instance().labelScorerFactory().createLabelScorer(config) (which is the standard way) is scaled. The CombineLabelScorer is also modified accordingly and no longer applies any scaled to its sub-scorers itself.

@curufinwe curufinwe changed the title Introduce ScaledLabelScorer class Add Nn::ScaledLabelScorer and update Nn::CombineLabelScorer to use it Dec 18, 2025
Comment thread src/Nn/LabelScorer/ScaledLabelScorer.cc Outdated

std::optional<LabelScorer::ScoreWithTime> ScaledLabelScorer::computeScoreWithTimeInternal(Request const& request) {
auto result = scorer_->computeScoreWithTime(request);
if (result) {
Copy link
Copy Markdown
Contributor

@hannah220 hannah220 Jan 5, 2026

Choose a reason for hiding this comment

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

Just for consistency, better to change to

if (result and scale_ != 1) {

Comment thread src/Nn/LabelScorer/ScaledLabelScorer.hh Outdated
namespace Nn {

/*
* Wraps a sub label scorer and scaled all the scores by a given factor
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Extended ScoringContext from sub-scorer
// Extend ScoringContext from sub-scorer

Comment on lines 24 to +25
$(OBJDIR)/ScoringContext.o \
$(OBJDIR)/ScaledLabelScorer.o \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
$(OBJDIR)/ScoringContext.o \
$(OBJDIR)/ScaledLabelScorer.o \
$(OBJDIR)/ScaledLabelScorer.o \
$(OBJDIR)/ScoringContext.o \

"ScaledLabelScorer" is alphabetically before "ScoringContext"

@SimBe195 SimBe195 merged commit fa285b3 into master Jan 9, 2026
1 of 2 checks passed
@SimBe195 SimBe195 deleted the scaled_label_scorer branch January 9, 2026 12:40
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.

4 participants