Skip to content

Commit

Permalink
feat: disable auto processing of predicted category
Browse files Browse the repository at this point in the history
Sadly our model is not yet good enough to be autonomous
  • Loading branch information
alexgarel committed Mar 16, 2022
1 parent ac8299b commit 8455868
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion robotoff/prediction/category/neural/category_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CategoryPrediction:
"""CategoryPrediction stores information about a category classification prediction."""

#: threshold on the neural model confidence to automatically apply prediction
NEURAL_CONFIDENCE_THRESHOLD = 0.9
NEURAL_CONFIDENCE_THRESHOLD = 1.1 # deactivated for now, 1.1 is above 1

def __init__(self, category: str, confidence: float):
self.category = category
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/prediction/category/neural/test_category_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@


def test_category_prediction_to_prediction():
category_prediction = CategoryPrediction("category", 0.5)

assert category_prediction.to_prediction() == Prediction(
type=InsightType.category,
value_tag="category",
data={"lang": "xx", "model": "neural", "confidence": 0.5},
automatic_processing=False,
)


def test_category_prediction_to_prediction_auto(monkeypatch):
monkeypatch.setattr(CategoryPrediction, "NEURAL_CONFIDENCE_THRESHOLD", 0.9)
category_prediction = CategoryPrediction("category", 0.9)

assert category_prediction.to_prediction() == Prediction(
Expand Down

0 comments on commit 8455868

Please sign in to comment.