Skip to main content

Fast Rust-based anti-spam inference engine for email classification

Project description

plp-antispam-rust

Fast Rust-based anti-spam inference engine for email classification, achieving 10x speedup over pure Python with 99.9% accuracy.

Features

  • High Performance: 2,300+ emails/second inference speed (vs 220 emails/s in Python)
  • Production Ready: 99.9% accuracy on real-world spam datasets
  • Cross-Platform: Works on Linux, macOS (Intel/ARM), and Windows
  • Python 3.9+: Compatible with Python 3.9, 3.10, 3.11, 3.12, 3.13+ (abi3 stable ABI)
  • Zero Dependencies: Self-contained binary wheels, no external dependencies

Installation

pip install plp-antispam-rust

Usage

import plpas
from plpas import RustEnsemble

# Load pre-trained models
ensemble = RustEnsemble.load("path/to/models")

# Predict single email
prediction = ensemble.predict(["email text here"])
print(f"Spam probability: {prediction[0]}")

# Batch prediction (faster)
emails = ["email 1", "email 2", "email 3"]
predictions = ensemble.predict(emails)

Architecture

4-model stacked ensemble:

  • Model 1: Naive Bayes + Word Unigrams
  • Model 2: Logistic Regression + Word Bigrams
  • Model 3: SVM + Character Trigrams
  • Model 4: XGBoost + Word 1-2 Grams
  • Meta-Classifier: Logistic Regression with StandardScaler

All models are pre-trained and exported to MessagePack format for fast Rust deserialization.

Performance

Implementation Speed (emails/s) Accuracy
Python (sklearn) 220 99.93%
Rust (this package) 2,311 99.90%
Speedup 10.5x -0.03%

License

MIT

Author

Paul Lucian Pinzariu

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

plp_antispam_rust-1.0.3-cp39-abi3-win_amd64.whl (785.7 kB view details)

Uploaded CPython 3.9+Windows x86-64

plp_antispam_rust-1.0.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (917.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

plp_antispam_rust-1.0.3-cp39-abi3-macosx_11_0_arm64.whl (773.9 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

plp_antispam_rust-1.0.3-cp39-abi3-macosx_10_12_x86_64.whl (851.3 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file plp_antispam_rust-1.0.3-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for plp_antispam_rust-1.0.3-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 5781b5bc9d996f09dec04712c3bb2a8942d99d9b3df28faec642bfaa975f2f79
MD5 b16254f49538e34477c8b62efcc40fa7
BLAKE2b-256 b4948fed88173045c34b3386e1dfb54184076e0963adc2f52be1f75f32ba262d

See more details on using hashes here.

File details

Details for the file plp_antispam_rust-1.0.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for plp_antispam_rust-1.0.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 92bf74871ed28876659ce1f7cab422f042de2aa4ddd33f080a4f7e4070cf7a79
MD5 035e8520ed3b71e65c181859f72f0b0d
BLAKE2b-256 c6109da94dc621bd1db86e2787fb37bdb0d1957c5a5585c83af081d3c5411184

See more details on using hashes here.

File details

Details for the file plp_antispam_rust-1.0.3-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for plp_antispam_rust-1.0.3-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 06e384b6135132639d93172e4350f3e6611fce49d72a36a92ba16289d5888bb1
MD5 33a418a8a73ee4a38ae0854811b2cbea
BLAKE2b-256 07260ba5d2ec8bec977598f34516373ad6a8d3d22d6e59508c661f1afe974a3e

See more details on using hashes here.

File details

Details for the file plp_antispam_rust-1.0.3-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for plp_antispam_rust-1.0.3-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a5c8144f0077aa6dbc63ddd2e85a64552cd42750479be4742b4a1f801f7535db
MD5 44177af56656bad1850a8f97d89619d4
BLAKE2b-256 dfafe6282295f99bc0ae9260fed29fc3d7518da1b7920c5b3279c8a8b22b868c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page