Instructions to use Skibidibois2000/spam-detection-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use Skibidibois2000/spam-detection-model with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("Skibidibois2000/spam-detection-model", "sklearn_model.joblib") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Spam Detection Model
TF-IDF + Random Forest classifier for English email and SMS spam.
Model
| Algorithm | Random Forest (100 trees, class_weight=balanced) |
| Features | TF-IDF, 3000 unigrams, min_df=2 |
| Training rows | 235,449 |
| F1 (random split) | 0.974 |
| Language | English only |
Files
| file | description |
|---|---|
model_parts/part_aa .. part_ay |
the model, split into 25 parts |
confusion_matrix.png |
confusion matrix on the test split |
skeleton.py |
training script |
The model is stored as 25 parts because a single-file upload of 232 MB was cut
off mid-transfer. Each part is a byte-range chunk of spam_model.joblib.gz.
How to load
import gzip, joblib
parts = [f"model_parts/part_{s}" for s in
["aa","ab","ac","ad","ae","af","ag","ah","ai","aj",
"ak","al","am","an","ao","ap","aq","ar","as","at",
"au","av","aw","ax","ay"]]
blob = b"".join(
hf_hub_download("Skibidibois2000/spam-detection-model", p)
for p in parts
)
bundle = joblib.load(gzip.decompress(blob))
prob = bundle["model"].predict_proba(
bundle["vectorizer"].transform(["your message"])
)[0][1]
print("SPAM" if prob >= bundle["threshold"] else "HAM")
With the huggingface_hub library:
from huggingface_hub import hf_hub_download
Note on reported accuracy
The 0.974 F1 comes from a random 80/20 split, which places near-duplicate messages from the same corpus on both sides. Treat it as an optimistic figure.