Skip IOCs with empty days_seen in scoring pipeline#892
Merged
regulartim merged 1 commit intointelowlproject:developfrom Feb 26, 2026
Merged
Conversation
Closes intelowlproject#886 Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>
Contributor
Author
|
Hi @regulartim , please review the changes when you get a chance. Happy to make any adjustments if needed. Thanks! |
cclts
pushed a commit
to cclts/GreedyBear
that referenced
this pull request
Mar 11, 2026
…oject#886 (intelowlproject#892) Closes intelowlproject#886 Signed-off-by: Sanchit2662 <sanchit2662@gmail.com>
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.
Summary
While reviewing the scoring pipeline, I noticed that
get_features()ingreedybear/cronjobs/scoring/utils.pyperforms division usingdays_seen_countwithout checking if it's zero. Since thedays_seenfield in the IOC model defaults to an empty list ([]), any IOC with unpopulated data causes aZeroDivisionErrorthat crashes the entire scoring job — affecting bothTrainModelsandUpdateScorescronjobs. This prevents all IOC scores from being updated until the bad record is manually removed.Fix
Added a guard to prevent division by zero by using
max(days_seen_count, 1)when calculating per-day metrics. This ensures IOCs with emptydays_seendon't crash the pipeline while still allowing them to be processed with sensible defaults.Type of change
Formalities
develop.develop.Docs and tests
Ruff) gave 0 errors.Closes #886