--- license: cc0-1.0 pretty_name: Jigsaw Toxic Comment Classification (2017–2018 Kaggle release) task_categories: - text-classification language: - en size_categories: - 100K= 0 ``` That yields 63,978 scoring rows out of the 153,164 raw test rows. ## How to use Load with the `datasets` library: ```python from datasets import load_dataset train = load_dataset("Heliosoph/Jigsaw-Toxic-Comments", data_files="train.csv.gz", split="train") print(train[0]) # {'id': '0000997932d777bf', # 'comment_text': "Explanation\nWhy the edits made under my username...", # 'toxic': 0, 'severe_toxic': 0, 'obscene': 0, # 'threat': 0, 'insult': 0, 'identity_hate': 0} ``` Or read the CSVs directly with pandas — the `test` and `test_labels` files want a join + filter: ```python import pandas as pd train = pd.read_csv("train.csv.gz", compression="gzip") print(train.shape) # (159571, 8) print(train[["toxic","severe_toxic","obscene","threat","insult","identity_hate"]].sum()) test_text = pd.read_csv("test.csv.gz", compression="gzip") test_labels = pd.read_csv("test_labels.csv.gz", compression="gzip") test = test_text.merge(test_labels, on="id") test = test[test["toxic"] >= 0] # drop the -1 (excluded-from-scoring) rows print(test.shape) # (63978, 8) ``` ## Dataset specs | | Spec | |---|---| | Train rows | 159,571 | | Test rows (raw) | 153,164 | | Test rows (scored, after filtering `-1`) | 63,978 | | Label columns | 6 binary flags (toxic, severe_toxic, obscene, threat, insult, identity_hate) | | Label cardinality | ~10% of train rows carry at least one flag | | Encoding | UTF-8 | | Format | CSV with header, RFC-4180-style quoting | | Compressed size | ~48 MB total across the three files | | Uncompressed size | ~131 MB total | | Average comment length | ~395 characters / ~70 words | | Max comment length | ~5,000 characters — exercises the tail of most encoders' context windows | | Language | English | | Domain | Wikipedia talk-page discussion | ## When to pick Jigsaw Toxic Comments - **Multi-label text classification**: each comment can carry any combination of six independent flags. A genuine multi-label problem (with strong label correlations) rather than a one-hot multi-class proxy. - **Embedding-classifier evaluation**: encode comments with a sentence encoder, train a small classifier head per label, report per-label and macro F1 against the 64k scored test rows. Comparable to dozens of published encoder benchmarks. - **Content-moderation prototyping**: 160k labelled training rows fits comfortably in memory and fine-tunes a small encoder end-to-end on a single GPU in under an hour. - **Imbalanced-classification practice**: severe_toxic, threat, and identity_hate are all <1% positive in the training set — exercises threshold calibration, focal loss, oversampling, and other long-tail tricks. For pure sentence-similarity / paraphrase evaluation, reach for **Quora Question Pairs** instead — labelled pair structure, not multi-label per-row classification. ## Label notes The six labels are independent, not mutually exclusive. They are also noisy: each comment was rated by multiple annotators and the binary flags collapse those ratings into a majority-vote decision, which makes the rare-class labels (`severe_toxic`, `threat`, `identity_hate`) particularly thin and disputed. The community reports macro-F1 in the 0.55–0.75 range for strong models, vs >0.99 ROC-AUC on the dominant `toxic` axis — the headline ROC-AUC numbers from the Kaggle leaderboard look stronger than the per-label classification difficulty actually is. ## Companion competitions (not in this repo) Three follow-up Jigsaw competitions reuse this same multi-label shape against different corpora: - [Jigsaw Unintended Bias in Toxicity Classification](https://www.kaggle.com/competitions/jigsaw-unintended-bias-in-toxicity-classification) (2019) — 1.8M Civil Comments with identity-subgroup attributes. - [Jigsaw Multilingual Toxic Comment Classification](https://www.kaggle.com/competitions/jigsaw-multilingual-toxic-comment-classification) (2020) — train English, test 6 other languages. - [Jigsaw Rate Severity of Toxic Comments](https://www.kaggle.com/competitions/jigsaw-toxic-severity-rating) (2021) — pairwise severity ranking. This mirror covers only the original 2017–2018 release. ## License **CC0 1.0 Universal** — released by Jigsaw under the public-domain dedication on the original Kaggle competition page. Permits any use — research, commercial, redistribution, derivative works — with no attribution requirement, though attribution to Jigsaw and to Wikipedia remains good practice for traceability. - Kaggle competition: [Jigsaw Toxic Comment Classification Challenge](https://www.kaggle.com/competitions/jigsaw-toxic-comment-classification-challenge) - Jigsaw: [jigsaw.google.com](https://jigsaw.google.com/) - Underlying comments: Wikipedia talk-page revision history