# set up anomaly detectors anomaly_detectors = [] ad_config = defaults.DEFAULT_KNN_CONFIG for k_value in K_VALUES: ad_config['evaluator_config']['k'] = k_value if transformation is None: if 'representation_config' in ad_config: ad_config.pop('representation_config') else: ad_config['representation_config'] = {'method': transformation} anomaly_detectors.append(anomaly_detection.create_anomaly_detector(**ad_config)) # init test test = [utils.load_sequence(TEST_FILE)] test_suite = utils.TestSuite(anomaly_detectors, K_VALUES, [test], ['test']) # execute test test_suite.evaluate(display_progress=True) # get plots results = test_suite.results utils.plots.plot_normalized_anomaly_vector_heat_map(results, K_VALUES, plot=heat_map_plot) heat_map_plot.set_title(name) heat_map_plot.set_ylabel('k') full_support_dists.append(results.get_anomaly_detector_averages(K_VALUES, 'full_support_distance')) equal_support_dists.append(results.get_anomaly_detector_averages(K_VALUES, 'equal_support_distance')) euclidean_dists.append(results.get_anomaly_detector_averages(K_VALUES, 'normalized_euclidean_distance'))
# set up anomaly detectors anomaly_detectors = [] ad_config = defaults.DEFAULT_KNN_CONFIG for k_value in K_VALUES: ad_config['evaluator_config']['k'] = k_value if transformation is None: if 'representation_config' in ad_config: ad_config.pop('representation_config') else: ad_config['representation_config'] = {'method': transformation} anomaly_detectors.append( anomaly_detection.create_anomaly_detector(**ad_config)) # init test test = [utils.load_sequence(TEST_FILE)] test_suite = utils.TestSuite(anomaly_detectors, K_VALUES, [test], ['test']) # execute test test_suite.evaluate(display_progress=True) # get plots results = test_suite.results utils.plots.plot_normalized_anomaly_vector_heat_map(results, K_VALUES, plot=heat_map_plot) heat_map_plot.set_title(name) heat_map_plot.set_ylabel('k') full_support_dists.append(