Skip to content

Commit

Permalink
Improve compression preset testing
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Torrey <[email protected]>
  • Loading branch information
ranok committed Feb 21, 2024
1 parent d121796 commit ef2bda5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion preset_plot_rocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
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")
Expand Down
28 changes: 19 additions & 9 deletions test_zippy_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,30 @@
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()
Expand Down

0 comments on commit ef2bda5

Please sign in to comment.