Commit graph

4 commits

Author SHA1 Message Date
abp
e196f8f8e4
add tensorflow cpu backend as fallback for webgl backend
When the webgl backend is not available or unsupported,
we fall back to the tensorflow cpu backend.

Tensorflow cpu backend library review by abp and jhm.

Co-authored-by: jomapp <17314077+jomapp@users.noreply.github.com>
2025-11-20 16:06:18 +01:00
das
23983f8d4b
Fix can't access property "isTypedArray" for customers without Feature
When customers that do not have the SpamClientClassification feature are
attempting to vectorize e-mails, they ran into the error because the
env platform was not set, this was being set asynchronously by a
setTimeout, which had no time to be properly set, now we're explicitly
setting it during hashing if it has not been set yet.

Co-authored-by: abp <abp@tutao.de>
2025-11-19 16:23:27 +01:00
map
5293be6a4a
Implement spam training data sync and add TutanotaModelV98
We sync the spam training data encrypted through our server to make
sure that all clients for a specific user behave the same when
classifying mails. Additionally, this enables the spam classification
in the webApp. We compress the training data vectors
(see clientSpamTrainingDatum) before uploading to our server using
SparseVectorCompressor.ts. When a user has the ClientSpamClassification
enabled, the spam training data sync will happen for every mail
received.

ClientSpamTrainingDatum are not stored in the CacheStorage.
No entityEvents are emitted for this type.
However, we retrieve creations and updates for ClientSpamTrainingData
through the modifiedClientSpamTrainingDataIndex.

We calculate a threshold per classifier based on the dataset ham to spam
ratio, we also subsample our training data to cap the ham to spam ratio
within a certain limit.

Co-authored-by: jomapp <17314077+jomapp@users.noreply.github.com>
Co-authored-by: das <das@tutao.de>
Co-authored-by: abp <abp@tutao.de>
Co-authored-by: Kinan <104761667+kibibytium@users.noreply.github.com>
Co-authored-by: sug <sug@tutao.de>
Co-authored-by: nif <nif@tutao.de>
Co-authored-by: map <mpfau@users.noreply.github.com>
2025-11-18 13:56:19 +01:00
das
d76fcc6775
Add tensorflow.js library
Reviewed by jhm, abp, das.

The library is added to support training a spam classification model on
client. A custom rollupTensorFlow was created to only use the needed
methods on the final file, which also has multiple stubs which remove
code which is unwanted such as Requests.

Co-authored-by: jhm <17314077+jomapp@users.noreply.github.com>
Co-authored-by: abp <abp@tutao.de>
2025-10-22 09:25:20 +02:00