diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-06-30 16:05:09 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2024-06-30 16:05:09 +0100 |
commit | 63f0ffe317038a34fa8467f03ef9e9c43161d1bd (patch) | |
tree | bcbdd0a680c1f8441606ad92342cd81e20135a05 /lualib | |
parent | 7c5504251e9fbb943d93b886b558c0e1b3fc4760 (diff) | |
download | rspamd-63f0ffe317038a34fa8467f03ef9e9c43161d1bd.tar.gz rspamd-63f0ffe317038a34fa8467f03ef9e9c43161d1bd.zip |
[Minor] Log FP and FN
Diffstat (limited to 'lualib')
-rw-r--r-- | lualib/rspamadm/classifier_test.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lualib/rspamadm/classifier_test.lua b/lualib/rspamadm/classifier_test.lua index 4e001bf17..4148a7538 100644 --- a/lualib/rspamadm/classifier_test.lua +++ b/lualib/rspamadm/classifier_test.lua @@ -90,7 +90,7 @@ local function train_classifier(files, command) end -- Function to classify files and return results -local function classify_files(files) +local function classify_files(files, known_spam_files, known_ham_files) local fname = os.tmpname() list_to_file(files, fname) @@ -118,7 +118,13 @@ local function classify_files(files) if symbols[opts.spam_symbol] then table.insert(results, { result = "spam", file = file }) + if known_ham_files[file] then + rspamd_logger.message("FP: %s is classified as spam but is known ham", file) + end elseif symbols[opts.ham_symbol] then + if known_spam_files[file] then + rspamd_logger.message("FN: %s is classified as ham but is known spam", file) + end table.insert(results, { result = "ham", file = file }) end end @@ -216,7 +222,7 @@ local function handler(args) print(string.format("Start cross validation, %d messages, %d connections", #cv_files, opts.nconns)) -- Get classification results local t = rspamd_util.get_time() - local results = classify_files(cv_files) + local results = classify_files(cv_files, known_spam_files, known_ham_files) local elapsed = rspamd_util.get_time() - t -- Evaluate results |