parquet-converter commited on
Commit
e48141c
1 Parent(s): 893d11a

Update parquet files

Browse files
.gitattributes DELETED
@@ -1,27 +0,0 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bin.* filter=lfs diff=lfs merge=lfs -text
5
- *.bz2 filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.model filter=lfs diff=lfs merge=lfs -text
12
- *.msgpack filter=lfs diff=lfs merge=lfs -text
13
- *.onnx filter=lfs diff=lfs merge=lfs -text
14
- *.ot filter=lfs diff=lfs merge=lfs -text
15
- *.parquet filter=lfs diff=lfs merge=lfs -text
16
- *.pb filter=lfs diff=lfs merge=lfs -text
17
- *.pt filter=lfs diff=lfs merge=lfs -text
18
- *.pth filter=lfs diff=lfs merge=lfs -text
19
- *.rar filter=lfs diff=lfs merge=lfs -text
20
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
- *.tar.* filter=lfs diff=lfs merge=lfs -text
22
- *.tflite filter=lfs diff=lfs merge=lfs -text
23
- *.tgz filter=lfs diff=lfs merge=lfs -text
24
- *.xz filter=lfs diff=lfs merge=lfs -text
25
- *.zip filter=lfs diff=lfs merge=lfs -text
26
- *.zstandard filter=lfs diff=lfs merge=lfs -text
27
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
edges/pubmed-train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72bacc0eafbf0692c9e00aa64ddf4320908e0bfb7ffa6e7a30d36d84d84dd2f4
3
+ size 739821
nodes/pubmed-train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b06e81a993a592b12ee0eee56617e29533b6cce9095cae3d757b557f8ba552c6
3
+ size 10002378
pubmed.py DELETED
@@ -1,197 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- """TODO: Add a description here."""
16
-
17
-
18
- from datasets import features
19
- import pandas
20
- import os
21
-
22
- import datasets
23
-
24
-
25
- # TODO: Add BibTeX citation
26
- # Find for instance the citation on arxiv or on the dataset repo/website
27
- _CITATION = ""
28
-
29
- # TODO: Add description of the dataset here
30
- # You can copy an official description
31
- _DESCRIPTION = """\
32
- The Pubmed Diabetes dataset consists of 19717 scientific publications from PubMed database pertaining to diabetes classified into one of three classes. The citation network consists of 44338 links. Each publication in the dataset is described by a TF/IDF weighted word vector from a dictionary which consists of 500 unique words. The README file in the dataset provides more details.
33
- """
34
-
35
- # TODO: Add a link to an official homepage for the dataset here
36
- _HOMEPAGE = "https://linqs.soe.ucsc.edu/data"
37
-
38
- # TODO: Add the licence for the dataset here if you can find it
39
- _LICENSE = ""
40
-
41
- # TODO: Add link to the official dataset URLs here
42
- # The HuggingFace dataset library don't host the datasets but only point to the original files
43
- # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
44
- _URLs = {
45
- "nodes": "https://linqs-data.soe.ucsc.edu/public/Pubmed-Diabetes.tgz",
46
- "edges": "https://linqs-data.soe.ucsc.edu/public/Pubmed-Diabetes.tgz"
47
- }
48
-
49
- _CLASS_LABELS = [
50
- "Diabetes Mellitus, Experimental",
51
- "Diabetes Mellitus Type 1",
52
- "Diabetes Mellitus Type 2"
53
- ]
54
-
55
- _WORD_FEATURES = ["w-rat", "w-common", "w-use", "w-examin", "w-pathogenesi", "w-retinopathi", "w-mous", "w-studi", "w-anim", "w-model", "w-metabol", "w-abnorm", "w-contribut", "w-develop", "w-investig", "w-mice", "w-2", "w-month", "w-compar", "w-obtain", "w-method", "w-induc", "w-6", "w-inject", "w-experiment", "w-normal", "w-diet", "w-30", "w-hyperglycemia", "w-level", "w-lipid", "w-oxid", "w-activ", "w-protein", "w-kinas", "w-c", "w-measur", "w-result", "w-increas", "w-retin", "w-stress", "w-3", "w-similar", "w-observ", "w-conclus", "w-play", "w-import", "w-role", "w-present", "w-p", "w-m", "w-r", "w-muscl", "w-control", "w-chang", "w-dure", "w-lower", "w-higher", "w-mass", "w-correl", "w-decreas", "w-determin", "w-concentr", "w-stimul", "w-period", "w-caus", "w-mark", "w-group", "w-evid", "w-fast", "w-type", "w-signific", "w-differ", "w-ratio", "w-suggest", "w-degre", "w-occur", "w-vivo", "w-respect", "w-dysfunct", "w-region", "w-high", "w-appear", "w-sever", "w-affect", "w-cardiovascular", "w-complic", "w-primari", "w-death", "w-patient", "w-clinic", "w-suscept", "w-cardiac", "w-tissu", "w-specif", "w-function", "w-defect", "w-possibl", "w-indic", "w-state", "w-onli", "w-bodi", "w-weight", "w-loss", "w-valu", "w-howev", "w-4", "w-condit", "w-durat", "w-8", "w-week", "w-onset", "w-data", "w-direct", "w-report", "w-provid", "w-addit", "w-evalu", "w-sensit", "w-heart", "w-object", "w-mean", "w-blood", "w-glucos", "w-strong", "w-hba", "w-1c", "w-a1c", "w-variabl", "w-independ", "w-assess", "w-relat", "w-trial", "w-research", "w-design", "w-profil", "w-sampl", "w-particip", "w-n", "w-1", "w-consist", "w-befor", "w-min", "w-predict", "w-adjust", "w-sex", "w-treatment", "w-7", "w-gt", "w-0", "w-larg", "w-influenc", "w-base", "w-standard", "w-14", "w-10", "w-wherea", "w-enhanc", "w-manag", "w-day", "w-secret", "w-cholesterol", "w-insulin", "w-24", "w-h", "w-low", "w-rate", "w-fatti", "w-acid", "w-effect", "w-hormon", "w-hepat", "w-contrast", "w-product", "w-major", "w-plasma", "w-current", "w-flow", "w-chronic", "w-mechan", "w-test", "w-therefor", "w-analys", "w-mrna", "w-streptozotocin", "w-did", "w-15", "w-g", "w-25", "w-mmol", "w-l", "w-5", "w-reduc", "w-number", "w-densiti", "w-posit", "w-cell", "w-17", "w-mm", "w-18", "w-induct", "w-associ", "w-express", "w-glycem", "w-respons", "w-therapi", "w-random", "w-initi", "w-ani", "w-singl", "w-new", "w-agent", "w-metformin", "w-medic", "w-glycosyl", "w-hemoglobin", "w-analysi", "w-baselin", "w-health", "w-factor", "w-process", "w-care", "w-9", "w-01", "w-95", "w-interv", "w-ci", "w-12", "w-reduct", "w-achiev", "w-target", "w-lt", "w-diseas", "w-class", "w-age", "w-obes", "w-renal", "w-improv", "w-progress", "w-noninsulindepend", "w-mellitus", "w-becaus", "w-s", "w-index", "w-hypertens", "w-need", "w-followup", "w-year", "w-mg", "w-dl", "w-remain", "w-subject", "w-treat", "w-oral", "w-requir", "w-0001", "w-mortal", "w-includ", "w-vs", "w-background", "w-poor", "w-drug", "w-13", "w-rang", "w-combin", "w-intervent", "w-daili", "w-dose", "w-100", "w-toler", "w-receiv", "w-11", "w-postprandi", "w-kg", "w-hypoglycemia", "w-frequent", "w-event", "w-versus", "w-symptom", "w-incid", "w-parent", "w-complex", "w-longterm", "w-inhibitor", "w-peripher", "w-nerv", "w-stz", "w-conduct", "w-demonstr", "w-frequenc", "w-inhibit", "w-neuropathi", "w-pathway", "w-shown", "w-time", "w-ii", "w-individu", "w-adult", "w-50", "w-60", "w-diagnosi", "w-healthi", "w-follow", "w-young", "w-seen", "w-alter", "w-gene", "w-e", "w-identifi", "w-previous", "w-mediat", "w-vascular", "w-lipoprotein", "w-involv", "w-phenotyp", "w-confirm", "w-variant", "w-endotheli", "w-potenti", "w-disord", "w-popul", "w-nonobes", "w-aim", "w-serum", "w-hba1c", "w-hypoglycaemia", "w-continu", "w-case", "w-impair", "w-risk", "w-known", "w-men", "w-women", "w-40", "w-complet", "w-estim", "w-like", "w-particular", "w-human", "w-character", "w-elev", "w-synthesi", "w-greater", "w-small", "w-reveal", "w-liver", "w-niddm", "w-genet", "w-receptor", "w-growth", "w-pancreat", "w-betacel", "w-molecul", "w-enzym", "w-regul", "w-polymorph", "w-total", "w-allel", "w-02", "w-resist", "w-cpeptid", "w-hypothesi", "w-perform", "w-score", "w-001", "w-05", "w-histori", "w-action", "w-approxim", "w-suppress", "w-glucagon", "w-ml", "w-x", "w-free", "w-peopl", "w-uptak", "w-intens", "w-relationship", "w-prevent", "w-autoimmun", "w-recent", "w-preval", "w-nondiabet", "w-genotyp", "w-conclud", "w-linkag", "w-islet", "w-peptid", "w-form", "w-membran", "w-transgen", "w-failur", "w-isol", "w-negat", "w-earli", "w-famili", "w-chromosom", "w-immun", "w-support", "w-16", "w-cohort", "w-insulindepend", "w-outcom", "w-screen", "w-approach", "w-infus", "w-multipl", "w-depend", "w-physic", "w-transport", "w-acut", "w-releas", "w-presenc", "w-glycaem", "w-male", "w-antibodi", "w-femal", "w-pattern", "w-t2dm", "w-promot", "w-fat", "w-d", "w-bmi", "w-haplotyp", "w-triglycerid", "w-interact", "w-marker", "w-describ", "w-area", "w-20", "w-cytokin", "w-bind", "w-bb", "w-alpha", "w-beta", "w-cd4", "w-spontan", "w-given", "w-vitro", "w-basal", "w-protect", "w-pressur", "w-detect", "w-exercis", "w-children", "w-adolesc", "w-life", "w-b", "w-antigen", "w-iddm", "w-american", "w-hla", "w-arteri", "w-nephropathi", "w-review", "w-destruct", "w-content", "w-autoantibodi", "w-dm", "w-select", "w-infect", "w-recipi", "w-intak", "w-placebo", "w-db", "w-pancrea", "w-diagnos", "w-glomerular", "w-albumin", "w-excret", "w-syndrom", "w-t", "w-lymphocyt", "w-produc", "w-coronari", "w-status", "w-microalbuminuria", "w-nod", "w-mhc", "w-insul", "w-administr", "w-revers", "w-transplant", "w-graft", "w-t1d", "w-lead", "w-v", "w-dietari", "w-general", "w-macrophag", "w-kidney", "w-urinari", "w-myocardi", "w-meal", "w-ica", "w-locus", "w-tcell", "w-depress", "w-bone", "w-mutat"
56
- ]
57
-
58
-
59
- # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
60
- class PubmedDataset(datasets.GeneratorBasedBuilder):
61
- VERSION = datasets.Version("1.0.1")
62
-
63
- # This is an example of a dataset with multiple configurations.
64
- # If you don't want/need to define several sub-sets in your dataset,
65
- # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
66
-
67
- # If you need to make complex sub-parts in the datasets with configurable options
68
- # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
69
- # BUILDER_CONFIG_CLASS = MyBuilderConfig
70
-
71
- # You will be able to load one or the other configurations in the following list with
72
- # data = datasets.load_dataset('my_dataset', 'first_domain')
73
- # data = datasets.load_dataset('my_dataset', 'second_domain')
74
- BUILDER_CONFIGS = [
75
- datasets.BuilderConfig(name="nodes", version=VERSION,
76
- description="The PubMed dataset"),
77
- datasets.BuilderConfig(name="edges", version=VERSION,
78
- description="The PubMed network")
79
- ]
80
-
81
- # It's not mandatory to have a default configuration. Just use one if it make sense.
82
- DEFAULT_CONFIG_NAME = "nodes"
83
-
84
- def _info(self):
85
- if self.config.name == "nodes":
86
- features_dict = {
87
- w: datasets.Value("float32")
88
- for w in _WORD_FEATURES
89
- }
90
- features_dict["node"] = datasets.Value("string")
91
- features_dict["label"] = datasets.ClassLabel(names=_CLASS_LABELS)
92
- features_dict["neighbors"] = datasets.Sequence(
93
- datasets.Value("string")
94
- )
95
- features = datasets.Features(features_dict)
96
- elif self.config.name == "edges": # This is an example to show how to have different features for "first_domain" and "second_domain"
97
- features = datasets.Features(
98
- {
99
- "source": datasets.Value("string"),
100
- "target": datasets.Value("string")
101
- }
102
- )
103
- return datasets.DatasetInfo(
104
- # This is the description that will appear on the datasets page.
105
- description=_DESCRIPTION,
106
- # This defines the different columns of the dataset and their types
107
- # Here we define them above because they are different between the two configurations
108
- features=features,
109
- # If there's a common (input, target) tuple from the features,
110
- # specify them here. They'll be used if as_supervised=True in
111
- # builder.as_dataset.
112
- supervised_keys=None,
113
- # Homepage of the dataset for documentation
114
- homepage=_HOMEPAGE,
115
- # License for the dataset if available
116
- license=_LICENSE,
117
- # Citation for the dataset
118
- citation=_CITATION,
119
- )
120
-
121
- def _split_generators(self, dl_manager):
122
- """Returns SplitGenerators."""
123
- # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
124
- # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
125
-
126
- # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
127
- # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
128
- # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
129
- my_urls = _URLs[self.config.name]
130
- data_dir = dl_manager.download_and_extract(my_urls)
131
- data_dir = os.path.join(data_dir, "Pubmed-Diabetes", "data")
132
-
133
- return [
134
- datasets.SplitGenerator(
135
- name=datasets.Split.TRAIN,
136
- # These kwargs will be passed to _generate_examples
137
- gen_kwargs={
138
- "edges_path": os.path.join(data_dir, "Pubmed-Diabetes.DIRECTED.cites.tab"),
139
- "nodes_path": os.path.join(data_dir, "Pubmed-Diabetes.NODE.paper.tab"),
140
- "split": "train"
141
- }
142
- )
143
- ]
144
-
145
- def _generate_examples(
146
- # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
147
- self, edges_path, nodes_path, split
148
- ):
149
- """ Yields examples as (key, example) tuples. """
150
- # This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
151
- # The `key` is here for legacy reason (tfds) and is not important in itself.
152
-
153
- if self.config.name == "nodes":
154
- neighbors = {}
155
- with open(edges_path, "rt", encoding="UTF-8") as f:
156
- # Skip the two first lines
157
- f.readline()
158
- f.readline()
159
-
160
- for line in f:
161
- cols = line.strip().split("\t")
162
- src, target = cols[1].split(":")[1], cols[3].split(":")[1]
163
- for n in (target, src):
164
- if n not in neighbors:
165
- neighbors[n] = []
166
- neighbors[src].append(target)
167
-
168
- def _word_feature_tuple(x):
169
- w, v = x.split("=")
170
- return (w, float(v))
171
-
172
- with open(nodes_path, "rt", encoding="UTF-8") as f:
173
- # Skip the two first lines
174
- f.readline()
175
- f.readline()
176
-
177
- for id, line in enumerate(f):
178
- row = line.split("\t")
179
- node = row[0]
180
- label = _CLASS_LABELS[int(row[1][-1]) - 1]
181
- w_features = dict(map(_word_feature_tuple, row[2:-1]))
182
- features = {"node": node, "label": label,
183
- "neighbors": neighbors[node]}
184
- for x in _WORD_FEATURES:
185
- features[x] = w_features.get(x, 0.0)
186
- yield id, features
187
-
188
- elif self.config.name == "edges":
189
- with open(edges_path, "rt", encoding="UTF-8") as f:
190
- # Skip the two first lines
191
- f.readline()
192
- f.readline()
193
-
194
- for id, line in enumerate(f):
195
- cols = line.strip().split("\t")
196
- src, target = cols[1].split(":")[1], cols[3].split(":")[1]
197
- yield id, {"source": src, "target": target}