mstz commited on
Commit
3d26742
·
1 Parent(s): 53b5496

Upload 3 files

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. README.md +52 -0
  3. higgs.csv +3 -0
  4. higgs.py +143 -0
.gitattributes CHANGED
@@ -52,3 +52,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
52
  *.jpg filter=lfs diff=lfs merge=lfs -text
53
  *.jpeg filter=lfs diff=lfs merge=lfs -text
54
  *.webp filter=lfs diff=lfs merge=lfs -text
 
 
52
  *.jpg filter=lfs diff=lfs merge=lfs -text
53
  *.jpeg filter=lfs diff=lfs merge=lfs -text
54
  *.webp filter=lfs diff=lfs merge=lfs -text
55
+ higgs.csv filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ tags:
5
+ - higgs
6
+ - tabular_classification
7
+ - binary_classification
8
+ pretty_name: Higgs
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
+ - higgs
15
+ ---
16
+ # Higgs
17
+ The [Higgs dataset](https://www.nature.com/articles/ncomms5308/) from "[Searching for exotic particles in high-energy physics with deep learning](https://www.nature.com/articles/ncomms5308/)".
18
+
19
+ # Configurations and tasks
20
+ - `higgs` Higgs boson identification;
21
+
22
+ # Features
23
+ |**Feature** |**Type** |
24
+ |---------------------------|-----------|
25
+ |`lepton_pT` |`[float64]`|
26
+ |`lepton_eta` |`[float64]`|
27
+ |`lepton_phi` |`[float64]`|
28
+ |`missing_energy_magnitude` |`[float64]`|
29
+ |`missing_energy_phi` |`[float64]`|
30
+ |`jet1pt` |`[float64]`|
31
+ |`jet1eta` |`[float64]`|
32
+ |`jet1phi` |`[float64]`|
33
+ |`jet1b` |`[float64]`|
34
+ |`jet2pt` |`[float64]`|
35
+ |`jet2eta` |`[float64]`|
36
+ |`jet2phi` |`[float64]`|
37
+ |`jet2b` |`[float64]`|
38
+ |`jet3pt` |`[float64]`|
39
+ |`jet3eta` |`[float64]`|
40
+ |`jet3phi` |`[float64]`|
41
+ |`jet3b` |`[float64]`|
42
+ |`jet4pt` |`[float64]`|
43
+ |`jet4eta` |`[float64]`|
44
+ |`jet4phi` |`[float64]`|
45
+ |`jet4b` |`[float64]`|
46
+ |`m_jj` |`[float64]`|
47
+ |`m_jjj` |`[float64]`|
48
+ |`m_lv` |`[float64]`|
49
+ |`m_jlv` |`[float64]`|
50
+ |`m_bb` |`[float64]`|
51
+ |`m_wbb` |`[float64]`|
52
+ |`m_wwbb` |`[float64]`|
higgs.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d48bd1d78420400e0ebe7e8b906a74162b3e66b65e98fc73f0729f0a80b57aba
3
+ size 45444445
higgs.py ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Higgs: A Census Dataset"""
2
+
3
+ from typing import List
4
+
5
+ import datasets
6
+
7
+ import pandas
8
+
9
+
10
+ VERSION = datasets.Version("1.0.0")
11
+ _ORIGINAL_FEATURE_NAMES = [
12
+ "is_boson",
13
+ "lepton_pT",
14
+ "lepton_eta",
15
+ "lepton_phi",
16
+ "missing_energy_magnitude",
17
+ "missing_energy_phi",
18
+ "jet1pt",
19
+ "jet1eta",
20
+ "jet1phi",
21
+ "jet1b-tag",
22
+ "jet2pt",
23
+ "jet2eta",
24
+ "jet2phi",
25
+ "jet2b-tag",
26
+ "jet3pt",
27
+ "jet3eta",
28
+ "jet3phi",
29
+ "jet3b-tag",
30
+ "jet4pt",
31
+ "jet4eta",
32
+ "jet4phi",
33
+ "jet4b-tag",
34
+ "m_jj",
35
+ "m_jjj",
36
+ "m_lv",
37
+ "m_jlv",
38
+ "m_bb",
39
+ "m_wbb",
40
+ "m_wwbb"
41
+ ]
42
+
43
+ DESCRIPTION = "Higgs dataset from \"Searching for exotic particles in high-energy physics with deep learning\"."
44
+ _HOMEPAGE = "https://www.nature.com/articles/ncomms5308/"
45
+ _URLS = ("https://www.openml.org/search?type=data&status=active&id=4532")
46
+ _CITATION = """
47
+ @article{baldi2014searching,
48
+ title={Searching for exotic particles in high-energy physics with deep learning},
49
+ author={Baldi, Pierre and Sadowski, Peter and Whiteson, Daniel},
50
+ journal={Nature communications},
51
+ volume={5},
52
+ number={1},
53
+ pages={4308},
54
+ year={2014},
55
+ publisher={Nature Publishing Group UK London}
56
+ }"""
57
+
58
+ # Dataset info
59
+ urls_per_split = {
60
+ "train": "https://huggingface.co/datasets/mstz/higgs/raw/main/higgs.csv",
61
+ }
62
+ features_types_per_config = {
63
+ "higgs": {
64
+ "lepton_pT": datasets.Value("float64"),
65
+ "lepton_eta": datasets.Value("float64"),
66
+ "lepton_phi": datasets.Value("float64"),
67
+ "missing_energy_magnitude": datasets.Value("float64"),
68
+ "missing_energy_phi": datasets.Value("float64"),
69
+ "jet1pt": datasets.Value("float64"),
70
+ "jet1eta": datasets.Value("float64"),
71
+ "jet1phi": datasets.Value("float64"),
72
+ "jet1b-tag": datasets.Value("float64"),
73
+ "jet2pt": datasets.Value("float64"),
74
+ "jet2eta": datasets.Value("float64"),
75
+ "jet2phi": datasets.Value("float64"),
76
+ "jet2b-tag": datasets.Value("float64"),
77
+ "jet3pt": datasets.Value("float64"),
78
+ "jet3eta": datasets.Value("float64"),
79
+ "jet3phi": datasets.Value("float64"),
80
+ "jet3b-tag": datasets.Value("float64"),
81
+ "jet4pt": datasets.Value("float64"),
82
+ "jet4eta": datasets.Value("float64"),
83
+ "jet4phi": datasets.Value("float64"),
84
+ "jet4b-tag": datasets.Value("float64"),
85
+ "m_jj": datasets.Value("float64"),
86
+ "m_jjj": datasets.Value("float64"),
87
+ "m_lv": datasets.Value("float64"),
88
+ "m_jlv": datasets.Value("float64"),
89
+ "m_bb": datasets.Value("float64"),
90
+ "m_wbb": datasets.Value("float64"),
91
+ "m_wwbb": datasets.Value("float64"),
92
+ "is_boson": datasets.ClassLabel(num_classes=2, names=("no", "yes"))
93
+ }
94
+ }
95
+ features_per_config = {k: datasets.Features(features_types_per_config[k]) for k in features_types_per_config}
96
+
97
+
98
+ class HiggsConfig(datasets.BuilderConfig):
99
+ def __init__(self, **kwargs):
100
+ super(HiggsConfig, self).__init__(version=VERSION, **kwargs)
101
+ self.features = features_per_config[kwargs["name"]]
102
+
103
+
104
+ class Higgs(datasets.GeneratorBasedBuilder):
105
+ # dataset versions
106
+ DEFAULT_CONFIG = "higgs"
107
+ BUILDER_CONFIGS = [
108
+ HiggsConfig(name="higgs",
109
+ description="Higgs boson binary classification.")
110
+ ]
111
+
112
+
113
+ def _info(self):
114
+ if self.config.name not in features_per_config:
115
+ raise ValueError(f"Unknown configuration: {self.config.name}")
116
+
117
+ info = datasets.DatasetInfo(description=DESCRIPTION, citation=_CITATION, homepage=_HOMEPAGE,
118
+ features=features_per_config[self.config.name])
119
+
120
+ return info
121
+
122
+ def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
123
+ downloads = dl_manager.download_and_extract(urls_per_split)
124
+
125
+ return [
126
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloads["train"]})
127
+ ]
128
+
129
+ def _generate_examples(self, filepath: str):
130
+ data = pandas.read_csv(filepath)
131
+ data = self.preprocess(data, config=self.config.name)
132
+
133
+ for row_id, row in data.iterrows():
134
+ data_row = dict(row)
135
+
136
+ yield row_id, data_row
137
+
138
+
139
+ def preprocess(self, data: pandas.DataFrame, config: str = "higgs") -> pandas.DataFrame:
140
+ if config == "higgs":
141
+ return data[list(features_types_per_config["higgs"].keys())]
142
+ else:
143
+ raise ValueError(f"Unknown config: {config}")