docstrings, changes to equivalence.ipynb
parent
fc600df5f1
commit
92ab1227ed
|
@ -2165,15 +2165,17 @@
|
||||||
"The weights dictionary should contain both the weight and the comparison function for each property. You may use the default weights and functions, or provide your own.\n",
|
"The weights dictionary should contain both the weight and the comparison function for each property. You may use the default weights and functions, or provide your own.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"##### Existing comparison functions\n",
|
"##### Existing comparison functions\n",
|
||||||
"For reference, here is a list of the comparison functions already built in the codebase (found in [stix2/environment.py](../api/stix2.environment.rst#stix2.environment.Environment)):\n",
|
"For reference, here is a list of the comparison functions already built in the codebase (found in [stix2/equivalence/object](../api/equivalence/stix2.equivalence.object.rst#module-stix2.equivalence.object)):\n",
|
||||||
"\n",
|
"\n",
|
||||||
" - [custom_pattern_based](../api/stix2.environment.rst#stix2.environment.custom_pattern_based)\n",
|
" - [custom_pattern_based](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.custom_pattern_based)\n",
|
||||||
" - [exact_match](../api/stix2.environment.rst#stix2.environment.exact_match)\n",
|
" - [exact_match](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.exact_match)\n",
|
||||||
" - [partial_external_reference_based](../api/stix2.environment.rst#stix2.environment.partial_external_reference_based)\n",
|
" - [list_reference_check](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.list_reference_check)\n",
|
||||||
" - [partial_list_based](../api/stix2.environment.rst#stix2.environment.partial_list_based)\n",
|
" - [partial_external_reference_based](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.partial_external_reference_based)\n",
|
||||||
" - [partial_location_distance](../api/stix2.environment.rst#stix2.environment.partial_location_distance)\n",
|
" - [partial_list_based](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.partial_list_based)\n",
|
||||||
" - [partial_string_based](../api/stix2.environment.rst#stix2.environment.partial_string_based)\n",
|
" - [partial_location_distance](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.partial_location_distance)\n",
|
||||||
" - [partial_timestamp_based](../api/stix2.environment.rst#stix2.environment.partial_timestamp_based)\n",
|
" - [partial_string_based](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.partial_string_based)\n",
|
||||||
|
" - [partial_timestamp_based](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.partial_timestamp_based)\n",
|
||||||
|
" - [reference_check](../api/equivalence/stix2.equivalence.object.rst#stix2.equivalence.object.reference_check)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"For instance, if we wanted to compare two of the `ThreatActor`s from before, but use our own weights, then we could do the following:"
|
"For instance, if we wanted to compare two of the `ThreatActor`s from before, but use our own weights, then we could do the following:"
|
||||||
]
|
]
|
||||||
|
|
|
@ -4,7 +4,7 @@ import copy
|
||||||
from .datastore import CompositeDataSource, DataStoreMixin
|
from .datastore import CompositeDataSource, DataStoreMixin
|
||||||
from .equivalence.graph import graphically_equivalent
|
from .equivalence.graph import graphically_equivalent
|
||||||
from .equivalence.object import ( # noqa: F401
|
from .equivalence.object import ( # noqa: F401
|
||||||
check_property_present, custom_pattern_based, exact_match,
|
WEIGHTS, check_property_present, custom_pattern_based, exact_match,
|
||||||
list_reference_check, partial_external_reference_based, partial_list_based,
|
list_reference_check, partial_external_reference_based, partial_list_based,
|
||||||
partial_location_distance, partial_string_based, partial_timestamp_based,
|
partial_location_distance, partial_string_based, partial_timestamp_based,
|
||||||
reference_check, semantically_equivalent,
|
reference_check, semantically_equivalent,
|
||||||
|
@ -222,7 +222,7 @@ class Environment(DataStoreMixin):
|
||||||
Note:
|
Note:
|
||||||
Default weights_dict:
|
Default weights_dict:
|
||||||
|
|
||||||
.. include:: ../default_sem_eq_weights.rst
|
.. include:: ../object_default_sem_eq_weights.rst
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
This implementation follows the Semantic Equivalence Committee Note.
|
This implementation follows the Semantic Equivalence Committee Note.
|
||||||
|
@ -260,7 +260,7 @@ class Environment(DataStoreMixin):
|
||||||
Note:
|
Note:
|
||||||
Default weights_dict:
|
Default weights_dict:
|
||||||
|
|
||||||
.. include:: ../default_sem_eq_weights.rst
|
.. include:: ../graph_default_sem_eq_weights.rst
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
This implementation follows the Semantic Equivalence Committee Note.
|
This implementation follows the Semantic Equivalence Committee Note.
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
"""Python APIs for STIX 2 Graph-based Semantic Equivalence."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from ..object import (
|
from ..object import (
|
||||||
|
@ -36,7 +37,7 @@ def graphically_equivalent(ds1, ds2, prop_scores={}, **weight_dict):
|
||||||
Note:
|
Note:
|
||||||
Default weights_dict:
|
Default weights_dict:
|
||||||
|
|
||||||
.. include:: ../default_sem_eq_weights.rst
|
.. include:: ../../graph_default_sem_eq_weights.rst
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
This implementation follows the Semantic Equivalence Committee Note.
|
This implementation follows the Semantic Equivalence Committee Note.
|
||||||
|
@ -133,4 +134,4 @@ GRAPH_WEIGHTS.update({
|
||||||
"ds2": None,
|
"ds2": None,
|
||||||
"max_depth": 1,
|
"max_depth": 1,
|
||||||
},
|
},
|
||||||
}) #: :autodoc-skip:
|
}) # :autodoc-skip:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
"""Python APIs for STIX 2 Object-based Semantic Equivalence."""
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ def semantically_equivalent(obj1, obj2, prop_scores={}, **weight_dict):
|
||||||
Note:
|
Note:
|
||||||
Default weights_dict:
|
Default weights_dict:
|
||||||
|
|
||||||
.. include:: ../default_sem_eq_weights.rst
|
.. include:: ../../object_default_sem_eq_weights.rst
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
This implementation follows the Semantic Equivalence Committee Note.
|
This implementation follows the Semantic Equivalence Committee Note.
|
||||||
|
@ -448,4 +449,4 @@ WEIGHTS = {
|
||||||
"_internal": {
|
"_internal": {
|
||||||
"ignore_spec_version": False,
|
"ignore_spec_version": False,
|
||||||
},
|
},
|
||||||
} #: :autodoc-skip:
|
} # :autodoc-skip:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Python APIs for STIX 2 Pattern Semantic Equivalence.
|
"""Python APIs for STIX 2 Pattern Semantic Equivalence.
|
||||||
|
|
||||||
.. autosummary::
|
.. autosummary::
|
||||||
:toctree: patterns
|
:toctree: pattern
|
||||||
|
|
||||||
compare
|
compare
|
||||||
transform
|
transform
|
||||||
|
|
Loading…
Reference in New Issue