imbesat-rizvi commited on
Commit
baabeb7
1 Parent(s): 1de8e5a

[Bug Fix] Corrected data file download

Browse files
Files changed (2) hide show
  1. dataset_info.json +1 -1
  2. newsgroups.py +7 -1
dataset_info.json CHANGED
@@ -1 +1 @@
1
- {"description": "\nThe bydate version of the 20-newsgroup dataset fetched from scikit_learn and split in stratified manner into train, validation and test sets. The test set from the original 20 newsgroup dataset is retained while the original train set is split 80:20 into train and validation sets in stratified manner based on the newsgroup. The 20 different newsgroup are provided as the labels instead of config names as specified in the official huggingface dataset. Newsgroups are specified as labels to provide a simplified setup for text classification task. The 20 different newsgroup functioning as labels are:\n(1) alt.atheism\n(2) comp.graphics\n(3) comp.os.ms-windows.misc\n(4) comp.sys.ibm.pc.hardware\n(5) comp.sys.mac.hardware\n(6) comp.windows.x\n(7) misc.forsale\n(8) rec.autos\n(9) rec.motorcycles\n(10) rec.sport.baseball\n(11) rec.sport.hockey\n(12) sci.crypt\n(13) sci.electronics\n(14) sci.med\n(15) sci.space\n(16) soc.religion.christian\n(17) talk.politics.guns\n(18) talk.politics.mideast\n(19) talk.politics.misc\n(20) talk.religion.misc", "citation": "\n@inproceedings{Lang95,\n author = {Ken Lang},\n title = {Newsweeder: Learning to filter netnews}\n year = {1995}\n booktitle = {Proceedings of the Twelfth International Conference on Machine Learning}\n pages = {331-339}\n }\n ", "homepage": "http://qwone.com/~jason/20Newsgroups/", "license": "", "features": {"text": {"dtype": "large_string", "id": null, "_type": "Value"}, "labels": {"num_classes": 20, "names": ["alt.atheism", "comp.graphics", "comp.os.ms-windows.misc", "comp.sys.ibm.pc.hardware", "comp.sys.mac.hardware", "comp.windows.x", "misc.forsale", "rec.autos", "rec.motorcycles", "rec.sport.baseball", "rec.sport.hockey", "sci.crypt", "sci.electronics", "sci.med", "sci.space", "soc.religion.christian", "talk.politics.guns", "talk.politics.mideast", "talk.politics.misc", "talk.religion.misc"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "newsgroups", "config_name": "default", "version": {"version_str": "2.0.0", "description": null, "major": 2, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 17065029, "num_examples": 9051, "dataset_name": "newsgroups"}, "validation": {"name": "validation", "num_bytes": 4279761, "num_examples": 2263, "dataset_name": "newsgroups"}, "test": {"name": "test", "num_bytes": 13328728, "num_examples": 7532, "dataset_name": "newsgroups"}}, "download_checksums": {}, "download_size": 0, "post_processing_size": null, "dataset_size": 34673518, "size_in_bytes": 34673518}
 
1
+ {"description": "\nThe bydate version of the 20-newsgroup dataset fetched from scikit_learn and split in stratified manner into train, validation and test sets. The test set from the original 20 newsgroup dataset is retained while the original train set is split 80:20 into train and validation sets in stratified manner based on the newsgroup. The 20 different newsgroup are provided as the labels instead of config names as specified in the official huggingface dataset. Newsgroups are specified as labels to provide a simplified setup for text classification task. The 20 different newsgroup functioning as labels are:\n(1) alt.atheism\n(2) comp.graphics\n(3) comp.os.ms-windows.misc\n(4) comp.sys.ibm.pc.hardware\n(5) comp.sys.mac.hardware\n(6) comp.windows.x\n(7) misc.forsale\n(8) rec.autos\n(9) rec.motorcycles\n(10) rec.sport.baseball\n(11) rec.sport.hockey\n(12) sci.crypt\n(13) sci.electronics\n(14) sci.med\n(15) sci.space\n(16) soc.religion.christian\n(17) talk.politics.guns\n(18) talk.politics.mideast\n(19) talk.politics.misc\n(20) talk.religion.misc", "citation": "\n@inproceedings{Lang95,\n author = {Ken Lang},\n title = {Newsweeder: Learning to filter netnews}\n year = {1995}\n booktitle = {Proceedings of the Twelfth International Conference on Machine Learning}\n pages = {331-339}\n }\n ", "homepage": "http://qwone.com/~jason/20Newsgroups/", "license": "", "features": {"text": {"dtype": "large_string", "id": null, "_type": "Value"}, "labels": {"num_classes": 20, "names": ["alt.atheism", "comp.graphics", "comp.os.ms-windows.misc", "comp.sys.ibm.pc.hardware", "comp.sys.mac.hardware", "comp.windows.x", "misc.forsale", "rec.autos", "rec.motorcycles", "rec.sport.baseball", "rec.sport.hockey", "sci.crypt", "sci.electronics", "sci.med", "sci.space", "soc.religion.christian", "talk.politics.guns", "talk.politics.mideast", "talk.politics.misc", "talk.religion.misc"], "id": null, "_type": "ClassLabel"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "newsgroups", "config_name": "default", "version": {"version_str": "2.0.0", "description": null, "major": 2, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 17065029, "num_examples": 9051, "dataset_name": "newsgroups"}, "validation": {"name": "validation", "num_bytes": 4279761, "num_examples": 2263, "dataset_name": "newsgroups"}, "test": {"name": "test", "num_bytes": 13328728, "num_examples": 7532, "dataset_name": "newsgroups"}}, "download_checksums": {"https://huggingface.co/datasets/pensieves/newsgroups/resolve/main/newsgroups.zip": {"num_bytes": 14404706, "checksum": "e18ecd06210a2a95a0c98a9e5be09c2c438be3cd10f66b3bdc85ccee3f153bfd"}}, "download_size": 14404706, "post_processing_size": null, "dataset_size": 34673518, "size_in_bytes": 49078224}
newsgroups.py CHANGED
@@ -29,6 +29,9 @@ The bydate version of the 20-newsgroup dataset fetched from scikit_learn and spl
29
  """
30
  _DESCRIPTION += "\n".join(f"({i+1}) {j}" for i,j in enumerate(_NEWSGROUPS))
31
 
 
 
 
32
  _HOMEPAGE = "http://qwone.com/~jason/20Newsgroups/"
33
 
34
  _CITATION = """
@@ -65,7 +68,10 @@ class Newsgroups(datasets.GeneratorBasedBuilder):
65
 
66
 
67
  def _split_generators(self, dl_manager):
68
- data_df = pd.read_csv("newsgroups.zip")
 
 
 
69
  train_df = data_df.query(f"split == 'train'").drop(columns="split")
70
  val_df = data_df.query(f"split == 'validation'").drop(columns="split")
71
  test_df = data_df.query(f"split == 'test'").drop(columns="split")
 
29
  """
30
  _DESCRIPTION += "\n".join(f"({i+1}) {j}" for i,j in enumerate(_NEWSGROUPS))
31
 
32
+
33
+ _DOWNLOAD_URL = "https://huggingface.co/datasets/pensieves/newsgroups/resolve/main/newsgroups.zip"
34
+
35
  _HOMEPAGE = "http://qwone.com/~jason/20Newsgroups/"
36
 
37
  _CITATION = """
 
68
 
69
 
70
  def _split_generators(self, dl_manager):
71
+
72
+ data_path = dl_manager.download(_DOWNLOAD_URL)
73
+ data_df = pd.read_csv(data_path, compression="zip")
74
+
75
  train_df = data_df.query(f"split == 'train'").drop(columns="split")
76
  val_df = data_df.query(f"split == 'validation'").drop(columns="split")
77
  test_df = data_df.query(f"split == 'test'").drop(columns="split")