o
    Ni                     @   sj   d Z ddlmZ ddlmZ ddlm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 ) German Credit (numeric) dataset.    )absolute_import)division)print_functionNz\https://archive.ics.uci.edu/ml/machine-learning-databases/statlog/german/german.data-numericz@misc{Dua:2019 ,
author = "Dua, Dheeru and Graff, Casey",
year = "2017",
title = "{UCI} Machine Learning Repository",
url = "http://archive.ics.uci.edu/ml",
institution = "University of California, Irvine, School of Information and Computer Sciences"
}
a  
This dataset classifies people described by a set of attributes as good or bad
credit risks. The version here is the "numeric" variant where categorical and
ordered categorical attributes have been encoded as indicator and integer
quantities respectively.
c                   @   s4   e Zd ZdZejdZdd Zdd Z	dd Z
d	S )
GermanCreditNumericr   z1.0.0c              	   C   sB   t jj| tt jt jjdtjdt jj	ddgddddt
dS )	N)   )shapedtypeBadGood)namesfeatureslabelzDhttps://archive.ics.uci.edu/ml/datasets/Statlog+(German+Credit+Data))builderdescriptionr   supervised_keyshomepagecitation)tfdscoreDatasetInfo_DESCRIPTIONr   FeaturesDictTensortfint32
ClassLabel	_CITATION)self r    h/home/ubuntu/.local/lib/python3.10/site-packages/tensorflow_datasets/structured/german_credit_numeric.py_info3   s   zGermanCreditNumeric._infoc                 C   sn   | t}tjj|}| d}W d   n1 sw   Y  dd |D }tj	j
tjjd|idgS )zReturns SplitGenerators.
Nc                 S   s   g | ]}|r|qS r    r    ).0lr    r    r!   
<listcomp>G       z9GermanCreditNumeric._split_generators.<locals>.<listcomp>records)name
gen_kwargs)downloadURLr   iogfileGFilereadsplitr   r   SplitGeneratorSplitTRAIN)r   
dl_manager	data_filef	all_linesr(   r    r    r!   _split_generatorsB   s   
z%GermanCreditNumeric._split_generatorsc                 c   sN    t |D ]\}}| }|dd |dd D dt|d  dfV  qdS )zYields examples.c                 S   s   g | ]}t |qS r    )int)r$   er    r    r!   r&   T   r'   z:GermanCreditNumeric._generate_examples.<locals>.<listcomp>N   r   )	enumerater1   r:   )r   r(   irowelemsr    r    r!   _generate_examplesO   s   z&GermanCreditNumeric._generate_examplesN)__name__
__module____qualname____doc__r   r   VersionVERSIONr"   r9   rB   r    r    r    r!   r   .   s    r   )rF   
__future__r   r   r   tensorflow.compat.v2compatv2r   tensorflow_datasets.public_api
public_apir   r,   r   r   r   GeneratorBasedBuilderr   r    r    r    r!   <module>   s   
