-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from yngvem/update-confusion-matrix
Add extra utilities for the confusion matrix
- Loading branch information
Showing
8 changed files
with
121 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from collections import Counter | ||
|
||
from stringalign.align import Delete, Insert, Keep, Replace, align_strings | ||
from stringalign.statistics import StringConfusionMatrix | ||
|
||
|
||
def test_from_strings() -> None: | ||
reference = "abcbaa" | ||
predicted = "acdeai" | ||
alignment = align_strings(reference=reference, predicted=predicted) | ||
|
||
result1 = StringConfusionMatrix.from_strings_and_alignment(reference, predicted, alignment) | ||
result2 = StringConfusionMatrix.from_strings(reference, predicted) | ||
|
||
assert result1 == result2 | ||
|
||
|
||
def test_from_strings_empty() -> None: | ||
result = StringConfusionMatrix.from_strings("", "") | ||
|
||
assert result.true_positives == Counter() | ||
assert result.false_positives == Counter() | ||
assert result.false_negatives == Counter() | ||
assert result.edit_counts == Counter() |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from collections import Counter | ||
|
||
from stringalign.align import Delete, Insert, Keep, Replace, align_strings | ||
from stringalign.statistics import StringConfusionMatrix | ||
|
||
|
||
def test_from_strings_and_alignment_empty() -> None: | ||
result = StringConfusionMatrix.get_empty() | ||
|
||
assert result.true_positives == Counter() | ||
assert result.false_positives == Counter() | ||
assert result.false_negatives == Counter() | ||
assert result.edit_counts == Counter() |