PyTorch dataset wrapper for the
Project description
adult-dataset
A PyTorch dataset wrapper for the Adult (Census Income) dataset. Adult is a popular dataset in machine learning fairness research.
This package contains only a single class: adult.Adult
,
a torch.utils.data.Dataset
loading and, optionally, downloading the
Adult dataset.
This class can be used like the MNIST
dataset in
torchvision.
Installation
pip install adult-dataset
Basic Usage
from adult import Adult
# load (if necessary, download) the Adult training dataset
train_set = Adult(root="datasets", download=True)
# load the test set
test_set = Adult(root="datasets", train=False, download=True)
inputs, target = train_set[0] # retrieve the first sample of the training set
# iterate over the training set
for inputs, target in iter(train_set):
... # Do something with a single sample
# use a PyTorch data loader
from torch.utils.data import DataLoader
loader = DataLoader(test_set, batch_size=32, shuffle=True)
for epoch in range(100):
for inputs, targets in iter(loader):
... # Do something with a batch of samples
Advanced Usage
Turn off status messages while downloading the dataset:
Adult(root=..., output_fn=None)
Use the logging
module for logging status messages while downloading the
dataset instead of placing the status messages on sys.stdout
.
import logging
Adult(root=..., output_fn=logging.info)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
adult-dataset-1.0.0.tar.gz
(9.4 kB
view hashes)
Built Distribution
Close
Hashes for adult_dataset-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee1d11c0e1f46b6c2351fa3eecdfebbd4f95ce58ab7ab605c9ff9db3a1579d0d |
|
MD5 | d37725effa01e30829ba94490e5f2d59 |
|
BLAKE2b-256 | ee5adb3ed7af17ba895848a5ae6413e1050368ca3d767f071ba3f5702f77c174 |