A spambayes-esque approach for 4 email categories

Amedee Van Gasse <[email protected]> Mon, 15 Apr 2024 10:29:57 +0200
Newsgroups gmane.mail.spam.spambayes.devel
Message-ID <CALhozi-mumPjaZw_EjSXEL4AnBKmtUV7=r_1r6thE8VmyWM75Q@mail.gmail.com>
--===============8936327095721506999==
Content-Type: multipart/alternative; boundary="00000000000063fd3606161e6f2a"

--00000000000063fd3606161e6f2a
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

It's been over a decade since I last used (or needed) Spambayes, but I have
good memories of it and I really liked it a lot.

I'm currently working on an idea where I think Spambayes, or a
Spambayes-like approach, may come in help.

The software I'm working with, is a local Outlook client, whatever the
current version is now in Office 365, and an on-premise Exchange server.
The OS is Windows 10.
The mailbox is a shared mailbox, not a local PST file.

There is a mail folder with 10k emails. Almost all emails have been
manually categorized and labelled:
All emails are actually a "container" email, with the original email as a
.msg attachment. As if you were doing "forward as attachment", so that all
original email headers are preserved.
Additionally there is a second attachment, headers.txt, which contains the
email headers of the original email.

The emails are labelled thus:
* Phishing (3k) -> these are emails with a direct security threat, like
password stealing
* Spam (2k) --> typical junk mail that is not a direct security threat
* Graymail (3k) --> newsletters, mails from sales people, invitations for
conferences... all somewhat relevant for our industry, but recipients just
aren't interested. This is "it's not actually spam because I subscribed a
long time ago and now I am too lazy to unsubscribe"
* False positive (0.5k) --> emails that were mistakenly reported as spam
* Uncategorized (1.5k) --> these emails have not yet been manually reviewed

I know that Spambayes works with just two buckets: spam and not-spam.
Given the number of manually categorized emails I already have, how
feasible would it be to write something similar but with 4 buckets, and to
have the emails as training data? I am not concerned with 100% accuracy,
even 80% is good enough.
Maybe I could use 4 separate databases instead of just one?

Also good to know: I haven't written anything more than Hello World in
Python, but I'm not afraid to learn.
The machine I'm working on also doesn't have any development tools and I
have no permission to install Python.
I do have another machine where I can do whatever. It is Windows 11, also
has Office, but because of security reasons it is not allowed to access
that Exchange mailbox. I guess I could export the folder to a PST and copy
that over, but that wouldn't be allowed either - not technically, but
because of policy reasons. (PII and such)

Please let me pick your brains!
If anything comes from it, I'll post my code on GitHub.

--=20
Met vriendelijke groeten / Kind regards / Med v=C3=A4nliga h=C3=A4lsningar
Amedee Van Gasse
[email protected]
amedee.be - in/amedee <https://linkedin.com/in/amedee>
+32 485 805 674

--00000000000063fd3606161e6f2a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">It&#39;s been over a decade since I last used (or needed) =
Spambayes, but I have good memories of it and I really liked it a lot.<div>=
<br></div><div>I&#39;m currently working on an idea where I think Spambayes=
, or a Spambayes-like approach, may come in help.</div><div><br></div><div>=
The software I&#39;m working with, is a local Outlook client, whatever the =
current version is now in Office 365, and an on-premise Exchange server. Th=
e OS is Windows 10.</div><div>The mailbox is a shared mailbox, not a local =
PST file.</div><div><br></div><div>There is a mail folder with 10k emails. =
Almost all emails have been manually categorized and labelled:</div><div>Al=
l emails are actually a &quot;container&quot; email, with the original emai=
l as a .msg attachment. As if you were doing &quot;forward as attachment&qu=
ot;, so that all original email headers are preserved.</div><div>Additional=
ly there is a second attachment, headers.txt, which contains the email head=
ers of the original email.</div><div><br></div><div>The emails are labelled=
 thus:</div><div>* Phishing (3k) -&gt; these are emails with a direct secur=
ity threat, like password stealing</div><div>* Spam (2k) --&gt; typical jun=
k mail that is not a direct security threat</div><div>* Graymail (3k) --&gt=
; newsletters, mails from sales people, invitations for conferences... all =
somewhat relevant for our industry, but recipients=C2=A0just aren&#39;t int=
erested. This is &quot;it&#39;s not actually spam because I subscribed a lo=
ng time ago and now I am too lazy to unsubscribe&quot;</div><div>* False po=
sitive (0.5k) --&gt; emails that were mistakenly reported as spam</div><div=
>* Uncategorized (1.5k) --&gt; these emails have not yet been manually revi=
ewed</div><div><br></div><div>I know that Spambayes works with just two buc=
kets: spam and not-spam.</div><div>Given the number of manually categorized=
 emails I already have, how feasible would it be to write something similar=
 but with 4 buckets, and to have the emails as training data? I am not conc=
erned with 100% accuracy, even 80% is good enough.</div><div>Maybe I could =
use 4 separate databases instead of just one?</div><div><br></div><div>Also=
 good to know: I haven&#39;t written anything more than Hello World in Pyth=
on, but I&#39;m not afraid to learn.</div><div>The machine I&#39;m working =
on also doesn&#39;t have any development=C2=A0tools and I have no permissio=
n to install Python.</div><div>I do have another machine where I can do wha=
tever. It is Windows 11, also has Office, but because of security reasons i=
t is not allowed to access that Exchange mailbox. I guess I could export th=
e folder to a PST and copy that over, but that wouldn&#39;t be allowed eith=
er - not technically, but because of policy reasons. (PII and such)</div><d=
iv><br></div><div>Please let me pick your brains!</div><div>If anything com=
es from it, I&#39;ll post my code on GitHub.<br clear=3D"all"><div><br></di=
v><span class=3D"gmail_signature_prefix">-- </span><br><div dir=3D"ltr" cla=
ss=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr">=
<div>Met vriendelijke groeten / Kind regards / Med v=C3=A4nliga h=C3=A4lsni=
ngar</div><div>Amedee Van Gasse<br><a href=3D"mailto:[email protected]" ta=
rget=3D"_blank">[email protected]</a></div><div><a href=3D"https://amedee.=
be" target=3D"_blank">amedee.be</a>=C2=A0- <a href=3D"https://linkedin.com/=
in/amedee" target=3D"_blank">in/amedee</a></div><div>+32 485 805 674<br></d=
iv></div></div></div></div>

--00000000000063fd3606161e6f2a--

--===============8936327095721506999==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
spambayes-dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/spambayes-dev

--===============8936327095721506999==--