Datasets:
Tasks:
Text Classification
Sub-tasks:
multi-label-classification
Languages:
English
Size:
100K<n<1M
License:
Commit ·
6f2c008
0
Parent(s):
Update files from the datasets library (from 1.2.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.2.0
Files changed (5)
- .gitattributesAdded+27
- README.mdAdded+153
- dataset_infos.jsonAdded+1
- dummy/1.1.0/dummy_data.zipAdded+3
- jigsaw_toxicity_pred.pyAdded+128
123456789101112131415161718192021222324252627*.7z filter=lfs diff=lfs merge=lfs -text*.arrow filter=lfs diff=lfs merge=lfs -text*.bin filter=lfs diff=lfs merge=lfs -text*.bin.* filter=lfs diff=lfs merge=lfs -text*.bz2 filter=lfs diff=lfs merge=lfs -text*.ftz filter=lfs diff=lfs merge=lfs -text*.gz filter=lfs diff=lfs merge=lfs -text*.h5 filter=lfs diff=lfs merge=lfs -text*.joblib filter=lfs diff=lfs merge=lfs -text*.lfs.* filter=lfs diff=lfs merge=lfs -text*.model filter=lfs diff=lfs merge=lfs -text*.msgpack filter=lfs diff=lfs merge=lfs -text*.onnx filter=lfs diff=lfs merge=lfs -text*.ot filter=lfs diff=lfs merge=lfs -text*.parquet filter=lfs diff=lfs merge=lfs -text*.pb filter=lfs diff=lfs merge=lfs -text*.pt filter=lfs diff=lfs merge=lfs -text*.pth filter=lfs diff=lfs merge=lfs -text*.rar filter=lfs diff=lfs merge=lfs -textsaved_model/**/* filter=lfs diff=lfs merge=lfs -text*.tar.* filter=lfs diff=lfs merge=lfs -text*.tflite filter=lfs diff=lfs merge=lfs -text*.tgz filter=lfs diff=lfs merge=lfs -text*.xz filter=lfs diff=lfs merge=lfs -text*.zip filter=lfs diff=lfs merge=lfs -text*.zstandard filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153---annotations_creators:- crowdsourcedlanguage_creators:- otherlanguages:- enlicenses:- cc0-1-0multilinguality:- monolingualsize_categories:- 100K<n<1Msource_datasets:- originaltask_categories:- text-classificationtask_ids:- multi-label-classification---
# Dataset Card for [Dataset Name]
## Table of Contents- [Dataset Description](#dataset-description) - [Dataset Summary](#dataset-summary) - [Supported Tasks](#supported-tasks-and-leaderboards) - [Languages](#languages)- [Dataset Structure](#dataset-structure) - [Data Instances](#data-instances) - [Data Fields](#data-instances) - [Data Splits](#data-instances)- [Dataset Creation](#dataset-creation) - [Curation Rationale](#curation-rationale) - [Source Data](#source-data) - [Annotations](#annotations) - [Personal and Sensitive Information](#personal-and-sensitive-information)- [Considerations for Using the Data](#considerations-for-using-the-data) - [Social Impact of Dataset](#social-impact-of-dataset) - [Discussion of Biases](#discussion-of-biases) - [Other Known Limitations](#other-known-limitations)- [Additional Information](#additional-information) - [Dataset Curators](#dataset-curators) - [Licensing Information](#licensing-information) - [Citation Information](#citation-information)
## Dataset Description
- **Homepage:** [Jigsaw Comment Toxicity Classification Kaggle Competition](https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge/data)- **Repository:**- **Paper:**- **Leaderboard:**- **Point of Contact:**
### Dataset Summary
Discussing things you care about can be difficult. The threat of abuse and harassment online means that many people stop expressing themselves and give up on seeking different opinions. Platforms struggle to effectively facilitate conversations, leading many communities to limit or completely shut down user comments. This dataset consists of a large number of Wikipedia comments which have been labeled by human raters for toxic behavior.
### Supported Tasks and Leaderboards
The dataset support multi-label classification
### Languages
The comments are in English
## Dataset Structure
### Data Instances
A data point consists of a comment followed by multiple labels that can be associated with it.{'id': '02141412314', 'comment_text': 'Sample comment text', 'toxic': 0, 'severe_toxic': 0, 'obscene': 0, 'threat': 0, 'insult': 0, 'identity_hate': 1,}
### Data Fields
- `id`: id of the comment- `comment_text`: the text of the comment- `toxic`: value of 0(non-toxic) or 1(toxic) classifying the comment- `severe_toxic`: value of 0(non-severe_toxic) or 1(severe_toxic) classifying the comment- `obscene`: value of 0(non-obscene) or 1(obscene) classifying the comment- `threat`: value of 0(non-threat) or 1(threat) classifying the comment- `insult`: value of 0(non-insult) or 1(insult) classifying the comment- `identity_hate`: value of 0(non-identity_hate) or 1(identity_hate) classifying the comment
### Data Splits
The data is split into a training and testing set.
## Dataset Creation
### Curation Rationale
The dataset was created to help in efforts to identify and curb instances of toxicity online.
### Source Data
#### Initial Data Collection and Normalization
The dataset is a collection of Wikipedia comments.
#### Who are the source language producers?
[More Information Needed]
### Annotations
#### Annotation process
[More Information Needed]
#### Who are the annotators?
[More Information Needed]
### Personal and Sensitive Information
[More Information Needed]
## Considerations for Using the Data
### Social Impact of Dataset
[More Information Needed]
### Discussion of Biases
If words that are associated with swearing, insults or profanity are present in a comment, it is likely that it will be classified as toxic, regardless of the tone or the intent of the author e.g. humorous/self-deprecating. This could present some biases towards already vulnerable minority groups.
### Other Known Limitations
[More Information Needed]
## Additional Information
### Dataset Curators
[More Information Needed]
### Licensing Information
The "Toxic Comment Classification" dataset is released under [CC0], with the underlying comment text being governed by Wikipedia\'s [CC-SA-3.0].
### Citation Information
[More Information Needed]1{"default": {"description": "This dataset consists of a large number of Wikipedia comments which have been labeled by human raters for toxic behavior.\n", "citation": "", "homepage": "https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge/data", "license": "The \"Toxic Comment Classification\" dataset is released under CC0, with the underlying comment text being governed by Wikipedia's CC-SA-3.0.", "features": {"comment_text": {"dtype": "string", "id": null, "_type": "Value"}, "toxic": {"num_classes": 2, "names": ["false", "true"], "names_file": null, "id": null, "_type": "ClassLabel"}, "severe_toxic": {"num_classes": 2, "names": ["false", "true"], "names_file": null, "id": null, "_type": "ClassLabel"}, "obscene": {"num_classes": 2, "names": ["false", "true"], "names_file": null, "id": null, "_type": "ClassLabel"}, "threat": {"num_classes": 2, "names": ["false", "true"], "names_file": null, "id": null, "_type": "ClassLabel"}, "insult": {"num_classes": 2, "names": ["false", "true"], "names_file": null, "id": null, "_type": "ClassLabel"}, "identity_hate": {"num_classes": 2, "names": ["false", "true"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "builder_name": "jigsaw_toxicity_pred", "config_name": "default", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 71282358, "num_examples": 159571, "dataset_name": "jigsaw_toxicity_pred"}, "test": {"name": "test", "num_bytes": 28241991, "num_examples": 63978, "dataset_name": "jigsaw_toxicity_pred"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 99524349, "size_in_bytes": 99524349}}123version https://git-lfs.github.com/spec/v1oid sha256:95e1d17a5a1aec079fb0b836b00ab44eb9a72ab8c3322ed5c92ec6f611fbe33asize 1429123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128# coding=utf-8# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License."""Comments from Jigsaw Toxic Comment Classification Kaggle Competition """
from __future__ import absolute_import, division, print_function
import os
import pandas as pd
import datasets
_DESCRIPTION = """\This dataset consists of a large number of Wikipedia comments which have been labeled by human raters for toxic behavior."""
_HOMEPAGE = "https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge/data"
_LICENSE = 'The "Toxic Comment Classification" dataset is released under CC0, with the underlying comment text being governed by Wikipedia\'s CC-SA-3.0.'
class JigsawToxicityPred(datasets.GeneratorBasedBuilder): """This is a dataset of comments from Wikipedia’s talk page edits which have been labeled by human raters for toxic behavior."""
VERSION = datasets.Version("1.1.0")
@property def manual_download_instructions(self): return """\ To use jigsaw_toxicity_pred you have to download it manually from Kaggle: https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge/data You can manually download the data from it's homepage or use the Kaggle CLI tool (follow the instructions here: https://www.kaggle.com/docs/api) Please extract all files in one folder and then load the dataset with: `datasets.load_dataset('jigsaw_toxicity_pred', data_dir='/path/to/extracted/data/')`"""
def _info(self):
return datasets.DatasetInfo( # This is the description that will appear on the datasets page. description=_DESCRIPTION, # This defines the different columns of the dataset and their types features=datasets.Features( { "comment_text": datasets.Value("string"), "toxic": datasets.ClassLabel(names=["false", "true"]), "severe_toxic": datasets.ClassLabel(names=["false", "true"]), "obscene": datasets.ClassLabel(names=["false", "true"]), "threat": datasets.ClassLabel(names=["false", "true"]), "insult": datasets.ClassLabel(names=["false", "true"]), "identity_hate": datasets.ClassLabel(names=["false", "true"]), } ), # If there's a common (input, target) tuple from the features, # specify them here. They'll be used if as_supervised=True in # builder.as_dataset. supervised_keys=None, # Homepage of the dataset for documentation homepage=_HOMEPAGE, # License for the dataset if available license=_LICENSE, )
def _split_generators(self, dl_manager): """Returns SplitGenerators.""" # This method is tasked with downloading/extracting the data and defining the splits depending on the configuration # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
data_dir = os.path.abspath(os.path.expanduser(dl_manager.manual_dir))
if not os.path.exists(data_dir): raise FileNotFoundError( "{} does not exist. Make sure you insert a manual dir via `datasets.load_dataset('jigsaw_toxicity_pred', data_dir=...)`. Manual download instructions: {}".format( data_dir, self.manual_download_instructions ) )
return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, # These kwargs will be passed to _generate_examples gen_kwargs={"train_path": os.path.join(data_dir, "train.csv"), "split": "train"}, ), datasets.SplitGenerator( name=datasets.Split.TEST, # These kwargs will be passed to _generate_examples gen_kwargs={ "test_text_path": os.path.join(data_dir, "test.csv"), "test_labels_path": os.path.join(data_dir, "test_labels.csv"), "split": "test", }, ), ]
def _generate_examples(self, split="train", train_path=None, test_text_path=None, test_labels_path=None): """ Yields examples. """ # This method will receive as arguments the `gen_kwargs` defined in the previous `_split_generators` method. # It is in charge of opening the given file and yielding (key, example) tuples from the dataset # The key is not important, it's more here for legacy reason (legacy from tfds)
if split == "test": df1 = pd.read_csv(test_text_path) df2 = pd.read_csv(test_labels_path) df3 = df1.merge(df2) df4 = df3[df3["toxic"] != -1]
elif split == "train": df4 = pd.read_csv(train_path)
for _, row in df4.iterrows(): example = {} example["comment_text"] = row["comment_text"]
for label in ["toxic", "severe_toxic", "obscene", "threat", "insult", "identity_hate"]: if row[label] != -1: example[label] = int(row[label]) yield (row["id"], example).gitattributesAdded+27
README.mdAdded+153
dataset_infos.jsonAdded+1
dummy/1.1.0/dummy_data.zipAdded+3
jigsaw_toxicity_pred.pyAdded+128