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:
DatasetWrapper 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, cot_qa=None, description=None, _use_numeric_qa=False, _use_cot_qa=False, folktables_obj=None)[source]ο
Bases:
TaskMetadataA 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.