Datasets:
Upload 3 files
Browse files- README.md +36 -1
- steel_plates.csv +0 -0
- steel_plates.py +347 -0
README.md
CHANGED
@@ -1,3 +1,38 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
tags:
|
5 |
+
- steel_plates
|
6 |
+
- tabular_classification
|
7 |
+
- binary_classification
|
8 |
+
- multiclass_classification
|
9 |
+
pretty_name: Landsat
|
10 |
+
size_categories:
|
11 |
+
- 1K<n<5K
|
12 |
+
task_categories: # Full list at https://github.com/huggingface/hub-docs/blob/main/js/src/lib/interfaces/Types.ts
|
13 |
+
- tabular-classification
|
14 |
+
configs:
|
15 |
+
- steel_plates
|
16 |
+
- steel_plates_0
|
17 |
+
- steel_plates_1
|
18 |
+
- steel_plates_2
|
19 |
+
- steel_plates_3
|
20 |
+
- steel_plates_4
|
21 |
+
- steel_plates_5
|
22 |
+
- steel_plates_6
|
23 |
+
|
24 |
---
|
25 |
+
# Landsat
|
26 |
+
The [Steel Plates dataset](https://archive-beta.ics.uci.edu/dataset/198/steel+plates+faults) from the [UCI repository](https://archive-beta.ics.uci.edu/).
|
27 |
+
|
28 |
+
# Configurations and tasks
|
29 |
+
| **Configuration** | **Task** | **Description** |
|
30 |
+
|-----------------------|---------------------------|-------------------------|
|
31 |
+
| steel_plates | Multiclass classification.| |
|
32 |
+
| steel_plates_0 | Binary classification. | Is the input of class 0? |
|
33 |
+
| steel_plates_1 | Binary classification. | Is the input of class 1? |
|
34 |
+
| steel_plates_2 | Binary classification. | Is the input of class 2? |
|
35 |
+
| steel_plates_3 | Binary classification. | Is the input of class 3? |
|
36 |
+
| steel_plates_4 | Binary classification. | Is the input of class 4? |
|
37 |
+
| steel_plates_5 | Binary classification. | Is the input of class 5? |
|
38 |
+
| steel_plates_6 | Binary classification. | Is the input of class 6? |
|
steel_plates.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
steel_plates.py
ADDED
@@ -0,0 +1,347 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""Landsat Dataset"""
|
2 |
+
|
3 |
+
from typing import List
|
4 |
+
from functools import partial
|
5 |
+
|
6 |
+
import datasets
|
7 |
+
|
8 |
+
import pandas
|
9 |
+
|
10 |
+
|
11 |
+
VERSION = datasets.Version("1.0.0")
|
12 |
+
|
13 |
+
_ENCODING_DICS = {}
|
14 |
+
|
15 |
+
DESCRIPTION = "Landsat dataset."
|
16 |
+
_HOMEPAGE = "https://archive-beta.ics.uci.edu/dataset/198/steel+plates+faults"
|
17 |
+
_URLS = ("https://archive-beta.ics.uci.edu/dataset/198/steel+plates+faults")
|
18 |
+
_CITATION = """
|
19 |
+
@misc{misc_steel_plates_faults_198,
|
20 |
+
author = {Buscema,M, Terzi,S & Tastle,W},
|
21 |
+
title = {{Steel Plates Faults}},
|
22 |
+
year = {2010},
|
23 |
+
howpublished = {UCI Machine Learning Repository},
|
24 |
+
note = {{DOI}: \\url{10.24432/C5J88N}}
|
25 |
+
}
|
26 |
+
"""
|
27 |
+
|
28 |
+
# Dataset info
|
29 |
+
urls_per_split = {
|
30 |
+
"train": "https://huggingface.co/datasets/mstz/steel_plates/raw/main/steel_plates.csv"
|
31 |
+
}
|
32 |
+
features_types_per_config = {
|
33 |
+
"steel_plates": {
|
34 |
+
"x_minimum": datasets.Value("int64"),
|
35 |
+
"x_maximum": datasets.Value("int64"),
|
36 |
+
"y_minimum": datasets.Value("int64"),
|
37 |
+
"y_maximum": datasets.Value("int64"),
|
38 |
+
"pixels_areas": datasets.Value("int64"),
|
39 |
+
"x_perimeter": datasets.Value("int64"),
|
40 |
+
"y_perimeter": datasets.Value("int64"),
|
41 |
+
"sum_of_luminosity": datasets.Value("int64"),
|
42 |
+
"minimum_of_luminosity": datasets.Value("int64"),
|
43 |
+
"maximum_of_luminosity": datasets.Value("int64"),
|
44 |
+
"length_of_conveyer": datasets.Value("int64"),
|
45 |
+
"typeofsteel_a300": datasets.Value("int64"),
|
46 |
+
"typeofsteel_a400": datasets.Value("int64"),
|
47 |
+
"steel_plate_thickness": datasets.Value("int64"),
|
48 |
+
"edges_index": datasets.Value("float64"),
|
49 |
+
"empty_index": datasets.Value("float64"),
|
50 |
+
"square_index": datasets.Value("float64"),
|
51 |
+
"outside_x_index": datasets.Value("float64"),
|
52 |
+
"edges_x_index": datasets.Value("float64"),
|
53 |
+
"edges_y_index": datasets.Value("float64"),
|
54 |
+
"outside_global_index": datasets.Value("float64"),
|
55 |
+
"logofareas": datasets.Value("float64"),
|
56 |
+
"log_x_index": datasets.Value("float64"),
|
57 |
+
"log_y_index": datasets.Value("float64"),
|
58 |
+
"orientation_index": datasets.Value("float64"),
|
59 |
+
"luminosity_index": datasets.Value("float64"),
|
60 |
+
"sigmoidofareas": datasets.Value("float64"),
|
61 |
+
"class": datasets.ClassLabel(num_classes=7),
|
62 |
+
},
|
63 |
+
"steel_plates_0": {
|
64 |
+
"x_minimum": datasets.Value("int64"),
|
65 |
+
"x_maximum": datasets.Value("int64"),
|
66 |
+
"y_minimum": datasets.Value("int64"),
|
67 |
+
"y_maximum": datasets.Value("int64"),
|
68 |
+
"pixels_areas": datasets.Value("int64"),
|
69 |
+
"x_perimeter": datasets.Value("int64"),
|
70 |
+
"y_perimeter": datasets.Value("int64"),
|
71 |
+
"sum_of_luminosity": datasets.Value("int64"),
|
72 |
+
"minimum_of_luminosity": datasets.Value("int64"),
|
73 |
+
"maximum_of_luminosity": datasets.Value("int64"),
|
74 |
+
"length_of_conveyer": datasets.Value("int64"),
|
75 |
+
"typeofsteel_a300": datasets.Value("int64"),
|
76 |
+
"typeofsteel_a400": datasets.Value("int64"),
|
77 |
+
"steel_plate_thickness": datasets.Value("int64"),
|
78 |
+
"edges_index": datasets.Value("float64"),
|
79 |
+
"empty_index": datasets.Value("float64"),
|
80 |
+
"square_index": datasets.Value("float64"),
|
81 |
+
"outside_x_index": datasets.Value("float64"),
|
82 |
+
"edges_x_index": datasets.Value("float64"),
|
83 |
+
"edges_y_index": datasets.Value("float64"),
|
84 |
+
"outside_global_index": datasets.Value("float64"),
|
85 |
+
"logofareas": datasets.Value("float64"),
|
86 |
+
"log_x_index": datasets.Value("float64"),
|
87 |
+
"log_y_index": datasets.Value("float64"),
|
88 |
+
"orientation_index": datasets.Value("float64"),
|
89 |
+
"luminosity_index": datasets.Value("float64"),
|
90 |
+
"sigmoidofareas": datasets.Value("float64"),
|
91 |
+
"class": datasets.ClassLabel(num_classes=2),
|
92 |
+
},
|
93 |
+
"steel_plates_1": {
|
94 |
+
"x_minimum": datasets.Value("int64"),
|
95 |
+
"x_maximum": datasets.Value("int64"),
|
96 |
+
"y_minimum": datasets.Value("int64"),
|
97 |
+
"y_maximum": datasets.Value("int64"),
|
98 |
+
"pixels_areas": datasets.Value("int64"),
|
99 |
+
"x_perimeter": datasets.Value("int64"),
|
100 |
+
"y_perimeter": datasets.Value("int64"),
|
101 |
+
"sum_of_luminosity": datasets.Value("int64"),
|
102 |
+
"minimum_of_luminosity": datasets.Value("int64"),
|
103 |
+
"maximum_of_luminosity": datasets.Value("int64"),
|
104 |
+
"length_of_conveyer": datasets.Value("int64"),
|
105 |
+
"typeofsteel_a300": datasets.Value("int64"),
|
106 |
+
"typeofsteel_a400": datasets.Value("int64"),
|
107 |
+
"steel_plate_thickness": datasets.Value("int64"),
|
108 |
+
"edges_index": datasets.Value("float64"),
|
109 |
+
"empty_index": datasets.Value("float64"),
|
110 |
+
"square_index": datasets.Value("float64"),
|
111 |
+
"outside_x_index": datasets.Value("float64"),
|
112 |
+
"edges_x_index": datasets.Value("float64"),
|
113 |
+
"edges_y_index": datasets.Value("float64"),
|
114 |
+
"outside_global_index": datasets.Value("float64"),
|
115 |
+
"logofareas": datasets.Value("float64"),
|
116 |
+
"log_x_index": datasets.Value("float64"),
|
117 |
+
"log_y_index": datasets.Value("float64"),
|
118 |
+
"orientation_index": datasets.Value("float64"),
|
119 |
+
"luminosity_index": datasets.Value("float64"),
|
120 |
+
"sigmoidofareas": datasets.Value("float64"),
|
121 |
+
"class": datasets.ClassLabel(num_classes=2),
|
122 |
+
},
|
123 |
+
"steel_plates_2": {
|
124 |
+
"x_minimum": datasets.Value("int64"),
|
125 |
+
"x_maximum": datasets.Value("int64"),
|
126 |
+
"y_minimum": datasets.Value("int64"),
|
127 |
+
"y_maximum": datasets.Value("int64"),
|
128 |
+
"pixels_areas": datasets.Value("int64"),
|
129 |
+
"x_perimeter": datasets.Value("int64"),
|
130 |
+
"y_perimeter": datasets.Value("int64"),
|
131 |
+
"sum_of_luminosity": datasets.Value("int64"),
|
132 |
+
"minimum_of_luminosity": datasets.Value("int64"),
|
133 |
+
"maximum_of_luminosity": datasets.Value("int64"),
|
134 |
+
"length_of_conveyer": datasets.Value("int64"),
|
135 |
+
"typeofsteel_a300": datasets.Value("int64"),
|
136 |
+
"typeofsteel_a400": datasets.Value("int64"),
|
137 |
+
"steel_plate_thickness": datasets.Value("int64"),
|
138 |
+
"edges_index": datasets.Value("float64"),
|
139 |
+
"empty_index": datasets.Value("float64"),
|
140 |
+
"square_index": datasets.Value("float64"),
|
141 |
+
"outside_x_index": datasets.Value("float64"),
|
142 |
+
"edges_x_index": datasets.Value("float64"),
|
143 |
+
"edges_y_index": datasets.Value("float64"),
|
144 |
+
"outside_global_index": datasets.Value("float64"),
|
145 |
+
"logofareas": datasets.Value("float64"),
|
146 |
+
"log_x_index": datasets.Value("float64"),
|
147 |
+
"log_y_index": datasets.Value("float64"),
|
148 |
+
"orientation_index": datasets.Value("float64"),
|
149 |
+
"luminosity_index": datasets.Value("float64"),
|
150 |
+
"sigmoidofareas": datasets.Value("float64"),
|
151 |
+
"class": datasets.ClassLabel(num_classes=2),
|
152 |
+
},
|
153 |
+
"steel_plates_3": {
|
154 |
+
"x_minimum": datasets.Value("int64"),
|
155 |
+
"x_maximum": datasets.Value("int64"),
|
156 |
+
"y_minimum": datasets.Value("int64"),
|
157 |
+
"y_maximum": datasets.Value("int64"),
|
158 |
+
"pixels_areas": datasets.Value("int64"),
|
159 |
+
"x_perimeter": datasets.Value("int64"),
|
160 |
+
"y_perimeter": datasets.Value("int64"),
|
161 |
+
"sum_of_luminosity": datasets.Value("int64"),
|
162 |
+
"minimum_of_luminosity": datasets.Value("int64"),
|
163 |
+
"maximum_of_luminosity": datasets.Value("int64"),
|
164 |
+
"length_of_conveyer": datasets.Value("int64"),
|
165 |
+
"typeofsteel_a300": datasets.Value("int64"),
|
166 |
+
"typeofsteel_a400": datasets.Value("int64"),
|
167 |
+
"steel_plate_thickness": datasets.Value("int64"),
|
168 |
+
"edges_index": datasets.Value("float64"),
|
169 |
+
"empty_index": datasets.Value("float64"),
|
170 |
+
"square_index": datasets.Value("float64"),
|
171 |
+
"outside_x_index": datasets.Value("float64"),
|
172 |
+
"edges_x_index": datasets.Value("float64"),
|
173 |
+
"edges_y_index": datasets.Value("float64"),
|
174 |
+
"outside_global_index": datasets.Value("float64"),
|
175 |
+
"logofareas": datasets.Value("float64"),
|
176 |
+
"log_x_index": datasets.Value("float64"),
|
177 |
+
"log_y_index": datasets.Value("float64"),
|
178 |
+
"orientation_index": datasets.Value("float64"),
|
179 |
+
"luminosity_index": datasets.Value("float64"),
|
180 |
+
"sigmoidofareas": datasets.Value("float64"),
|
181 |
+
"class": datasets.ClassLabel(num_classes=2),
|
182 |
+
},
|
183 |
+
"steel_plates_4": {
|
184 |
+
"x_minimum": datasets.Value("int64"),
|
185 |
+
"x_maximum": datasets.Value("int64"),
|
186 |
+
"y_minimum": datasets.Value("int64"),
|
187 |
+
"y_maximum": datasets.Value("int64"),
|
188 |
+
"pixels_areas": datasets.Value("int64"),
|
189 |
+
"x_perimeter": datasets.Value("int64"),
|
190 |
+
"y_perimeter": datasets.Value("int64"),
|
191 |
+
"sum_of_luminosity": datasets.Value("int64"),
|
192 |
+
"minimum_of_luminosity": datasets.Value("int64"),
|
193 |
+
"maximum_of_luminosity": datasets.Value("int64"),
|
194 |
+
"length_of_conveyer": datasets.Value("int64"),
|
195 |
+
"typeofsteel_a300": datasets.Value("int64"),
|
196 |
+
"typeofsteel_a400": datasets.Value("int64"),
|
197 |
+
"steel_plate_thickness": datasets.Value("int64"),
|
198 |
+
"edges_index": datasets.Value("float64"),
|
199 |
+
"empty_index": datasets.Value("float64"),
|
200 |
+
"square_index": datasets.Value("float64"),
|
201 |
+
"outside_x_index": datasets.Value("float64"),
|
202 |
+
"edges_x_index": datasets.Value("float64"),
|
203 |
+
"edges_y_index": datasets.Value("float64"),
|
204 |
+
"outside_global_index": datasets.Value("float64"),
|
205 |
+
"logofareas": datasets.Value("float64"),
|
206 |
+
"log_x_index": datasets.Value("float64"),
|
207 |
+
"log_y_index": datasets.Value("float64"),
|
208 |
+
"orientation_index": datasets.Value("float64"),
|
209 |
+
"luminosity_index": datasets.Value("float64"),
|
210 |
+
"sigmoidofareas": datasets.Value("float64"),
|
211 |
+
"class": datasets.ClassLabel(num_classes=2),
|
212 |
+
},
|
213 |
+
"steel_plates_5": {
|
214 |
+
"x_minimum": datasets.Value("int64"),
|
215 |
+
"x_maximum": datasets.Value("int64"),
|
216 |
+
"y_minimum": datasets.Value("int64"),
|
217 |
+
"y_maximum": datasets.Value("int64"),
|
218 |
+
"pixels_areas": datasets.Value("int64"),
|
219 |
+
"x_perimeter": datasets.Value("int64"),
|
220 |
+
"y_perimeter": datasets.Value("int64"),
|
221 |
+
"sum_of_luminosity": datasets.Value("int64"),
|
222 |
+
"minimum_of_luminosity": datasets.Value("int64"),
|
223 |
+
"maximum_of_luminosity": datasets.Value("int64"),
|
224 |
+
"length_of_conveyer": datasets.Value("int64"),
|
225 |
+
"typeofsteel_a300": datasets.Value("int64"),
|
226 |
+
"typeofsteel_a400": datasets.Value("int64"),
|
227 |
+
"steel_plate_thickness": datasets.Value("int64"),
|
228 |
+
"edges_index": datasets.Value("float64"),
|
229 |
+
"empty_index": datasets.Value("float64"),
|
230 |
+
"square_index": datasets.Value("float64"),
|
231 |
+
"outside_x_index": datasets.Value("float64"),
|
232 |
+
"edges_x_index": datasets.Value("float64"),
|
233 |
+
"edges_y_index": datasets.Value("float64"),
|
234 |
+
"outside_global_index": datasets.Value("float64"),
|
235 |
+
"logofareas": datasets.Value("float64"),
|
236 |
+
"log_x_index": datasets.Value("float64"),
|
237 |
+
"log_y_index": datasets.Value("float64"),
|
238 |
+
"orientation_index": datasets.Value("float64"),
|
239 |
+
"luminosity_index": datasets.Value("float64"),
|
240 |
+
"sigmoidofareas": datasets.Value("float64"),
|
241 |
+
"class": datasets.ClassLabel(num_classes=2),
|
242 |
+
},
|
243 |
+
"steel_plates_6": {
|
244 |
+
"x_minimum": datasets.Value("int64"),
|
245 |
+
"x_maximum": datasets.Value("int64"),
|
246 |
+
"y_minimum": datasets.Value("int64"),
|
247 |
+
"y_maximum": datasets.Value("int64"),
|
248 |
+
"pixels_areas": datasets.Value("int64"),
|
249 |
+
"x_perimeter": datasets.Value("int64"),
|
250 |
+
"y_perimeter": datasets.Value("int64"),
|
251 |
+
"sum_of_luminosity": datasets.Value("int64"),
|
252 |
+
"minimum_of_luminosity": datasets.Value("int64"),
|
253 |
+
"maximum_of_luminosity": datasets.Value("int64"),
|
254 |
+
"length_of_conveyer": datasets.Value("int64"),
|
255 |
+
"typeofsteel_a300": datasets.Value("int64"),
|
256 |
+
"typeofsteel_a400": datasets.Value("int64"),
|
257 |
+
"steel_plate_thickness": datasets.Value("int64"),
|
258 |
+
"edges_index": datasets.Value("float64"),
|
259 |
+
"empty_index": datasets.Value("float64"),
|
260 |
+
"square_index": datasets.Value("float64"),
|
261 |
+
"outside_x_index": datasets.Value("float64"),
|
262 |
+
"edges_x_index": datasets.Value("float64"),
|
263 |
+
"edges_y_index": datasets.Value("float64"),
|
264 |
+
"outside_global_index": datasets.Value("float64"),
|
265 |
+
"logofareas": datasets.Value("float64"),
|
266 |
+
"log_x_index": datasets.Value("float64"),
|
267 |
+
"log_y_index": datasets.Value("float64"),
|
268 |
+
"orientation_index": datasets.Value("float64"),
|
269 |
+
"luminosity_index": datasets.Value("float64"),
|
270 |
+
"sigmoidofareas": datasets.Value("float64"),
|
271 |
+
"class": datasets.ClassLabel(num_classes=2),
|
272 |
+
},
|
273 |
+
|
274 |
+
}
|
275 |
+
features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
|
276 |
+
|
277 |
+
|
278 |
+
class LandsatConfig(datasets.BuilderConfig):
|
279 |
+
def __init__(self, **kwargs):
|
280 |
+
super(LandsatConfig, self).__init__(version=VERSION, **kwargs)
|
281 |
+
self.features = features_per_config[kwargs["name"]]
|
282 |
+
|
283 |
+
|
284 |
+
class Landsat(datasets.GeneratorBasedBuilder):
|
285 |
+
# dataset versions
|
286 |
+
DEFAULT_CONFIG = "steel_plates"
|
287 |
+
BUILDER_CONFIGS = [
|
288 |
+
LandsatConfig(name="steel_plates", description="Landsat for multiclass classification."),
|
289 |
+
LandsatConfig(name="steel_plates_0", description="Landsat for binary classification."),
|
290 |
+
LandsatConfig(name="steel_plates_1", description="Landsat for binary classification."),
|
291 |
+
LandsatConfig(name="steel_plates_2", description="Landsat for binary classification."),
|
292 |
+
LandsatConfig(name="steel_plates_3", description="Landsat for binary classification."),
|
293 |
+
LandsatConfig(name="steel_plates_4", description="Landsat for binary classification."),
|
294 |
+
LandsatConfig(name="steel_plates_5", description="Landsat for binary classification."),
|
295 |
+
LandsatConfig(name="steel_plates_5", description="Landsat for binary classification."),
|
296 |
+
|
297 |
+
]
|
298 |
+
|
299 |
+
|
300 |
+
def _info(self):
|
301 |
+
info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
|
302 |
+
features=features_per_config[self.config.name])
|
303 |
+
|
304 |
+
return info
|
305 |
+
|
306 |
+
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
307 |
+
downloads = dl_manager.download_and_extract(urls_per_split)
|
308 |
+
|
309 |
+
return [
|
310 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]}),
|
311 |
+
]
|
312 |
+
|
313 |
+
def _generate_examples(self, filepath: str):
|
314 |
+
data = pandas.read_csv(filepath)
|
315 |
+
data = self.preprocess(data)
|
316 |
+
|
317 |
+
for row_id, row in data.iterrows():
|
318 |
+
data_row = dict(row)
|
319 |
+
|
320 |
+
yield row_id, data_row
|
321 |
+
|
322 |
+
def preprocess(self, data: pandas.DataFrame) -> pandas.DataFrame:
|
323 |
+
if self.config.name == "steel_plates_0":
|
324 |
+
data["class"] = data["class"].apply(lambda x: 1 if x == 0 else 0)
|
325 |
+
elif self.config.name == "steel_plates_1":
|
326 |
+
data["class"] = data["class"].apply(lambda x: 1 if x == 1 else 0)
|
327 |
+
elif self.config.name == "steel_plates_2":
|
328 |
+
data["class"] = data["class"].apply(lambda x: 1 if x == 2 else 0)
|
329 |
+
elif self.config.name == "steel_plates_3":
|
330 |
+
data["class"] = data["class"].apply(lambda x: 1 if x == 3 else 0)
|
331 |
+
elif self.config.name == "steel_plates_4":
|
332 |
+
data["class"] = data["class"].apply(lambda x: 1 if x == 4 else 0)
|
333 |
+
elif self.config.name == "steel_plates_5":
|
334 |
+
data["class"] = data["class"].apply(lambda x: 1 if x == 5 else 0)
|
335 |
+
elif self.config.name == "steel_plates_6":
|
336 |
+
data["class"] = data["class"].apply(lambda x: 1 if x == 6 else 0)
|
337 |
+
|
338 |
+
for feature in _ENCODING_DICS:
|
339 |
+
encoding_function = partial(self.encode, feature)
|
340 |
+
data.loc[:, feature] = data[feature].apply(encoding_function)
|
341 |
+
|
342 |
+
return data[list(features_types_per_config[self.config.name].keys())]
|
343 |
+
|
344 |
+
def encode(self, feature, value):
|
345 |
+
if feature in _ENCODING_DICS:
|
346 |
+
return _ENCODING_DICS[feature][value]
|
347 |
+
raise ValueError(f"Unknown feature: {feature}")
|