tdavidson/hate_speech_offensive
Viewer • Updated • 24.8k • 3.77k • 42
How to use Merikatori/hate-speech-knn with Scikit-learn:
from huggingface_hub import hf_hub_download
import joblib
model = joblib.load(
hf_hub_download("Merikatori/hate-speech-knn", "sklearn_model.joblib")
)
# only load pickle files from sources you trust
# read more about it here https://skops.readthedocs.io/en/stable/persistence.htmlKNN classifier cho bài toán phân loại hate speech trên Twitter.
all-MiniLM-L6-v2 (384 chiều)| Metric | Score |
|---|---|
| Accuracy | 0.8574 |
| Macro F1 | 0.6396 |
| Weighted F1 | 0.8437 |
import joblib
from huggingface_hub import hf_hub_download
path = hf_hub_download(repo_id="Merikatori/hate-speech-knn", filename="knn_pipeline.pkl")
pipeline = joblib.load(path)
# Predict
knn = pipeline['knn']
# (cần chạy feature extraction trước — xem gradio_demo.py)