INNER CODE UNIT · Python
get_accepted_mappings
center-for-threat-informed-defense/tram · src/tram/models.py:176
def get_accepted_mappings(cls):
# Get Attack techniques that have the required amount of positive examples
attack_objects = AttackObject.get_sentence_counts(
accept_threshold=config.ML_ACCEPT_THRESHOLD
)
# Get mappings for the attack techniques above threshold
mappings = Mapping.objects.filter(attack_object__in=attack_objects)
return mappings
class MLSettings(models.Model):
"""Settings for Machine Learning models"""
def _delete_file(path):
# Deletes file from filesystem
if os.path.isfile(path):
os.remove(path)