Datasets:
Upload 3 files
Browse files- README.md +28 -1
- arrhythmia.data +0 -0
- arrhythmia.py +354 -0
README.md
CHANGED
@@ -1,3 +1,30 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
tags:
|
5 |
+
- arrhythmia
|
6 |
+
- tabular_classification
|
7 |
+
- multiclass_classification
|
8 |
+
pretty_name: Arrhythmia
|
9 |
+
size_categories:
|
10 |
+
- 100<n<1K
|
11 |
+
task_categories: # Full list at https://github.com/huggingface/hub-docs/blob/main/js/src/lib/interfaces/Types.ts
|
12 |
+
- tabular-classification
|
13 |
+
configs:
|
14 |
+
- arrhytmia
|
15 |
---
|
16 |
+
# Arrhythmia
|
17 |
+
The [Arrhythmia dataset](https://archive.ics.uci.edu/ml/datasets/Arrhythmia) from the [UCI ML repository](https://archive.ics.uci.edu/ml/datasets).
|
18 |
+
|
19 |
+
# Configurations and tasks
|
20 |
+
| **Configuration** | **Task** | Description |
|
21 |
+
|-------------------|---------------------------|---------------------------------------------------------------|
|
22 |
+
| arrhytmia | Multiclass classification | Classify the arrhytmia type of the patient. |
|
23 |
+
|
24 |
+
# Usage
|
25 |
+
```
|
26 |
+
from datasets import load_dataset
|
27 |
+
from sklearn.tree import DecisionTreeClassifier
|
28 |
+
|
29 |
+
dataset = load_dataset("mstz/arrhythmia", "arrhytmia")["train"]
|
30 |
+
```
|
arrhythmia.data
ADDED
The diff for this file is too large to render.
See raw diff
|
|
arrhythmia.py
ADDED
@@ -0,0 +1,354 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import List
|
2 |
+
from functools import partial
|
3 |
+
|
4 |
+
import datasets
|
5 |
+
|
6 |
+
import pandas
|
7 |
+
|
8 |
+
|
9 |
+
VERSION = datasets.Version("1.0.0")
|
10 |
+
|
11 |
+
DESCRIPTION = "Arrhytmia dataset from the UCI ML repository."
|
12 |
+
_HOMEPAGE = "https://archive-beta.ics.uci.edu/dataset/5/arrhythmia"
|
13 |
+
_URLS = ("https://archive-beta.ics.uci.edu/dataset/5/arrhythmia")
|
14 |
+
_CITATION = """
|
15 |
+
@misc{misc_arrhythmia_5,
|
16 |
+
author = {Guvenir,H., Acar,Burak & Muderrisoglu,Haldun},
|
17 |
+
title = {{Arrhythmia}},
|
18 |
+
year = {1998},
|
19 |
+
howpublished = {UCI Machine Learning Repository},
|
20 |
+
note = {{DOI}: \\url{10.24432/C5BS32}}
|
21 |
+
}"""
|
22 |
+
|
23 |
+
# Dataset info
|
24 |
+
urls_per_split = {
|
25 |
+
"train": "https://huggingface.co/datasets/mstz/adult/raw/main/arrhythmia.data"
|
26 |
+
}
|
27 |
+
features_types_per_config = {
|
28 |
+
"arrhythmia": {
|
29 |
+
"age": datasets.Value("int8"),
|
30 |
+
"is_female": datasets.Value("bool"),
|
31 |
+
"height": datasets.Value("float64"),
|
32 |
+
"qrs_duration": datasets.Value("float64"),
|
33 |
+
"p_r_interval": datasets.Value("float64"),
|
34 |
+
"q_t_interval": datasets.Value("float64"),
|
35 |
+
"t_interval": datasets.Value("float64"),
|
36 |
+
"p_interval": datasets.Value("float64"),
|
37 |
+
"qrs": datasets.Value("float64"),
|
38 |
+
"t": datasets.Value("float64"),
|
39 |
+
"p": datasets.Value("float64"),
|
40 |
+
"qrst": datasets.Value("float64"),
|
41 |
+
"j": datasets.Value("float64"),
|
42 |
+
"heart_rate": datasets.Value("float64"),
|
43 |
+
"average_witdth_of_wave_q_on_DI": datasets.Value("float64"),
|
44 |
+
"average_witdth_of_wave_r_on_DI": datasets.Value("float64"),
|
45 |
+
"average_witdth_of_wave_s_on_DI": datasets.Value("float64"),
|
46 |
+
"average_witdth_of_wave_rprime_on_DI": datasets.Value("float64"),
|
47 |
+
"average_witdth_of_wave_sprime_on_DI": datasets.Value("float64"),
|
48 |
+
"number_of_deflections_on_DI": datasets.Value("float64"),
|
49 |
+
"type_of_ragged_r_wave_on_DI": datasets.Value("float64"),
|
50 |
+
"type_of_diphasic_derivation_of_r_wave_on_DI": datasets.Value("float64"),
|
51 |
+
"type_of_ragged_p_wave_on_DI": datasets.Value("float64"),
|
52 |
+
"type_of_diphasic_derivation_of_p_wave_on_DI": datasets.Value("float64"),
|
53 |
+
"type_of_ragged_t_wave_on_DI": datasets.Value("float64"),
|
54 |
+
"type_of_diphasic_derivation_of_t_wave_on_DI": datasets.Value("float64"),
|
55 |
+
"average_witdth_of_wave_q_on_DII": datasets.Value("float64"),
|
56 |
+
"average_witdth_of_wave_r_on_DII": datasets.Value("float64"),
|
57 |
+
"average_witdth_of_wave_s_on_DII": datasets.Value("float64"),
|
58 |
+
"average_witdth_of_wave_rprime_on_DII": datasets.Value("float64"),
|
59 |
+
"average_witdth_of_wave_sprime_on_DII": datasets.Value("float64"),
|
60 |
+
"number_of_deflections_on_DII": datasets.Value("float64"),
|
61 |
+
"type_of_ragged_r_wave_on_DII": datasets.Value("float64"),
|
62 |
+
"type_of_diphasic_derivation_of_r_wave_on_DII": datasets.Value("float64"),
|
63 |
+
"type_of_ragged_p_wave_on_DII": datasets.Value("float64"),
|
64 |
+
"type_of_diphasic_derivation_of_p_wave_on_DII": datasets.Value("float64"),
|
65 |
+
"type_of_ragged_t_wave_on_DII": datasets.Value("float64"),
|
66 |
+
"type_of_diphasic_derivation_of_t_wave_on_DII": datasets.Value("float64"),
|
67 |
+
"average_witdth_of_wave_q_on_DIII": datasets.Value("float64"),
|
68 |
+
"average_witdth_of_wave_r_on_DIII": datasets.Value("float64"),
|
69 |
+
"average_witdth_of_wave_s_on_DIII": datasets.Value("float64"),
|
70 |
+
"average_witdth_of_wave_rprime_on_DIII": datasets.Value("float64"),
|
71 |
+
"average_witdth_of_wave_sprime_on_DIII": datasets.Value("float64"),
|
72 |
+
"number_of_deflections_on_DIII": datasets.Value("float64"),
|
73 |
+
"type_of_ragged_r_wave_on_DIII": datasets.Value("float64"),
|
74 |
+
"type_of_diphasic_derivation_of_r_wave_on_DIII": datasets.Value("float64"),
|
75 |
+
"type_of_ragged_p_wave_on_DIII": datasets.Value("float64"),
|
76 |
+
"type_of_diphasic_derivation_of_p_wave_on_DIII": datasets.Value("float64"),
|
77 |
+
"type_of_ragged_t_wave_on_DIII": datasets.Value("float64"),
|
78 |
+
"type_of_diphasic_derivation_of_t_wave_on_DIII": datasets.Value("float64"),
|
79 |
+
"average_witdth_of_wave_q_on_AVR": datasets.Value("float64"),
|
80 |
+
"average_witdth_of_wave_r_on_AVR": datasets.Value("float64"),
|
81 |
+
"average_witdth_of_wave_s_on_AVR": datasets.Value("float64"),
|
82 |
+
"average_witdth_of_wave_rprime_on_AVR": datasets.Value("float64"),
|
83 |
+
"average_witdth_of_wave_sprime_on_AVR": datasets.Value("float64"),
|
84 |
+
"number_of_deflections_on_AVR": datasets.Value("float64"),
|
85 |
+
"type_of_ragged_r_wave_on_AVR": datasets.Value("float64"),
|
86 |
+
"type_of_diphasic_derivation_of_r_wave_on_AVR": datasets.Value("float64"),
|
87 |
+
"type_of_ragged_p_wave_on_AVR": datasets.Value("float64"),
|
88 |
+
"type_of_diphasic_derivation_of_p_wave_on_AVR": datasets.Value("float64"),
|
89 |
+
"type_of_ragged_t_wave_on_AVR": datasets.Value("float64"),
|
90 |
+
"type_of_diphasic_derivation_of_t_wave_on_AVR": datasets.Value("float64"),
|
91 |
+
"average_witdth_of_wave_q_on_AVL": datasets.Value("float64"),
|
92 |
+
"average_witdth_of_wave_r_on_AVL": datasets.Value("float64"),
|
93 |
+
"average_witdth_of_wave_s_on_AVL": datasets.Value("float64"),
|
94 |
+
"average_witdth_of_wave_rprime_on_AVL": datasets.Value("float64"),
|
95 |
+
"average_witdth_of_wave_sprime_on_AVL": datasets.Value("float64"),
|
96 |
+
"number_of_deflections_on_AVL": datasets.Value("float64"),
|
97 |
+
"type_of_ragged_r_wave_on_AVL": datasets.Value("float64"),
|
98 |
+
"type_of_diphasic_derivation_of_r_wave_on_AVL": datasets.Value("float64"),
|
99 |
+
"type_of_ragged_p_wave_on_AVL": datasets.Value("float64"),
|
100 |
+
"type_of_diphasic_derivation_of_p_wave_on_AVL": datasets.Value("float64"),
|
101 |
+
"type_of_ragged_t_wave_on_AVL": datasets.Value("float64"),
|
102 |
+
"type_of_diphasic_derivation_of_t_wave_on_AVL": datasets.Value("float64"),
|
103 |
+
"average_witdth_of_wave_q_on_AVF": datasets.Value("float64"),
|
104 |
+
"average_witdth_of_wave_r_on_AVF": datasets.Value("float64"),
|
105 |
+
"average_witdth_of_wave_s_on_AVF": datasets.Value("float64"),
|
106 |
+
"average_witdth_of_wave_rprime_on_AVF": datasets.Value("float64"),
|
107 |
+
"average_witdth_of_wave_sprime_on_AVF": datasets.Value("float64"),
|
108 |
+
"number_of_deflections_on_AVF": datasets.Value("float64"),
|
109 |
+
"type_of_ragged_r_wave_on_AVF": datasets.Value("float64"),
|
110 |
+
"type_of_diphasic_derivation_of_r_wave_on_AVF": datasets.Value("float64"),
|
111 |
+
"type_of_ragged_p_wave_on_AVF": datasets.Value("float64"),
|
112 |
+
"type_of_diphasic_derivation_of_p_wave_on_AVF": datasets.Value("float64"),
|
113 |
+
"type_of_ragged_t_wave_on_AVF": datasets.Value("float64"),
|
114 |
+
"type_of_diphasic_derivation_of_t_wave_on_AVF": datasets.Value("float64"),
|
115 |
+
"average_witdth_of_wave_q_on_V1": datasets.Value("float64"),
|
116 |
+
"average_witdth_of_wave_r_on_V1": datasets.Value("float64"),
|
117 |
+
"average_witdth_of_wave_s_on_V1": datasets.Value("float64"),
|
118 |
+
"average_witdth_of_wave_rprime_on_V1": datasets.Value("float64"),
|
119 |
+
"average_witdth_of_wave_sprime_on_V1": datasets.Value("float64"),
|
120 |
+
"number_of_deflections_on_V1": datasets.Value("float64"),
|
121 |
+
"type_of_ragged_r_wave_on_V1": datasets.Value("float64"),
|
122 |
+
"type_of_diphasic_derivation_of_r_wave_on_V1": datasets.Value("float64"),
|
123 |
+
"type_of_ragged_p_wave_on_V1": datasets.Value("float64"),
|
124 |
+
"type_of_diphasic_derivation_of_p_wave_on_V1": datasets.Value("float64"),
|
125 |
+
"type_of_ragged_t_wave_on_V1": datasets.Value("float64"),
|
126 |
+
"type_of_diphasic_derivation_of_t_wave_on_V1": datasets.Value("float64"),
|
127 |
+
"average_witdth_of_wave_q_on_V2": datasets.Value("float64"),
|
128 |
+
"average_witdth_of_wave_r_on_V2": datasets.Value("float64"),
|
129 |
+
"average_witdth_of_wave_s_on_V2": datasets.Value("float64"),
|
130 |
+
"average_witdth_of_wave_rprime_on_V2": datasets.Value("float64"),
|
131 |
+
"average_witdth_of_wave_sprime_on_V2": datasets.Value("float64"),
|
132 |
+
"number_of_deflections_on_V2": datasets.Value("float64"),
|
133 |
+
"type_of_ragged_r_wave_on_V2": datasets.Value("float64"),
|
134 |
+
"type_of_diphasic_derivation_of_r_wave_on_V2": datasets.Value("float64"),
|
135 |
+
"type_of_ragged_p_wave_on_V2": datasets.Value("float64"),
|
136 |
+
"type_of_diphasic_derivation_of_p_wave_on_V2": datasets.Value("float64"),
|
137 |
+
"type_of_ragged_t_wave_on_V2": datasets.Value("float64"),
|
138 |
+
"type_of_diphasic_derivation_of_t_wave_on_V2": datasets.Value("float64"),
|
139 |
+
"average_witdth_of_wave_q_on_V3": datasets.Value("float64"),
|
140 |
+
"average_witdth_of_wave_r_on_V3": datasets.Value("float64"),
|
141 |
+
"average_witdth_of_wave_s_on_V3": datasets.Value("float64"),
|
142 |
+
"average_witdth_of_wave_rprime_on_V3": datasets.Value("float64"),
|
143 |
+
"average_witdth_of_wave_sprime_on_V3": datasets.Value("float64"),
|
144 |
+
"number_of_deflections_on_V3": datasets.Value("float64"),
|
145 |
+
"type_of_ragged_r_wave_on_V3": datasets.Value("float64"),
|
146 |
+
"type_of_diphasic_derivation_of_r_wave_on_V3": datasets.Value("float64"),
|
147 |
+
"type_of_ragged_p_wave_on_V3": datasets.Value("float64"),
|
148 |
+
"type_of_diphasic_derivation_of_p_wave_on_V3": datasets.Value("float64"),
|
149 |
+
"type_of_ragged_t_wave_on_V3": datasets.Value("float64"),
|
150 |
+
"type_of_diphasic_derivation_of_t_wave_on_V3": datasets.Value("float64"),
|
151 |
+
"average_witdth_of_wave_q_on_V4": datasets.Value("float64"),
|
152 |
+
"average_witdth_of_wave_r_on_V4": datasets.Value("float64"),
|
153 |
+
"average_witdth_of_wave_s_on_V4": datasets.Value("float64"),
|
154 |
+
"average_witdth_of_wave_rprime_on_V4": datasets.Value("float64"),
|
155 |
+
"average_witdth_of_wave_sprime_on_V4": datasets.Value("float64"),
|
156 |
+
"number_of_deflections_on_V4": datasets.Value("float64"),
|
157 |
+
"type_of_ragged_r_wave_on_V4": datasets.Value("float64"),
|
158 |
+
"type_of_diphasic_derivation_of_r_wave_on_V4": datasets.Value("float64"),
|
159 |
+
"type_of_ragged_p_wave_on_V4": datasets.Value("float64"),
|
160 |
+
"type_of_diphasic_derivation_of_p_wave_on_V4": datasets.Value("float64"),
|
161 |
+
"type_of_ragged_t_wave_on_V4": datasets.Value("float64"),
|
162 |
+
"type_of_diphasic_derivation_of_t_wave_on_V4": datasets.Value("float64"),
|
163 |
+
"average_witdth_of_wave_q_on_V5": datasets.Value("float64"),
|
164 |
+
"average_witdth_of_wave_r_on_V5": datasets.Value("float64"),
|
165 |
+
"average_witdth_of_wave_s_on_V5": datasets.Value("float64"),
|
166 |
+
"average_witdth_of_wave_rprime_on_V5": datasets.Value("float64"),
|
167 |
+
"average_witdth_of_wave_sprime_on_V5": datasets.Value("float64"),
|
168 |
+
"number_of_deflections_on_V5": datasets.Value("float64"),
|
169 |
+
"type_of_ragged_r_wave_on_V5": datasets.Value("float64"),
|
170 |
+
"type_of_diphasic_derivation_of_r_wave_on_V5": datasets.Value("float64"),
|
171 |
+
"type_of_ragged_p_wave_on_V5": datasets.Value("float64"),
|
172 |
+
"type_of_diphasic_derivation_of_p_wave_on_V5": datasets.Value("float64"),
|
173 |
+
"type_of_ragged_t_wave_on_V5": datasets.Value("float64"),
|
174 |
+
"type_of_diphasic_derivation_of_t_wave_on_V5": datasets.Value("float64"),
|
175 |
+
"average_witdth_of_wave_q_on_V6": datasets.Value("float64"),
|
176 |
+
"average_witdth_of_wave_r_on_V6": datasets.Value("float64"),
|
177 |
+
"average_witdth_of_wave_s_on_V6": datasets.Value("float64"),
|
178 |
+
"average_witdth_of_wave_rprime_on_V6": datasets.Value("float64"),
|
179 |
+
"average_witdth_of_wave_sprime_on_V6": datasets.Value("float64"),
|
180 |
+
"number_of_deflections_on_V6": datasets.Value("float64"),
|
181 |
+
"type_of_ragged_r_wave_on_V6": datasets.Value("float64"),
|
182 |
+
"type_of_diphasic_derivation_of_r_wave_on_V6": datasets.Value("float64"),
|
183 |
+
"type_of_ragged_p_wave_on_V6": datasets.Value("float64"),
|
184 |
+
"type_of_diphasic_derivation_of_p_wave_on_V6": datasets.Value("float64"),
|
185 |
+
"type_of_ragged_t_wave_on_V6": datasets.Value("float64"),
|
186 |
+
"type_of_diphasic_derivation_of_t_wave_on_V6": datasets.Value("float64"),
|
187 |
+
"amplitude_of_jj_wave_on_DI": datasets.Value("float64"),
|
188 |
+
"amplitude_of_q_wave_on_DI": datasets.Value("float64"),
|
189 |
+
"amplitude_of_r_wave_on_DI": datasets.Value("float64"),
|
190 |
+
"amplitude_of_s_wave_on_DI": datasets.Value("float64"),
|
191 |
+
"amplitude_of_rprime_wave_on_DI": datasets.Value("float64"),
|
192 |
+
"amplitude_of_sprime_wave_on_DI": datasets.Value("float64"),
|
193 |
+
"amplitude_of_p_wave_on_DI": datasets.Value("float64"),
|
194 |
+
"amplitude_of_t_wave_on_DI": datasets.Value("float64"),
|
195 |
+
"qrsa_on_DI": datasets.Value("float64"),
|
196 |
+
"qrsta_on_DI": datasets.Value("float64"),
|
197 |
+
"amplitude_of_jj_wave_on_DII": datasets.Value("float64"),
|
198 |
+
"amplitude_of_q_wave_on_DII": datasets.Value("float64"),
|
199 |
+
"amplitude_of_r_wave_on_DII": datasets.Value("float64"),
|
200 |
+
"amplitude_of_s_wave_on_DII": datasets.Value("float64"),
|
201 |
+
"amplitude_of_rprime_wave_on_DII": datasets.Value("float64"),
|
202 |
+
"amplitude_of_sprime_wave_on_DII": datasets.Value("float64"),
|
203 |
+
"amplitude_of_p_wave_on_DII": datasets.Value("float64"),
|
204 |
+
"amplitude_of_t_wave_on_DII": datasets.Value("float64"),
|
205 |
+
"qrsa_on_DII": datasets.Value("float64"),
|
206 |
+
"qrsta_on_DII": datasets.Value("float64"),
|
207 |
+
"amplitude_of_jj_wave_on_DIII": datasets.Value("float64"),
|
208 |
+
"amplitude_of_q_wave_on_DIII": datasets.Value("float64"),
|
209 |
+
"amplitude_of_r_wave_on_DIII": datasets.Value("float64"),
|
210 |
+
"amplitude_of_s_wave_on_DIII": datasets.Value("float64"),
|
211 |
+
"amplitude_of_rprime_wave_on_DIII": datasets.Value("float64"),
|
212 |
+
"amplitude_of_sprime_wave_on_DIII": datasets.Value("float64"),
|
213 |
+
"amplitude_of_p_wave_on_DIII": datasets.Value("float64"),
|
214 |
+
"amplitude_of_t_wave_on_DIII": datasets.Value("float64"),
|
215 |
+
"qrsa_on_DIII": datasets.Value("float64"),
|
216 |
+
"qrsta_on_DIII": datasets.Value("float64"),
|
217 |
+
"amplitude_of_jj_wave_on_AVR": datasets.Value("float64"),
|
218 |
+
"amplitude_of_q_wave_on_AVR": datasets.Value("float64"),
|
219 |
+
"amplitude_of_r_wave_on_AVR": datasets.Value("float64"),
|
220 |
+
"amplitude_of_s_wave_on_AVR": datasets.Value("float64"),
|
221 |
+
"amplitude_of_rprime_wave_on_AVR": datasets.Value("float64"),
|
222 |
+
"amplitude_of_sprime_wave_on_AVR": datasets.Value("float64"),
|
223 |
+
"amplitude_of_p_wave_on_AVR": datasets.Value("float64"),
|
224 |
+
"amplitude_of_t_wave_on_AVR": datasets.Value("float64"),
|
225 |
+
"qrsa_on_AVR": datasets.Value("float64"),
|
226 |
+
"qrsta_on_AVR": datasets.Value("float64"),
|
227 |
+
"amplitude_of_jj_wave_on_AVL": datasets.Value("float64"),
|
228 |
+
"amplitude_of_q_wave_on_AVL": datasets.Value("float64"),
|
229 |
+
"amplitude_of_r_wave_on_AVL": datasets.Value("float64"),
|
230 |
+
"amplitude_of_s_wave_on_AVL": datasets.Value("float64"),
|
231 |
+
"amplitude_of_rprime_wave_on_AVL": datasets.Value("float64"),
|
232 |
+
"amplitude_of_sprime_wave_on_AVL": datasets.Value("float64"),
|
233 |
+
"amplitude_of_p_wave_on_AVL": datasets.Value("float64"),
|
234 |
+
"amplitude_of_t_wave_on_AVL": datasets.Value("float64"),
|
235 |
+
"qrsa_on_AVL": datasets.Value("float64"),
|
236 |
+
"qrsta_on_AVL": datasets.Value("float64"),
|
237 |
+
"amplitude_of_jj_wave_on_AVF": datasets.Value("float64"),
|
238 |
+
"amplitude_of_q_wave_on_AVF": datasets.Value("float64"),
|
239 |
+
"amplitude_of_r_wave_on_AVF": datasets.Value("float64"),
|
240 |
+
"amplitude_of_s_wave_on_AVF": datasets.Value("float64"),
|
241 |
+
"amplitude_of_rprime_wave_on_AVF": datasets.Value("float64"),
|
242 |
+
"amplitude_of_sprime_wave_on_AVF": datasets.Value("float64"),
|
243 |
+
"amplitude_of_p_wave_on_AVF": datasets.Value("float64"),
|
244 |
+
"amplitude_of_t_wave_on_AVF": datasets.Value("float64"),
|
245 |
+
"qrsa_on_AVF": datasets.Value("float64"),
|
246 |
+
"qrsta_on_AVF": datasets.Value("float64"),
|
247 |
+
"amplitude_of_jj_wave_on_V1": datasets.Value("float64"),
|
248 |
+
"amplitude_of_q_wave_on_V1": datasets.Value("float64"),
|
249 |
+
"amplitude_of_r_wave_on_V1": datasets.Value("float64"),
|
250 |
+
"amplitude_of_s_wave_on_V1": datasets.Value("float64"),
|
251 |
+
"amplitude_of_rprime_wave_on_V1": datasets.Value("float64"),
|
252 |
+
"amplitude_of_sprime_wave_on_V1": datasets.Value("float64"),
|
253 |
+
"amplitude_of_p_wave_on_V1": datasets.Value("float64"),
|
254 |
+
"amplitude_of_t_wave_on_V1": datasets.Value("float64"),
|
255 |
+
"qrsa_on_V1": datasets.Value("float64"),
|
256 |
+
"qrsta_on_V1": datasets.Value("float64"),
|
257 |
+
"amplitude_of_jj_wave_on_V2": datasets.Value("float64"),
|
258 |
+
"amplitude_of_q_wave_on_V2": datasets.Value("float64"),
|
259 |
+
"amplitude_of_r_wave_on_V2": datasets.Value("float64"),
|
260 |
+
"amplitude_of_s_wave_on_V2": datasets.Value("float64"),
|
261 |
+
"amplitude_of_rprime_wave_on_V2": datasets.Value("float64"),
|
262 |
+
"amplitude_of_sprime_wave_on_V2": datasets.Value("float64"),
|
263 |
+
"amplitude_of_p_wave_on_V2": datasets.Value("float64"),
|
264 |
+
"amplitude_of_t_wave_on_V2": datasets.Value("float64"),
|
265 |
+
"qrsa_on_V2": datasets.Value("float64"),
|
266 |
+
"qrsta_on_V2": datasets.Value("float64"),
|
267 |
+
"amplitude_of_jj_wave_on_V3": datasets.Value("float64"),
|
268 |
+
"amplitude_of_q_wave_on_V3": datasets.Value("float64"),
|
269 |
+
"amplitude_of_r_wave_on_V3": datasets.Value("float64"),
|
270 |
+
"amplitude_of_s_wave_on_V3": datasets.Value("float64"),
|
271 |
+
"amplitude_of_rprime_wave_on_V3": datasets.Value("float64"),
|
272 |
+
"amplitude_of_sprime_wave_on_V3": datasets.Value("float64"),
|
273 |
+
"amplitude_of_p_wave_on_V3": datasets.Value("float64"),
|
274 |
+
"amplitude_of_t_wave_on_V3": datasets.Value("float64"),
|
275 |
+
"qrsa_on_V3": datasets.Value("float64"),
|
276 |
+
"qrsta_on_V3": datasets.Value("float64"),
|
277 |
+
"amplitude_of_jj_wave_on_V4": datasets.Value("float64"),
|
278 |
+
"amplitude_of_q_wave_on_V4": datasets.Value("float64"),
|
279 |
+
"amplitude_of_r_wave_on_V4": datasets.Value("float64"),
|
280 |
+
"amplitude_of_s_wave_on_V4": datasets.Value("float64"),
|
281 |
+
"amplitude_of_rprime_wave_on_V4": datasets.Value("float64"),
|
282 |
+
"amplitude_of_sprime_wave_on_V4": datasets.Value("float64"),
|
283 |
+
"amplitude_of_p_wave_on_V4": datasets.Value("float64"),
|
284 |
+
"amplitude_of_t_wave_on_V4": datasets.Value("float64"),
|
285 |
+
"qrsa_on_V4": datasets.Value("float64"),
|
286 |
+
"qrsta_on_V4": datasets.Value("float64"),
|
287 |
+
"amplitude_of_jj_wave_on_V5": datasets.Value("float64"),
|
288 |
+
"amplitude_of_q_wave_on_V5": datasets.Value("float64"),
|
289 |
+
"amplitude_of_r_wave_on_V5": datasets.Value("float64"),
|
290 |
+
"amplitude_of_s_wave_on_V5": datasets.Value("float64"),
|
291 |
+
"amplitude_of_rprime_wave_on_V5": datasets.Value("float64"),
|
292 |
+
"amplitude_of_sprime_wave_on_V5": datasets.Value("float64"),
|
293 |
+
"amplitude_of_p_wave_on_V5": datasets.Value("float64"),
|
294 |
+
"amplitude_of_t_wave_on_V5": datasets.Value("float64"),
|
295 |
+
"qrsa_on_V5": datasets.Value("float64"),
|
296 |
+
"qrsta_on_V5": datasets.Value("float64"),
|
297 |
+
"amplitude_of_jj_wave_on_V6": datasets.Value("float64"),
|
298 |
+
"amplitude_of_q_wave_on_V6": datasets.Value("float64"),
|
299 |
+
"amplitude_of_r_wave_on_V6": datasets.Value("float64"),
|
300 |
+
"amplitude_of_s_wave_on_V6": datasets.Value("float64"),
|
301 |
+
"amplitude_of_rprime_wave_on_V6": datasets.Value("float64"),
|
302 |
+
"amplitude_of_sprime_wave_on_V6": datasets.Value("float64"),
|
303 |
+
"amplitude_of_p_wave_on_V6": datasets.Value("float64"),
|
304 |
+
"amplitude_of_t_wave_on_V6": datasets.Value("float64"),
|
305 |
+
"qrsa_on_V6": datasets.Value("float64"),
|
306 |
+
"qrsta_on_V6": datasets.Value("float64"),
|
307 |
+
"type_of_arrhytmia": datasets.ClassLabel(num_classes=16)
|
308 |
+
}
|
309 |
+
}
|
310 |
+
features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
|
311 |
+
|
312 |
+
|
313 |
+
class ArrhythmiaConfig(datasets.BuilderConfig):
|
314 |
+
def __init__(self, **kwargs):
|
315 |
+
super(ArrhythmiaConfig, self).__init__(version=VERSION, **kwargs)
|
316 |
+
self.features = features_per_config[kwargs["name"]]
|
317 |
+
|
318 |
+
|
319 |
+
class Arrhythmia(datasets.GeneratorBasedBuilder):
|
320 |
+
# dataset versions
|
321 |
+
DEFAULT_CONFIG = "arrhytmia"
|
322 |
+
BUILDER_CONFIGS = [
|
323 |
+
ArrhythmiaConfig(name="arrhytmia",
|
324 |
+
description="Multiclass classification of arrhytmia type."),
|
325 |
+
]
|
326 |
+
|
327 |
+
|
328 |
+
def _info(self):
|
329 |
+
info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
|
330 |
+
features=features_per_config[self.config.name])
|
331 |
+
|
332 |
+
return info
|
333 |
+
|
334 |
+
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
335 |
+
downloads = dl_manager.download_and_extract(urls_per_split)
|
336 |
+
|
337 |
+
return [
|
338 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]})
|
339 |
+
]
|
340 |
+
|
341 |
+
def _generate_examples(self, filepath: str):
|
342 |
+
data = pandas.read_csv(filepath)
|
343 |
+
data = self.preprocess(data, config=self.config.name)
|
344 |
+
|
345 |
+
for row_id, row in data.iterrows():
|
346 |
+
data_row = dict(row)
|
347 |
+
|
348 |
+
yield row_id, data_row
|
349 |
+
|
350 |
+
def preprocess(self, data: pandas.DataFrame, config: str = DEFAULT_CONFIG) -> pandas.DataFrame:
|
351 |
+
data = data[(data.t != "?") & (data.qrst != "?") & (data.p != "?") & (data.j != "?") & (data.heart_rate != "?")]
|
352 |
+
data = data.astype({"t": int, "qrst": int, "p": int, "j": int, "heart_rate": int})
|
353 |
+
|
354 |
+
return data[list(features_types_per_config["income"].keys())]
|