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.1-cp39-abi3-win_amd64.whl (779.9 kB view details)

Uploaded CPython 3.9+Windows x86-64

plp_antispam_rust-1.0.1-cp39-abi3-manylinux_2_24_x86_64.whl (906.2 kB view details)

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

plp_antispam_rust-1.0.1-cp39-abi3-macosx_11_0_arm64.whl (766.6 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

plp_antispam_rust-1.0.1-cp39-abi3-macosx_10_12_x86_64.whl (840.4 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

File hashes

Hashes for plp_antispam_rust-1.0.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ec1c9d6b44e9d56fd86e3401994cb4bf7f9dbae8f6105b5f05c3e8565d81e9e2
MD5 3c70c87fdf4eb833bdec549109716b4e
BLAKE2b-256 f4513b3b8181fba0a28c72580aea500a020cef33606288f31c674e2a4fdc5e66

See more details on using hashes here.

File details

Details for the file plp_antispam_rust-1.0.1-cp39-abi3-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for plp_antispam_rust-1.0.1-cp39-abi3-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e1ef407c6a3fd302b170010d41369e8da29c88873cc148ec131aada92d8e1f35
MD5 917cf633d0938dcc54ccf5257d4d9075
BLAKE2b-256 a3bb2cdef136e053a8805edde3a17e95dc513a32d6d0c07aaefb8aeba3177d7e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for plp_antispam_rust-1.0.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d141c32cdebce909b7010eb5d6bd3a068cc64d3a4b225a6d9cf45e24a7c99740
MD5 98187f880ad511d6ff80721eddea3df2
BLAKE2b-256 230d4e9b2574ebed1fc19c001a6b592c01d1f59e3965f24ce83f1ca59c736adc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for plp_antispam_rust-1.0.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3ddbf3cbcd08a12b9594057c42046f4bee360684df958b6c7eb8f2c8d3963a8f
MD5 03b2cafa3da81849f46487801aa023fc
BLAKE2b-256 790590760eb253a9017dd73b1ede86587d68cd5b9fb7ffa1b12e8fcc4f651e19

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