Skip to content

Updated flat sigmoid to match birdnet_analyzer - #25

Merged
stefantaubert merged 2 commits into
mainfrom
flat-sigmoid-sensitivity
Feb 22, 2026
Merged

Updated flat sigmoid to match birdnet_analyzer#25
stefantaubert merged 2 commits into
mainfrom
flat-sigmoid-sensitivity

Conversation

@Josef-Haupt

Copy link
Copy Markdown
Member
  • See implementation here
  • PR on main because dev is outdated (?)

Copilot AI left a comment

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.

Pull request overview

This PR updates the flat_sigmoid_logaddexp_fast function in src/birdnet/utils/helper.py to match the BirdNET-Analyzer reference implementation. The change adds a bias parameter that allows adjustment of the sigmoid transformation, while maintaining backward compatibility through a default value.

Changes:

  • Added bias parameter with default value of 1.0 to flat_sigmoid_logaddexp_fast function
  • Implemented bias transformation: transformed_bias = (bias - 1.0) * 10.0
  • Modified clipping to operate on x + transformed_bias instead of just x

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


def flat_sigmoid_logaddexp_fast(
x: npt.NDArray, sensitivity: float, clip_val: float = 15.0
x: npt.NDArray, sensitivity: float, clip_val: float = 15.0, bias: float = 1.0

Copilot AI Feb 18, 2026

Copy link

Choose a reason for hiding this comment

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

The new bias parameter lacks test coverage. Consider adding unit tests to verify:

  1. Backward compatibility when bias=1.0 (default)
  2. Correct behavior for various bias values
  3. The transformed_bias calculation matches the BirdNET-Analyzer reference implementation

This is especially important since there are comprehensive tests for other functions in the repository (e.g., in src/birdnet_tests/), and this function is used in the prediction pipeline.

Copilot uses AI. Check for mistakes.
@codecov

codecov Bot commented Feb 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/birdnet/utils/helper.py 0.00% 2 Missing ⚠️
Files with missing lines Coverage Δ
src/birdnet/utils/helper.py 62.43% <0.00%> (-0.35%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stefantaubert
stefantaubert merged commit b63a29d into main Feb 22, 2026
9 of 17 checks passed
@stefantaubert
stefantaubert deleted the flat-sigmoid-sensitivity branch February 22, 2026 07:00
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.

3 participants