diff --git a/preset_plot_rocs.py b/preset_plot_rocs.py index 9aa742a..bf9fa7d 100644 --- a/preset_plot_rocs.py +++ b/preset_plot_rocs.py @@ -79,7 +79,7 @@ for preset in PRESETS: roc_auc = auc(fpr, tpr) # Plot the ROC curve - plt.plot(fpr, tpr, lw=2, label=f'{MODEL.capitalize()}-{preset}: ROC curve (%Acc = {tp/len(cases):0.2f}; AUC = {roc_auc:0.2f})') + plt.plot(fpr, tpr, lw=2, label=f'{MODEL.split("-")[1].capitalize()}-{preset}: ROC curve (%Acc = {tp/len(cases):0.2f}; AUC = {roc_auc:0.2f})') plt.scatter(fpr[ix], tpr[ix], marker='o', color='black')#, label=model.capitalize() + ': Best @ threshold = %0.2f' % thresholds[ix]) plt.plot([0, 1], [0, 1], color='navy', lw=2, linestyle='--', label="Random classifier") diff --git a/test_zippy_detect.py b/test_zippy_detect.py index 1c098b5..af87622 100644 --- a/test_zippy_detect.py +++ b/test_zippy_detect.py @@ -17,20 +17,30 @@ human_files = os.listdir(HUMAN_SAMPLE_DIR) CONFIDENCE_THRESHOLD : float = 0.00 # What confidence to treat as error vs warning # Bool on whether to ensemble the models or run a single model -ENSEMBLE = True +ENSEMBLE = False if not ENSEMBLE: # What compression engine to use for the test ENGINE = CompressionEngine.LZMA - if ENGINE == CompressionEngine.LZMA: - PRELUDE_RATIO = LzmaLlmDetector(prelude_str=PRELUDE_STR).prelude_ratio - elif ENGINE == CompressionEngine.ZLIB: - PRELUDE_RATIO = ZlibLlmDetector(prelude_str=PRELUDE_STR).prelude_ratio - elif ENGINE == CompressionEngine.BROTLI: - PRELUDE_RATIO = BrotliLlmDetector(prelude_str=PRELUDE_STR).prelude_ratio - - zippy = Zippy(ENGINE) + if os.environ.get('ZIPPY_PRESET') != None: + if ENGINE == CompressionEngine.LZMA: + PRELUDE_RATIO = LzmaLlmDetector(prelude_str=PRELUDE_STR, preset=int(os.environ.get('ZIPPY_PRESET'))).prelude_ratio + elif ENGINE == CompressionEngine.ZLIB: + PRELUDE_RATIO = ZlibLlmDetector(prelude_str=PRELUDE_STR, preset=int(os.environ.get('ZIPPY_PRESET'))).prelude_ratio + elif ENGINE == CompressionEngine.BROTLI: + PRELUDE_RATIO = BrotliLlmDetector(prelude_str=PRELUDE_STR, preset=int(os.environ.get('ZIPPY_PRESET'))).prelude_ratio + else: + if ENGINE == CompressionEngine.LZMA: + PRELUDE_RATIO = LzmaLlmDetector(prelude_str=PRELUDE_STR).prelude_ratio + elif ENGINE == CompressionEngine.ZLIB: + PRELUDE_RATIO = ZlibLlmDetector(prelude_str=PRELUDE_STR).prelude_ratio + elif ENGINE == CompressionEngine.BROTLI: + PRELUDE_RATIO = BrotliLlmDetector(prelude_str=PRELUDE_STR).prelude_ratio + if os.environ.get('ZIPPY_PRESET') != None: + zippy = Zippy(ENGINE, preset=int(os.environ.get('ZIPPY_PRESET'))) + else: + zippy = Zippy(ENGINE) else: zippy = EnsembledZippy()