o
    Ni                     @   sr   d Z ddlmZ ddlmZ ddlmZ ddlZddlm  mZ	 ddl
mZ dZdZdZG d	d
 d
ejjZdS )HIGGS Data Set.    )absolute_import)division)print_functionNa6  @article{Baldi:2014kfa,
      author         = "Baldi, Pierre and Sadowski, Peter and Whiteson, Daniel",
      title          = "{Searching for Exotic Particles in High-Energy Physics
                        with Deep Learning}",
      journal        = "Nature Commun.",
      volume         = "5",
      year           = "2014",
      pages          = "4308",
      doi            = "10.1038/ncomms5308",
      eprint         = "1402.4735",
      archivePrefix  = "arXiv",
      primaryClass   = "hep-ph",
      SLACcitation   = "%%CITATION = ARXIV:1402.4735;%%"
}
af  The data has been produced using Monte Carlo simulations. 
The first 21 features (columns 2-22) are kinematic properties 
measured by the particle detectors in the accelerator. 
The last seven features are functions of the first 21 features; 
these are high-level features derived by physicists to help 
discriminate between the two classes. There is an interest 
in using deep learning methods to obviate the need for physicists 
to manually develop such features. Benchmark results using 
Bayesian Decision Trees from a standard physics package and 
5-layer neural networks are presented in the original paper. 
zLhttps://archive.ics.uci.edu/ml/machine-learning-databases/00280/HIGGS.csv.gzc                   @   s6   e Zd ZdZejddZdd Zdd Z	dd	 Z
d
S )Higgsr   z2.0.0z6New split API (https://tensorflow.org/datasets/splits)c                 C   s   t jj| tt ji dtjdtjdtjdtjdtjdtjdtjdtjd	tjd
tjdtjdtjdtjdtjdtjdtjdtjtjtjtjtjtjtjtjtjtjtjtjtjdd dt	dS )Nclass_label	lepton_pT
lepton_eta
lepton_phimissing_energy_magnitudemissing_energy_phijet_1_pt	jet_1_eta	jet_1_phijet_1_b-tagjet_2_pt	jet_2_eta	jet_2_phijet_2_b-tagjet_3_pt	jet_3_eta	jet_3_phi)jet_3_b-tagjet_4_pt	jet_4_eta	jet_4_phijet_4_b-tagm_jjm_jjjm_lvm_jlvm_bbm_wbbm_wwbbz-https://archive.ics.uci.edu/ml/datasets/HIGGS)builderdescriptionfeaturessupervised_keyshomepagecitation)
tfdscoreDatasetInfo_DESCRIPTIONr&   FeaturesDicttffloat32float64	_CITATION)self r4   X/home/ubuntu/.local/lib/python3.10/site-packages/tensorflow_datasets/structured/higgs.py_infoC   sn   	
!zHiggs._infoc                 C   s$   | t}tjjtjjd|idgS )N	file_path)name
gen_kwargs)download_and_extract_URLr*   r+   SplitGeneratorSplitTRAIN)r3   
dl_managerpathr4   r4   r5   _split_generatorsm   s   
zHiggs._split_generatorsc                 c   sh    g d}t jj|}tj||d}t|D ]	\}}||fV  qW d   dS 1 s-w   Y  dS )zGenerate features given the directory path.

    Args:
      file_path: path where the csv file is stored

    Yields:
      The features, per row.
    )r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   )
fieldnamesN)r/   iogfileGFilecsv
DictReader	enumerate)r3   r7   rB   csvfilereaderirowr4   r4   r5   _generate_examplesz   s   
	"zHiggs._generate_examplesN)__name__
__module____qualname____doc__r*   r+   VersionVERSIONr6   rA   rM   r4   r4   r4   r5   r   >   s    *r   )rQ   
__future__r   r   r   rF   tensorflow.compat.v2compatv2r/   tensorflow_datasets.public_api
public_apir*   r2   r-   r;   r+   GeneratorBasedBuilderr   r4   r4   r4   r5   <module>   s   