Updated flat sigmoid to match birdnet_analyzer - #25
Conversation
Josef-Haupt
commented
Feb 18, 2026
- See implementation here
- PR on main because dev is outdated (?)
There was a problem hiding this comment.
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
biasparameter with default value of1.0toflat_sigmoid_logaddexp_fastfunction - Implemented bias transformation:
transformed_bias = (bias - 1.0) * 10.0 - Modified clipping to operate on
x + transformed_biasinstead of justx
💡 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 |
There was a problem hiding this comment.
The new bias parameter lacks test coverage. Consider adding unit tests to verify:
- Backward compatibility when bias=1.0 (default)
- Correct behavior for various bias values
- 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.
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|