Downloads · 30 days
0
nahiar/tiktok-bot-detection
tiktok-bot-detection is a machine learning model from nahiar. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for scikit-learn. The card lists the license as apache-2.0.
This directory contains a trained Random Forest classifier for detecting bot accounts on Tiktok.
Downloads · 30 days
0
Access
Public
Updated Nov 27, 2025
Repo size
5.2 MB
Likes
0
Public
Click a slice to open those files.
.pkl3.9 MB · 69%
From the Hugging Face model README
This directory contains a trained Random Forest classifier for detecting bot accounts on Tiktok.
Model Version: v2 Training Date: 2025-11-27 11:38:35 Framework: scikit-learn 1.5.2 Algorithm: Random Forest Classifier with GridSearchCV Hyperparameter Tuning
| Metric | Score |
|---|---|
| Accuracy | 0.9295 (92.95%) |
| Precision | 0.9330 (93.30%) |
| Recall | 0.9489 (94.89%) |
| F1-Score | 0.9408 (94.08%) |
| ROC-AUC | 0.9754 (97.54%) |
| Average Precision | 0.9820 (98.20%) |
| File | Description |
|---|---|
tiktok_bot_detection_v2.pkl | Trained Random Forest model |
tiktok_scaler_v2.pkl | MinMaxScaler for feature normalization |
tiktok_features_v2.json | List of features used by the model |
tiktok_metrics_v2.txt | Detailed performance metrics report |
images/ | All visualization plots (13 images) |
README.md | This file |
Training Set:
Test Set:
IsPrivateIsVerifiedHasProfilePicFollowingCountFollowerCountHasInstagramHasYoutubeHasBioHasLinkInBioHasPostsPostsCountFollowToFollowerRatioTotal combinations tested: 540
All visualizations are saved in the images/ directory:
import joblib
import pandas as pd
import numpy as np
# Load model and scaler
model = joblib.load('tiktok_bot_detection_v2.pkl')
scaler = joblib.load('tiktok_scaler_v2.pkl')
# Prepare your data (example)
data = {
'IsPrivate': 0.5,
'IsVerified': 0.5,
'HasProfilePic': 0.5,
'FollowingCount': 0.5,
'FollowerCount': 0.5,
'HasInstagram': 0.5,
'HasYoutube': 0.5,
'HasBio': 0.5,
'HasLinkInBio': 0.5,
'HasPosts': 0.5,
'PostsCount': 0.5,
'FollowToFollowerRatio': 0.5,
}
# Create DataFrame
df = pd.DataFrame([data])
# Scale features
df_scaled = scaler.transform(df)
# Predict
prediction = model.predict(df_scaled)[0]
probability = model.predict_proba(df_scaled)[0]
print(f"Prediction: {'Bot' if prediction == 1 else 'Human'}")
print(f"Bot Probability: {probability[1]:.4f}")
print(f"Human Probability: {probability[0]:.4f}")
Predicted
Human Bot
Actual Human 220 24
Bot 18 334
To retrain the model:
../data/train_tiktok.csv5_enhanced_training.ipynbFor questions or issues regarding this model, please refer to the main project documentation.
Generated: 2025-11-27 11:38:35
Notebook: 5_enhanced_training.ipynb
Platform: Tiktok