From d6d42d8253e93e27521066844a6b8af802a41150 Mon Sep 17 00:00:00 2001 From: Vladislav Sovrasov Date: Wed, 26 Apr 2023 08:09:48 +0900 Subject: [PATCH] Fix grammar --- otx/api/entities/label_schema.py | 4 ++-- tests/unit/api/entities/test_label_schema.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/otx/api/entities/label_schema.py b/otx/api/entities/label_schema.py index 5917f3fa915..b693396fe27 100644 --- a/otx/api/entities/label_schema.py +++ b/otx/api/entities/label_schema.py @@ -558,12 +558,12 @@ def from_labels(cls, labels: Sequence[LabelEntity]) -> "LabelSchemaEntity": label_group = LabelGroup(name="from_label_list", labels=labels) return LabelSchemaEntity(label_groups=[label_group]) - def resolve_labels_greedy(self, scored_labels: List[ScoredLabel]) -> List[ScoredLabel]: + def resolve_labels_greedily(self, scored_labels: List[ScoredLabel]) -> List[ScoredLabel]: """Resolves hierarchical labels and exclusivity based on a list of ScoredLabels (labels with probability). The following two steps are taken: - - selects the most likely label from each label group + - select the most likely label from each label group - add their predecessors if they are also most likely labels (greedy approach). Args: diff --git a/tests/unit/api/entities/test_label_schema.py b/tests/unit/api/entities/test_label_schema.py index b443c2f710a..f24c96ea90d 100644 --- a/tests/unit/api/entities/test_label_schema.py +++ b/tests/unit/api/entities/test_label_schema.py @@ -1845,7 +1845,7 @@ def test_label_schema_resolve_labels(self): ] assert ref_labels == resloved_labels - resloved_labels_greedy = label_schema.resolve_labels_greedy(predicted_labels) + resloved_labels_greedy = label_schema.resolve_labels_greedily(predicted_labels) assert ref_labels == resloved_labels_greedy # supress children of non-maximum labels @@ -1858,7 +1858,7 @@ def test_label_schema_resolve_labels(self): ref_labels = [ScoredLabel(labels_2[1], 0.5)] assert ref_labels == resloved_labels - resloved_labels_greedy = label_schema.resolve_labels_greedy(predicted_labels) + resloved_labels_greedy = label_schema.resolve_labels_greedily(predicted_labels) assert ref_labels == resloved_labels_greedy @pytest.mark.reqids(Requirements.REQ_1) @@ -1913,4 +1913,4 @@ def test_label_schema_resolve_labels_greedy(self): ScoredLabel(g4_labels[0], 0.9), ] - assert ref_labels == label_schema.resolve_labels_greedy(predicted_labels) + assert ref_labels == label_schema.resolve_labels_greedily(predicted_labels)