Improve compression preset testing

Signed-off-by: Jacob Torrey <jacob@thinkst.com>
pull/11/head
Jacob Torrey 2024-02-21 12:23:46 -07:00
rodzic d121796714
commit ef2bda5e9c
2 zmienionych plików z 20 dodań i 10 usunięć

Wyświetl plik

@ -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")

Wyświetl plik

@ -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()