|
1 | 1 | # MAEC Distance Measure-related Classes - BETA |
2 | | -# Copyright (c) 2015, The MITRE Corporation |
| 2 | +# Copyright (c) 2018, The MITRE Corporation |
3 | 3 | # All rights reserved |
4 | 4 |
|
5 | 5 | # See LICENSE.txt for complete terms |
@@ -139,7 +139,7 @@ def create_object_vector(self, object, static_feature_dict, callback_function = |
139 | 139 | # Callback function parameters : feature name, existing feature value, new feature value |
140 | 140 | elif callback_function: |
141 | 141 | existing_value = static_feature_dict[feature_name] |
142 | | - static_feature_dict[feature_name] = callback_function(feature_name, existing_value, feature_value) |
| 142 | + static_feature_dict[feature_name] = callback_function(feature_name, existing_value, feature_value) |
143 | 143 |
|
144 | 144 | else: |
145 | 145 | static_feature_dict[feature_name] = feature_value |
@@ -251,7 +251,7 @@ def bin_list(self, numeric_value, numeric_list, n=10): |
251 | 251 | return bin_vector |
252 | 252 | max_list = max(numeric_list) |
253 | 253 | min_list = min(numeric_list) |
254 | | - bucket_size = (max_list-min_list)/n |
| 254 | + bucket_size = (max_list-min_list)/n |
255 | 255 | bin_value = int(math.floor((numeric_value - min_list)/bucket_size)) |
256 | 256 | if bin_value == n: |
257 | 257 | bin_value -= 1 |
@@ -455,7 +455,7 @@ def create_static_result_vector(self, static_vector): |
455 | 455 | bin = self.bin_list(normalized_value, normalized_items, feature_options_dict['number of bins']) |
456 | 456 | else: |
457 | 457 | bin = self.bin_list(normalized_value, normalized_items) |
458 | | - results_vector.append(bin) |
| 458 | + results_vector.append(bin) |
459 | 459 | elif normalized_value is not None: |
460 | 460 | results_vector.append(normalized_value) |
461 | 461 | else: |
@@ -580,7 +580,7 @@ def calculate(self): |
580 | 580 | self.perform_calculation() |
581 | 581 |
|
582 | 582 | def print_distances(self, file_object, default_label = 'md5', delimiter = ','): |
583 | | - '''Print the distances between the Malware Subjects in delimited matrix format |
| 583 | + '''Print the distances between the Malware Subjects in delimited matrix format |
584 | 584 | to a File-like object. |
585 | 585 |
|
586 | 586 | Try to use the MD5s of the Malware Subjects as the default label. |
@@ -611,5 +611,3 @@ def print_distances(self, file_object, default_label = 'md5', delimiter = ','): |
611 | 611 | for distance_string in distance_strings: |
612 | 612 | file_object.write(distance_string + "\n") |
613 | 613 | file_object.flush() |
614 | | - |
615 | | - |
0 commit comments