folktexts.acs package
Submodules
folktexts.acs.acs_columns module
Module to hold ACS column mappings from values to natural text.
folktexts.acs.acs_dataset module
Module to access ACS data using the folktables package.
- class folktexts.acs.acs_dataset.ACSDataset(data, full_acs_data, task, test_size=0.1, val_size=0.1, subsampling=None, seed=42)[source]
Bases:
Dataset
Wrapper for ACS folktables datasets.
Construct a Dataset object.
- Parameters:
data (pd.DataFrame) – The dataset’s data in pandas DataFrame format.
task (TaskMetadata) – The metadata for the prediction task.
test_size (float, optional) – The size of the test set, as a fraction of the total dataset size, by default 0.1.
val_size (float, optional) – The size of the validation set, as a fraction of the total dataset size, by default 0.1.
subsampling (float, optional) – Whether to use sub-sampling, and which fraction of the data to keep. By default will not use sub-sampling (subsampling=None).
seed (int, optional) – The random state seed, by default 42.
- classmethod make_from_task(task, cache_dir=None, survey_year='2018', horizon='1-Year', survey='person', seed=42, **kwargs)[source]
Construct an ACSDataset object from a given ACS task.
Can customize survey sample parameters (survey year, horizon, survey type).
- Parameters:
task (str | ACSTaskMetadata) – The name of the ACS task or the task object itself.
cache_dir (str | Path, optional) – The directory where ACS data is (or will be) saved to, by default uses DEFAULT_DATA_DIR.
survey_year (str, optional) – The year from which to load survey data, by default DEFAULT_SURVEY_YEAR.
horizon (str, optional) – The time horizon of survey data to load, by default DEFAULT_SURVEY_HORIZON.
survey (str, optional) – The name of the survey unit to load, by default DEFAULT_SURVEY_UNIT.
seed (int, optional) – The random seed, by default DEFAULT_SEED.
**kwargs – Extra key-word arguments to be passed to the Dataset constructor.
- property task: ACSTaskMetadata
folktexts.acs.acs_questions module
A collection of instantiated ACS column objects and ACS tasks.
folktexts.acs.acs_tasks module
A collection of ACS prediction tasks based on the folktables package.
- class folktexts.acs.acs_tasks.ACSTaskMetadata(name, features, target, cols_to_text, sensitive_attribute=None, target_threshold=None, multiple_choice_qa=None, direct_numeric_qa=None, description=None, _use_numeric_qa=False, folktables_obj=None)[source]
Bases:
TaskMetadata
A class to hold information on an ACS prediction task.
- folktables_obj: BasicProblem = None
- classmethod make_folktables_task(name, target_threshold=None, description=None)[source]
- Return type:
folktexts.acs.acs_thresholds module
Threshold instances for ACS / folktables tasks.