--- license: mit task_categories: - text-classification language: - id tags: - hate-speech-detection - abusive-language - text-classification - indonesian - social-media - nlp - content-moderation - multi-label-classification size_categories: - 10K Moderate (12.9%) > Strong (3.6%) ## Use Cases This dataset is ideal for: - **Multi-label Text Classification**: Train models to detect multiple types of hate speech - **Indonesian NLP**: Develop language-specific content moderation systems - **Social Media Monitoring**: Build automated detection for Indonesian platforms - **Severity Assessment**: Create models that classify hate speech intensity - **Target Analysis**: Understand different targets of hate speech - **Content Moderation**: Deploy real-time filtering systems - **Research**: Study hate speech patterns in Indonesian social media ## Quick Start ```python import pandas as pd from sklearn.model_selection import train_test_split from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.multioutput import MultiOutputClassifier from sklearn.linear_model import LogisticRegression from sklearn.metrics import classification_report # Load dataset df = pd.read_csv('data.csv') # Prepare features and targets X = df['Tweet'] y = df[['HS', 'Abusive', 'HS_Individual', 'HS_Group', 'HS_Religion', 'HS_Race', 'HS_Physical', 'HS_Gender', 'HS_Other']] # Split data X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.2, random_state=42 ) # Vectorize text vectorizer = TfidfVectorizer(max_features=10000, ngram_range=(1, 2)) X_train_vec = vectorizer.fit_transform(X_train) X_test_vec = vectorizer.transform(X_test) # Train multi-label classifier classifier = MultiOutputClassifier(LogisticRegression(random_state=42)) classifier.fit(X_train_vec, y_train) # Evaluate y_pred = classifier.predict(X_test_vec) print("Multi-label Classification Report:") for i, label in enumerate(y.columns): print(f"\n{label}:") print(classification_report(y_test.iloc[:, i], y_pred[:, i])) ``` ## Advanced Usage Examples ### Intensity-Based Classification ```python # Focus on hate speech intensity levels intensity_labels = ['HS_Weak', 'HS_Moderate', 'HS_Strong'] hate_speech_data = df[df['HS'] == 1] # Only hate speech samples # Multi-class intensity classification y_intensity = hate_speech_data[intensity_labels] ``` ### Target-Specific Models ```python # Build specialized models for different targets target_labels = ['HS_Individual', 'HS_Group', 'HS_Religion', 'HS_Race', 'HS_Physical', 'HS_Gender', 'HS_Other'] # Train target-specific classifiers for target in target_labels: # Create binary classifier for each target type pass ``` ### Indonesian Text Preprocessing ```python import re def preprocess_indonesian_text(text): # Convert to lowercase text = text.lower() # Remove URLs text = re.sub(r'http\S+|www\S+|https\S+', '', text, flags=re.MULTILINE) # Remove user mentions and RT text = re.sub(r'@\w+|rt\s+', '', text) # Remove extra whitespace text = re.sub(r'\s+', ' ', text).strip() return text # Apply preprocessing df['Tweet_processed'] = df['Tweet'].apply(preprocess_indonesian_text) ``` ## Model Architecture Suggestions ### Traditional ML - **TF-IDF + Logistic Regression**: Baseline multi-label classifier - **TF-IDF + SVM**: Better performance on imbalanced classes - **Ensemble Methods**: Random Forest or Gradient Boosting ### Deep Learning - **BERT-based Models**: Use Indonesian BERT (IndoBERT) for better performance - **Multilingual Models**: mBERT or XLM-R for cross-lingual transfer - **Custom Architecture**: BiLSTM + Attention for sequence modeling ### Multi-task Learning ```python # Hierarchical classification approach # 1. First classify: Normal vs Abusive vs Hate Speech # 2. If Hate Speech: Classify target and intensity # 3. Multi-task loss combining all objectives ``` ## Evaluation Metrics Given the multi-label and imbalanced nature: ### Primary Metrics - **F1-Score**: Macro and micro averages - **AUC-ROC**: For each label separately - **Hamming Loss**: Multi-label specific metric - **Precision/Recall**: Per-label analysis ### Specialized Metrics ```python from sklearn.metrics import multilabel_confusion_matrix, jaccard_score # Multi-label specific metrics jaccard = jaccard_score(y_true, y_pred, average='macro') hamming = hamming_loss(y_true, y_pred) ``` ## Data Quality & Considerations ### Strengths - ✅ **Comprehensive Labeling**: Multiple dimensions of hate speech - ✅ **Large Scale**: 13K+ samples for robust training - ✅ **Real-world Data**: Actual Indonesian tweets - ✅ **Intensity Levels**: Enables nuanced classification - ✅ **Multiple Targets**: Covers various hate speech types ### Limitations - ⚠️ **Class Imbalance**: Some categories <5% positive samples - ⚠️ **Language Specific**: Limited to Indonesian context - ⚠️ **Temporal Bias**: Tweet collection timeframe not specified - ⚠️ **Cultural Context**: May not generalize across Indonesian regions ## Ethical Considerations **Content Warning**: This dataset contains hate speech and abusive language examples. ### Responsible Use - **Research Purpose**: Intended for academic and safety research - **Content Moderation**: Building protective systems - **Bias Awareness**: Monitor for demographic biases in predictions - **Privacy**: Tweets should be handled according to platform policies ### Not Suitable For - Training generative models that could amplify hate speech - Creating offensive content detection without human oversight - Commercial use without proper ethical review ## Related Work & Benchmarks ### Indonesian NLP Resources - **IndoBERT**: Pre-trained Indonesian BERT model - **Indonesian Sentiment**: Related sentiment analysis datasets - **Multilingual Models**: Cross-lingual hate speech detection ### Benchmark Performance Consider comparing against: - Traditional ML baselines (TF-IDF + SVM) - Pre-trained language models (mBERT, IndoBERT) - Multi-task learning approaches ## Citation ```bibtex @dataset{indonesian_hate_speech_2025, title={Indonesian Hate Speech Detection Dataset}, year={2025}, publisher={Dataset From Kaggle}, url={https://huggingface.co/datasets/nahiar/indonesian-hate-speech}, note={Multi-label hate speech and abusive language detection for Indonesian social media} } ``` ## Acknowledgments This dataset contributes to safer Indonesian social media environments and supports research in: - Multilingual content moderation - Southeast Asian NLP - Cross-cultural hate speech patterns - Social media safety systems **Note**: Handle this sensitive content responsibly and in accordance with ethical AI principles.