parquet-converter commited on
Commit
ff3ffa0
·
1 Parent(s): 678d061

Update parquet files

Browse files
Files changed (4) hide show
  1. README.md +0 -34
  2. magic.py +0 -97
  3. magic/magic-train.parquet +3 -0
  4. magic04.data +0 -0
README.md DELETED
@@ -1,34 +0,0 @@
1
- ---
2
- language:
3
- - en
4
- tags:
5
- - magic
6
- - tabular_classification
7
- - binary_classification
8
- pretty_name: Magic
9
- size_categories:
10
- - 10K<n<100K
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
- - magic
15
- ---
16
- # Magic
17
- The [Magic dataset](https://archive.ics.uci.edu/ml/datasets/Magic) from the [UCI ML repository](https://archive.ics.uci.edu/ml/datasets).
18
-
19
- # Configurations and tasks
20
- | **Configuration** | **Task** | **Description** |
21
- |-------------------|---------------------------|---------------------------------------------------------------|
22
- | magic | Binary classification | Classify the person's magic as over or under the threshold. |
23
-
24
-
25
- # Usage
26
- ```python
27
- from datasets import load_dataset
28
-
29
- dataset = load_dataset("mstz/magic", "magic")["train"]
30
- ```
31
-
32
- # Features
33
- |**Feature** |**Type** | **Description** |
34
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
magic.py DELETED
@@ -1,97 +0,0 @@
1
- """Magic"""
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
- _BASE_FEATURE_NAMES = [
13
- "major_axis_length",
14
- "minor_axis_length",
15
- "log_of_sum_of_content",
16
- "ratio_of_sum_of_highest_pixels_and_size",
17
- "ratio_of_highest_pixel_and_size",
18
- "projected_distance_highest_to_center_pixel",
19
- "third_root_of_third_moment_along_major_axis",
20
- "third_root_of_third_moment_along_minor_axis",
21
- "angle_major_axis_to_origin",
22
- "distance_origin_to_center",
23
- "class"
24
- ]
25
-
26
-
27
- DESCRIPTION = "Magic dataset from the UCI ML repository."
28
- _HOMEPAGE = "https://archive.ics.uci.edu/ml/datasets/Magic"
29
- _URLS = ("https://archive.ics.uci.edu/ml/datasets/Magic")
30
- _CITATION = """
31
- @misc{misc_magic_gamma_telescope_159,
32
- author = {Bock,R.},
33
- title = {{MAGIC Gamma Telescope}},
34
- year = {2007},
35
- howpublished = {UCI Machine Learning Repository},
36
- note = {{DOI}: \\url{10.24432/C52C8B}}
37
- }"""
38
-
39
- # Dataset info
40
- urls_per_split = {
41
- "train": "https://huggingface.co/datasets/mstz/magic/raw/main/magic04.data"
42
- }
43
- features_types_per_config = {
44
- "magic": {
45
- "major_axis_length": datasets.Value("float64"),
46
- "minor_axis_length": datasets.Value("float64"),
47
- "log_of_sum_of_content": datasets.Value("float64"),
48
- "ratio_of_sum_of_highest_pixels_and_size": datasets.Value("float64"),
49
- "ratio_of_highest_pixel_and_size": datasets.Value("float64"),
50
- "projected_distance_highest_to_center_pixel": datasets.Value("float64"),
51
- "third_root_of_third_moment_along_major_axis": datasets.Value("float64"),
52
- "third_root_of_third_moment_along_minor_axis": datasets.Value("float64"),
53
- "angle_major_axis_to_origin": datasets.Value("float64"),
54
- "distance_origin_to_center": datasets.Value("float64"),
55
- "class": datasets.ClassLabel(num_classes=2, names=("no", "yes"))
56
- }
57
- }
58
- features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
59
-
60
-
61
- class MagicConfig(datasets.BuilderConfig):
62
- def __init__(self, **kwargs):
63
- super(MagicConfig, self).__init__(version=VERSION, **kwargs)
64
- self.features = features_per_config[kwargs["name"]]
65
-
66
-
67
- class Magic(datasets.GeneratorBasedBuilder):
68
- # dataset versions
69
- DEFAULT_CONFIG = "magic"
70
- BUILDER_CONFIGS = [
71
- MagicConfig(name="magic",
72
- description="Magic for binary classification.")
73
- ]
74
-
75
-
76
- def _info(self):
77
- info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
78
- features=features_per_config[self.config.name])
79
-
80
- return info
81
-
82
- def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
83
- downloads = dl_manager.download_and_extract(urls_per_split)
84
-
85
- return [
86
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]})
87
- ]
88
-
89
- def _generate_examples(self, filepath: str):
90
- data = pandas.read_csv(filepath, header=None)
91
- data.columns = _BASE_FEATURE_NAMES
92
- data.loc[:, "class"] = data["class"].apply(lambda x: 1 if x == "g" else 0)
93
-
94
- for row_id, row in data.iterrows():
95
- data_row = dict(row)
96
-
97
- yield row_id, data_row
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
magic/magic-train.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc1ff05ae731bad20bc481ca0ccb2b2350b977a337f2f0f3d531140485e38796
3
+ size 1589221
magic04.data DELETED
The diff for this file is too large to render. See raw diff