Commit ·
d46f827
1
Parent(s): 3c8cc81
Update parquet files
Browse filesFiles changed (5)
- .gitattributesDeleted-29
- dataset_infos.jsonDeleted-1
- default/labels-test.parquetAdded+3
- default/labels-train.parquetAdded+3
- labels.pyDeleted-93
1234567891011121314151617181920212223242526272829*.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 -texttrain.csv filter=lfs diff=lfs merge=lfs -texttest.csv filter=lfs diff=lfs merge=lfs -text1{"default": {"description": "AG is a collection of more than 1 million news articles. News articles have been\ngathered from more than 2000 news sources by ComeToMyHead in more than 1 year of\nactivity. ComeToMyHead is an academic news search engine which has been running\nsince July, 2004. The dataset is provided by the academic comunity for research\npurposes in data mining (clustering, classification, etc), information retrieval\n(ranking, search, etc), xml, data compression, data streaming, and any other\nnon-commercial activity. For more information, please refer to the link\nhttp://www.di.unipi.it/~gulli/AG_corpus_of_news_articles.html .\n\nThe AG's news topic classification dataset is constructed by Xiang Zhang\n(xiang.zhang@nyu.edu) from the dataset above. It is used as a text\nclassification benchmark in the following paper: Xiang Zhang, Junbo Zhao, Yann\nLeCun. Character-level Convolutional Networks for Text Classification. Advances\nin Neural Information Processing Systems 28 (NIPS 2015).\n", "citation": "@inproceedings{Zhang2015CharacterlevelCN,\n title={Character-level Convolutional Networks for Text Classification},\n author={Xiang Zhang and Junbo Jake Zhao and Yann LeCun},\n booktitle={NIPS},\n year={2015}\n}\n", "homepage": "http://groups.di.unipi.it/~gulli/AG_corpus_of_news_articles.html", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "label": {"num_classes": 4, "names": ["World", "Sports", "Business", "Sci/Tech"], "names_file": null, "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": [{"task": "text-classification", "text_column": "text", "label_column": "label", "labels": ["Business", "Sci/Tech", "Sports", "World"]}], "builder_name": "ag_news", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 29817351, "num_examples": 120000, "dataset_name": "ag_news"}, "test": {"name": "test", "num_bytes": 1879478, "num_examples": 7600, "dataset_name": "ag_news"}}, "download_checksums": {"https://raw.githubusercontent.com/mhjabreel/CharCnn_Keras/master/data/ag_news_csv/train.csv": {"num_bytes": 29470338, "checksum": "76a0a2d2f92b286371fe4d4044640910a04a803fdd2538e0f3f29a5c6f6b672e"}, "https://raw.githubusercontent.com/mhjabreel/CharCnn_Keras/master/data/ag_news_csv/test.csv": {"num_bytes": 1857427, "checksum": "521465c2428ed7f02f8d6db6ffdd4b5447c1c701962353eb2c40d548c3c85699"}}, "download_size": 31327765, "post_processing_size": null, "dataset_size": 31696829, "size_in_bytes": 63024594}}123version https://git-lfs.github.com/spec/v1oid sha256:29c40feec94e92d8d609aaec0d9927bb35c16532540cb9c9555f28973cec0360size 1234828123version https://git-lfs.github.com/spec/v1oid sha256:17c8ed585491d9f7636026b7a51cf09264e6794e75f3e4049c720bff74b5420esize 18585437123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293# coding=utf-8# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.## 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.
# Lint as: python3"""AG News topic classification dataset."""
import csv
import datasetsfrom datasets.tasks import TextClassification
_DESCRIPTION = """\AG is a collection of more than 1 million news articles. News articles have beengathered from more than 2000 news sources by ComeToMyHead in more than 1 year ofactivity. ComeToMyHead is an academic news search engine which has been runningsince July, 2004. The dataset is provided by the academic comunity for researchpurposes in data mining (clustering, classification, etc), information retrieval(ranking, search, etc), xml, data compression, data streaming, and any othernon-commercial activity. For more information, please refer to the linkhttp://www.di.unipi.it/~gulli/AG_corpus_of_news_articles.html .The AG's news topic classification dataset is constructed by Xiang Zhang(xiang.zhang@nyu.edu) from the dataset above. It is used as a textclassification benchmark in the following paper: Xiang Zhang, Junbo Zhao, YannLeCun. Character-level Convolutional Networks for Text Classification. Advancesin Neural Information Processing Systems 28 (NIPS 2015)."""
_CITATION = """\@inproceedings{Zhang2015CharacterlevelCN, title={Character-level Convolutional Networks for Text Classification}, author={Xiang Zhang and Junbo Jake Zhao and Yann LeCun}, booktitle={NIPS}, year={2015}}"""
_TRAIN_DOWNLOAD_URL = "https://raw.githubusercontent.com/mhjabreel/CharCnn_Keras/master/data/ag_news_csv/train.csv"_TEST_DOWNLOAD_URL = "https://raw.githubusercontent.com/mhjabreel/CharCnn_Keras/master/data/ag_news_csv/test.csv"
class AGNews(datasets.GeneratorBasedBuilder): """AG News topic classification dataset."""
def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "text": datasets.Value("string"), "label": datasets.features.ClassLabel(names=["World", "Sports", "Business", "Sci/Tech"]), } ), homepage="http://groups.di.unipi.it/~gulli/AG_corpus_of_news_articles.html", citation=_CITATION, task_templates=[TextClassification(text_column="text", label_column="label")], )
def _split_generators(self, dl_manager): train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL) test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL) return [ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}), datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}), ]
def _generate_examples(self, filepath): """Generate AG News examples.""" with open(filepath, encoding="utf-8") as csv_file: csv_reader = csv.reader( csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True ) for id_, row in enumerate(csv_reader): label, title, description = row # Original labels are [1, 2, 3, 4] -> # ['World', 'Sports', 'Business', 'Sci/Tech'] # Re-map to [0, 1, 2, 3]. label = int(label) - 1 text = " ".join((title, description)) yield id_, {"text": text, "label": label}.gitattributesDeleted-29
dataset_infos.jsonDeleted-1
default/labels-test.parquetAdded+3
default/labels-train.parquetAdded+3
labels.pyDeleted-93