test: add regression tests for lexical baseline models#42
Merged
Mattdl merged 2 commits intotechwolf-ai:mainfrom Feb 23, 2026
Merged
Conversation
Evaluate all 9 lexical baseline model variants on the JobTitleSimilarityRanking task (English, test split, 105 queries x 2,619 targets) and assert that MAP, RP@5, RP@10, and MRR match pre-recorded expected values within abs=1e-6 tolerance. Covers BM25 (lower/cased), TfIdf (word-lower/word-cased/char-lower/ char-cased), EditDistance (lower/cased), and RandomRanking (seed=42). Addresses techwolf-ai#41
…stability BM25 and TfIdf scoring may produce slightly different floating-point results across Python versions and numpy builds. The previous abs=1e-6 tolerance was too tight for reproducibility.
Mattdl
approved these changes
Feb 23, 2026
Collaborator
Mattdl
left a comment
There was a problem hiding this comment.
Looks great! Closing PR.
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.
Addresses #41
Description
This PR adds regression tests for all configuration variants of the four lexical baseline models introduced in #36:
BM25Model,TfIdfModel,EditDistanceModel, andRandomRankingModel. Each variant is evaluated on the English-only split of theJobTitleSimilarityRankingtask, and the resulting metrics are compared against pre-recorded expected values with a small tolerance window. The full regression suite runs in ~12 seconds on a mid-range laptop CPU.These tests complement the existing unit tests in
test_lexical_baselines.py, which verify output shapes and types but do not exercise the evaluation pipeline or assert metric correctness. This PR was suggested by @Mattdl in #36.Changes:
tests/test_lexical_baselines_regression.pyChecklist