Skip to content

Commit

Permalink
include results as summary in prop_scores, minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanvg committed Sep 11, 2020
1 parent fbe27e1 commit ddccc6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion stix2/equivalence/graph_equivalence/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ def graphically_equivalent(ds1, ds2, prop_scores={}, **weight_dict):
equivalence_score = (matching_score / sum_weights) * 100
prop_scores["matching_score"] = matching_score
prop_scores["sum_weights"] = sum_weights
prop_scores["summary"] = results

logger.debug(
"DONE\nSUM_WEIGHT: %.2f\tMATCHING_SCORE: %.2f\t SCORE: %.2f",
"DONE\t\tSUM_WEIGHT: %.2f\tMATCHING_SCORE: %.2f\t SCORE: %.2f",
sum_weights,
matching_score,
equivalence_score,
Expand Down
4 changes: 2 additions & 2 deletions stix2/equivalence/object_equivalence/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,11 @@ def semantic_check(ref1, ref2, ds1, ds2, **weights):
result = 1.0
elif type1 == type2:
if weights["_internal"]["versioning_checks"]:
result = _versioned_checks(ref1, ref2, ds1, ds2, **weights) / 100
result = _versioned_checks(ref1, ref2, ds1, ds2, **weights) / 100.0
else:
o1, o2 = ds1.get(ref1), ds2.get(ref2)
if o1 and o2:
result = semantically_equivalent(o1, o2, **weights) / 100
result = semantically_equivalent(o1, o2, **weights) / 100.0

logger.debug(
"--\t\tsemantic_check '%s' '%s'\tresult: '%s'",
Expand Down

0 comments on commit ddccc6f

Please sign in to comment.