Skip to content

Commit

Permalink
Fix grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
sovrasov committed May 9, 2023
1 parent a8e7b3a commit d893ba3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions otx/api/entities/label_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/api/entities/test_label_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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)

0 comments on commit d893ba3

Please sign in to comment.