Francisco Castillo commited on
Commit
3ec5e5c
1 Parent(s): 6dbab01
.gitattributes CHANGED
@@ -39,3 +39,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
39
  *.mp3 filter=lfs diff=lfs merge=lfs -text
40
  *.ogg filter=lfs diff=lfs merge=lfs -text
41
  *.wav filter=lfs diff=lfs merge=lfs -text
 
 
 
39
  *.mp3 filter=lfs diff=lfs merge=lfs -text
40
  *.ogg filter=lfs diff=lfs merge=lfs -text
41
  *.wav filter=lfs diff=lfs merge=lfs -text
42
+ production.pkl filter=lfs diff=lfs merge=lfs -text
43
+ training.pkl filter=lfs diff=lfs merge=lfs -text
44
+ validation.pkl filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language_creators:
5
+ - expert-generated
6
+ languages:
7
+ - en
8
+ license:
9
+ - mit
10
+ multilinguality:
11
+ - monolingual
12
+ pretty_name: sentiment-classification-reviews-with-drift
13
+ size_categories:
14
+ - 10K<n<100K
15
+ source_datasets:
16
+ - extended|imdb
17
+ task_categories:
18
+ - image-classification
19
+ task_ids:
20
+ - multi-class-classification
21
+ ---
22
+
23
+ # Dataset Card for `reviews_with_drift`
24
+
25
+ ## Table of Contents
26
+ - [Table of Contents](#table-of-contents)
27
+ - [Dataset Description](#dataset-description)
28
+ - [Dataset Summary](#dataset-summary)
29
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
30
+ - [Languages](#languages)
31
+ - [Dataset Structure](#dataset-structure)
32
+ - [Data Instances](#data-instances)
33
+ - [Data Fields](#data-fields)
34
+ - [Data Splits](#data-splits)
35
+ - [Dataset Creation](#dataset-creation)
36
+ - [Curation Rationale](#curation-rationale)
37
+ - [Source Data](#source-data)
38
+ - [Annotations](#annotations)
39
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
40
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
41
+ - [Social Impact of Dataset](#social-impact-of-dataset)
42
+ - [Discussion of Biases](#discussion-of-biases)
43
+ - [Other Known Limitations](#other-known-limitations)
44
+ - [Additional Information](#additional-information)
45
+ - [Dataset Curators](#dataset-curators)
46
+ - [Licensing Information](#licensing-information)
47
+ - [Citation Information](#citation-information)
48
+ - [Contributions](#contributions)
49
+
50
+ ## Dataset Description
51
+
52
+ ### Dataset Summary
53
+
54
+ This dataset was crafted to be used in our tutorial [Link to the tutorial when ready]. It consists on a large Movie Review Dataset mixed with some reviews from a Hotel Review Dataset. The training/validation set are purely obtained from the Movie Review Dataset while the production set is mixed. Some other features have been added (`age`, `gender`, `context`) as well as a made up timestamp `prediction_ts` of when the inference took place.
55
+
56
+ ### Supported Tasks and Leaderboards
57
+
58
+ `text-classification`, `sentiment-classification`: The dataset is mainly used for text classification: given the text, predict the sentiment (positive or negative).
59
+
60
+ ### Languages
61
+
62
+ Text is mainly written in english.
63
+
64
+ ## Dataset Structure
65
+
66
+ ### Data Instances
67
+
68
+ [More Information Needed]
69
+
70
+ ### Data Fields
71
+
72
+ [More Information Needed]
73
+
74
+ ### Data Splits
75
+
76
+ [More Information Needed]
77
+
78
+ ## Dataset Creation
79
+
80
+ ### Curation Rationale
81
+
82
+ [More Information Needed]
83
+
84
+ ### Source Data
85
+
86
+ [More Information Needed]
87
+
88
+ #### Initial Data Collection and Normalization
89
+
90
+ [More Information Needed]
91
+
92
+ #### Who are the source language producers?
93
+
94
+ [More Information Needed]
95
+
96
+ ### Annotations
97
+
98
+ [More Information Needed]
99
+
100
+ #### Annotation process
101
+
102
+ [More Information Needed]
103
+
104
+ #### Who are the annotators?
105
+
106
+ [More Information Needed]
107
+
108
+ ### Personal and Sensitive Information
109
+
110
+ [More Information Needed]
111
+
112
+ ## Considerations for Using the Data
113
+
114
+ ### Social Impact of Dataset
115
+
116
+ [More Information Needed]
117
+
118
+ ### Discussion of Biases
119
+
120
+ [More Information Needed]
121
+
122
+ ### Other Known Limitations
123
+
124
+ [More Information Needed]
125
+
126
+ ## Additional Information
127
+
128
+ ### Dataset Curators
129
+
130
+ [More Information Needed]
131
+
132
+ ### Licensing Information
133
+
134
+ [More Information Needed]
135
+
136
+ ### Citation Information
137
+
138
+ [More Information Needed]
139
+
140
+ ### Contributions
141
+
142
+ Thanks to [@fjcasti1](https://github.com/fjcasti1) for adding this dataset.
fashion_mnist_quality_drift.py ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # Lint as: python3
16
+ """IMDb movie revies dataset mixed with Trip Advisor Hotel Reviews to simulate drift accross time."""
17
+
18
+
19
+ import datasets
20
+ import os
21
+ os.system('pip install pickle5')
22
+ import pickle5 as pickle
23
+
24
+
25
+
26
+ # TODO: Add BibTeX citation to our BLOG
27
+ # Find for instance the citation on arxiv or on the dataset repo/website
28
+ _CITATION = ""
29
+ # _CITATION = """\
30
+ # @InProceedings{huggingface:dataset,
31
+ # title = {A great new dataset},
32
+ # author={huggingface, Inc.
33
+ # },
34
+ # year={2020}
35
+ # }
36
+ # """
37
+
38
+ # TODO: Add description of the dataset here
39
+ # You can copy an official description
40
+ _DESCRIPTION = """\
41
+ This dataset was crafted to be used in our tutorial [Link to the tutorial when
42
+ ready]. It consists on product reviews from an e-commerce store. The reviews
43
+ are labeled on a scale from 1 to 5 (stars). The training & validation sets are
44
+ fully composed by reviews written in english. However, the production set has
45
+ some reviews written in spanish. At Arize, we work to surface this issue and
46
+ help you solve it.
47
+ """
48
+
49
+ # TODO: Add a link to an official homepage for the dataset here
50
+ _HOMEPAGE = ""
51
+
52
+ # TODO: Add the licence for the dataset here if you can find it
53
+ _LICENSE = ""
54
+
55
+ # TODO: Add link to the official dataset URLs here
56
+ # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
57
+ # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
58
+ _URL = "https://huggingface.co/datasets/arize-ai/fashion_mnist_quality_drift/resolve/main/"
59
+ _URLS = {
60
+ "training": _URL + "training.pkl",
61
+ "validation": _URL + "validation.pkl",
62
+ "production": _URL + "production.pkl",
63
+ }
64
+
65
+
66
+ # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
67
+ class FashionMNISTLabelDrift(datasets.GeneratorBasedBuilder):
68
+ """TODO: Short description of my dataset."""
69
+
70
+ VERSION = datasets.Version("1.0.0")
71
+
72
+ # This is an example of a dataset with multiple configurations.
73
+ # If you don't want/need to define several sub-sets in your dataset,
74
+ # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
75
+
76
+ # If you need to make complex sub-parts in the datasets with configurable options
77
+ # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
78
+ # BUILDER_CONFIG_CLASS = MyBuilderConfig
79
+
80
+ # You will be able to load one or the other configurations in the following list with
81
+ # data = datasets.load_dataset('my_dataset', 'first_domain')
82
+ # data = datasets.load_dataset('my_dataset', 'second_domain')
83
+ BUILDER_CONFIGS = [
84
+ datasets.BuilderConfig(name="default", version=VERSION, description="Default"),
85
+ ]
86
+
87
+ DEFAULT_CONFIG_NAME = "default" # It's not mandatory to have a default configuration. Just use one if it make sense.
88
+
89
+ def _info(self):
90
+ # This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
91
+ features = datasets.Features(
92
+ # These are the features of your dataset like images, labels ...
93
+ {
94
+ "prediction_ts": datasets.Value("float"),
95
+ "image": datasets.Image(decode=True),
96
+ "label": datasets.features.ClassLabel(
97
+ names= [
98
+ "T-shirt",
99
+ "Trouser",
100
+ "Pullover",
101
+ "Dress",
102
+ "Coat",
103
+ "Sandal",
104
+ "Shirt",
105
+ "Sneaker",
106
+ "Bag",
107
+ "Ankle-boot",
108
+ ]
109
+ ),
110
+ "url": datasets.Value("string"),
111
+ }
112
+ )
113
+
114
+ return datasets.DatasetInfo(
115
+ # This is the description that will appear on the datasets page.
116
+ description=_DESCRIPTION,
117
+ # This defines the different columns of the dataset and their types
118
+ features=features, # Here we define them above because they are different between the two configurations
119
+ # Homepage of the dataset for documentation
120
+ # License for the dataset if available
121
+ license=_LICENSE,
122
+ # Citation for the dataset
123
+ citation=_CITATION,
124
+ )
125
+
126
+ def _split_generators(self, dl_manager):
127
+ # This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
128
+ # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
129
+
130
+ # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
131
+ # 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.
132
+ # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
133
+ extracted_paths = dl_manager.download_and_extract(_URLS)
134
+ return [
135
+ datasets.SplitGenerator(
136
+ name=datasets.Split("training"),
137
+ # These kwargs will be passed to _generate_examples
138
+ gen_kwargs={
139
+ "filepath": extracted_paths['training'],
140
+ },
141
+ ),
142
+ datasets.SplitGenerator(
143
+ name=datasets.Split("validation"),
144
+ # These kwargs will be passed to _generate_examples
145
+ gen_kwargs={
146
+ "filepath": extracted_paths['validation'],
147
+ },
148
+ ),
149
+ datasets.SplitGenerator(
150
+ name=datasets.Split("production"),
151
+ # These kwargs will be passed to _generate_examples
152
+ gen_kwargs={
153
+ "filepath": extracted_paths['production'],
154
+ },
155
+ ),
156
+ ]
157
+
158
+
159
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
160
+ def _generate_examples(self, filepath):
161
+ # This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
162
+ # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
163
+ with open(filepath, 'rb') as pkl_file:
164
+ data = pickle.load(pkl_file, encoding='bytes')
165
+ prediction_ts=data['prediction_ts']
166
+ images=data['image']
167
+ labels=data['label']
168
+ urls=data['url']
169
+ for idx, _ in enumerate(labels):
170
+ yield idx, {
171
+ "prediction_ts":prediction_ts[idx],
172
+ "image":images[idx],
173
+ "label":int(labels[idx]),
174
+ "url":urls[idx]
175
+ }
production.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:abd396c6e053744dfcd1b0ff6f4ded027ba1afe06db70ffd6e08773efc828e74
3
+ size 35911593
training.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81d2eda1454760d8f15a4129988700cb3cc7926eeb9465b6cfcfdb25a3857ac7
3
+ size 5781022
validation.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4ed5175a3691ef83c01c45e5cd67ce70b59fbf55bf9e176d5917ee42a218ccc9
3
+ size 1448979