argilla/go_emotions_raw
收藏数据集卡片 for go_emotions_raw
数据集描述
-
数据集概述:该数据集包含go_emotions的原始版本,作为一个
FeedbackDataset。每个原始问题被定义为一个单独的FeedbackRecord,并包含每个标注者的responses。简化版本数据集中的最终标签被用作suggestions,以便我们可以使用此数据集展示标注者之间的一致性以及responses与suggestions的指标。 -
数据集内容:
- 一个符合Argilla数据集格式的配置文件
argilla.yaml。 - 与HuggingFace
datasets兼容的数据集记录。 - 用于构建和整理数据集的标注指南(如果已在Argilla中定义)。
- 一个符合Argilla数据集格式的配置文件
加载数据集
使用Argilla加载
python import argilla as rg
ds = rg.FeedbackDataset.from_huggingface("argilla/go_emotions_raw")
使用datasets库加载
python from datasets import load_dataset
ds = load_dataset("argilla/go_emotions_raw")
支持的任务和排行榜
该数据集可以包含多个字段、问题和响应,因此可以用于不同的NLP任务,具体取决于配置。数据集结构在数据集结构部分描述。
该数据集没有关联的排行榜。
数据集结构
数据在Argilla中的结构
数据集在Argilla中包含以下部分:
-
字段(Fields):
text:类型为FieldTypes.text。
-
问题(Questions):
label:类型为QuestionTypes.multi_label_selection,允许的值包括[admiration, amusement, anger, annoyance, approval, caring, confusion, curiosity, desire, disappointment, disapproval, disgust, embarrassment, excitement, fear, gratitude, grief, joy, love, nervousness, optimism, pride, realization, relief, remorse, sadness, surprise, neutral]。
-
建议(Suggestions):
label-suggestion:类型为QuestionTypes.multi_label_selection,允许的值与label相同。
-
元数据(Metadata):
- 可选字段,用于提供数据记录的额外信息。
-
外部ID(external_id):
- 可选字段,用于提供数据记录的外部ID。
数据实例
在Argilla中的数据实例示例如下:
json { "external_id": null, "fields": { "text": " "If you donu0027t wear BROWN AND ORANGE...YOU DONu0027T MATTER!" We need a tshirt with that on it asap! " }, "metadata": {}, "responses": [ { "status": "submitted", "user_id": "00000000-0000-0000-0000-000000000001", "values": { "label": { "value": [ "neutral" ] } } }, { "status": "submitted", "user_id": "00000000-0000-0000-0000-000000000016", "values": { "label": { "value": [ "anger", "annoyance", "optimism" ] } } }, { "status": "submitted", "user_id": "00000000-0000-0000-0000-000000000028", "values": { "label": { "value": [ "approval" ] } } }, { "status": "submitted", "user_id": "00000000-0000-0000-0000-000000000039", "values": { "label": { "value": [ "neutral" ] } } }, { "status": "submitted", "user_id": "00000000-0000-0000-0000-000000000048", "values": { "label": { "value": [ "annoyance" ] } } } ], "suggestions": [ { "agent": null, "question_name": "label", "score": null, "type": "human", "value": [ "annoyance", "neutral" ] } ], "vectors": {} }
在HuggingFace datasets中的数据实例示例如下:
json { "external_id": null, "label": [ { "status": "submitted", "user_id": "00000000-0000-0000-0000-000000000001", "value": [ "neutral" ] }, { "status": "submitted", "user_id": "00000000-0000-0000-0000-000000000016", "value": [ "anger", "annoyance", "optimism" ] }, { "status": "submitted", "user_id": "00000000-0000-0000-0000-000000000028", "value": [ "approval" ] }, { "status": "submitted", "user_id": "00000000-0000-0000-0000-000000000039", "value": [ "neutral" ] }, { "status": "submitted", "user_id": "00000000-0000-0000-0000-000000000048", "value": [ "annoyance" ] } ], "label-suggestion": [ "annoyance", "neutral" ], "label-suggestion-metadata": { "agent": null, "score": null, "type": "human" }, "metadata": "{}", "text": " "If you donu0027t wear BROWN AND ORANGE...YOU DONu0027T MATTER!" We need a tshirt with that on it asap! " }
数据分割
数据集包含一个分割,即train。
数据集创建
生成脚本
python import argilla as rg from datasets import load_dataset import uuid from datasets import concatenate_datasets
ds = load_dataset("go_emotions", "raw", split="train") ds_prepared = load_dataset("go_emotions")
_CLASS_NAMES = [ "admiration", "amusement", "anger", "annoyance", "approval", "caring", "confusion", "curiosity", "desire", "disappointment", "disapproval", "disgust", "embarrassment", "excitement", "fear", "gratitude", "grief", "joy", "love", "nervousness", "optimism", "pride", "realization", "relief", "remorse", "sadness", "surprise", "neutral", ] label_to_id = {label: i for i, label in enumerate(_CLASS_NAMES)} id_to_label = {i: label for i, label in enumerate(_CLASS_NAMES)}
Concatenate the datasets and transform to pd.DataFrame
ds_prepared = concatenate_datasets([ds_prepared["train"], ds_prepared["validation"], ds_prepared["test"]]) df_prepared = ds_prepared.to_pandas()
Obtain the final labels as a dict, to later include these as suggestions
labels_prepared = {} for idx in df_prepared.index: labels = [id_to_label[label_id] for label_id in df_prepared[labels][idx]] labels_prepared[df_prepared[id][idx]] = labels
Add labels to the dataset and keep only the relevant columns
def add_labels(ex): labels = [] for label in _CLASS_NAMES: if ex[label] == 1: labels.append(label) ex["labels"] = labels
return ex
ds = ds.map(add_labels) df = ds.select_columns(["text", "labels", "rater_id", "id"]).to_pandas()
Create a FeedbackDataset for text classification
feedback_dataset = rg.FeedbackDataset.for_text_classification(labels=_CLASS_NAMES, multi_label=True)
Create the records with the original responses, and use as suggestions
the final labels in the "simplified" go_emotions dataset.
records = [] for text, df_text in df.groupby("text"): responses = [] for rater_id, df_raters in df_text.groupby("rater_id"): responses.append( { "values": {"label": {"value": df_raters["labels"].iloc[0].tolist()}}, "status": "submitted", "user_id": uuid.UUID(int=rater_id), } ) suggested_labels = labels_prepared.get(df_raters["id"].iloc[0], None) if not suggested_labels: continue suggestion = [ { "question_name": "label", "value": suggested_labels, "type": "human", } ] records.append( rg.FeedbackRecord( fields={"text": df_raters["text"].iloc[0]}, responses=responses, suggestions=suggestion ) )
feedback_dataset.add_records(records)
Push to the hub
feedback_dataset.push_to_huggingface("plaguss/go_emotions_raw")




