Welcome to dcbenchο
π‘ What is dcbench?ο
This benchmark evaluates the steps in your machine learning workflow beyond model training and tuning. This includes feature cleaning, slice discovery, and coreset selection. We call these βdata-centricβ tasks because theyβre focused on exploring and manipulating data β not training models. dcbench
supports a growing number of them:
Minimal Data Selection: Find the smallest subset of training data on which a fixed model architecture achieves accuracy above a threshold.
Slice Discovery: Identify subgroups on which a model underperforms.
Data Cleaning on a Budget: Given a fixed budget, clean input features of training data to improve model performance.
dcbench
includes tasks that look very different from one another: the inputs and
outputs of the slice discovery task are not the same as those of the
minimal data cleaning task. However, we think it important that
researchers and practitioners be able to run evaluations on data-centric
tasks across the ML lifecycle without having to learn a bunch of
different APIs or rewrite evaluation scripts.
So, dcbench
is designed to be a common home for these diverse, but
related, tasks. In dcbench
all of these tasks are structured in a
similar manner and they are supported by a common Python API that makes
it easy to download data, run evaluations, and compare methods.
π§ API Walkthroughο
pip install dcbench
Task
ο
dcbench
supports a diverse set of data-centric tasks (e.g. Slice Discovery).
You can explore the supported tasks in the documentation (π― Tasks) or via the Python API:
In [1]: import dcbench
In [2]: dcbench.tasks
Out[2]:
name summary
minidata Minimal Data Selection Given a large training dataset, what is the sm...
slice_discovery Slice Discovery Machine learnings models that achieve high ove...
budgetclean Data Cleaning on a Budget When it comes to data preparation, data cleani...
In the dcbench
API, each task is represented by a dcbench.Task
object that can be accessed by task_id (e.g. dcbench.slice_discovery
). These task objects hold metadata about the task and hold pointers to task-specific dcbench.Problem
and dcbench.Solution
subclasses, discussed below.
Problem
ο
Each task features a collection of problems (i.e. instances of the task). For example, the Slice Discovery task includes hundreds of problems across a number of different datasets. We can explore a taskβs problems in dcbench
:
In [3]: dcbench.tasks["slice_discovery"].problems
Out[3]:
alpha dataset ... slice_names target_name
p_117306 0.0171 imagenet ... [craft.n.02] vehicle.n.01
p_117341 0.0171 imagenet ... [cart.n.01] vehicle.n.01
p_117406 0.0171 imagenet ... [rocket.n.01] vehicle.n.01
p_117634 0.0171 imagenet ... [barrow.n.03] vehicle.n.01
p_117980 0.0171 imagenet ... [bicycle.n.01] vehicle.n.01
p_118007 0.0171 imagenet ... [wagon.n.01] vehicle.n.01
p_118045 0.0171 imagenet ... [motorcycle.n.01] vehicle.n.01
p_118259 0.0171 imagenet ... [hat.n.01] clothing.n.01
p_118311 0.0171 imagenet ... [shirt.n.01] clothing.n.01
p_118660 0.0171 imagenet ... [menu.n.02] food.n.01
p_118716 0.0171 imagenet ... [alcohol.n.01] food.n.01
p_118843 0.0171 imagenet ... [concoction.n.01] food.n.01
p_118895 0.0171 imagenet ... [cup.n.06] food.n.01
p_118919 0.0171 imagenet ... [hay.n.01] food.n.01
p_118949 0.0171 imagenet ... [punch.n.02] food.n.01
p_118970 0.0171 imagenet ... [beverage.n.01] food.n.01
p_119029 0.0171 imagenet ... [wine.n.01] food.n.01
p_119061 0.0171 imagenet ... [fare.n.04] food.n.01
p_119075 0.0171 imagenet ... [feed.n.01] food.n.01
p_119216 0.0171 imagenet ... [chime.n.01] musical_instrument.n.01
[20 rows x 6 columns]
All of a taskβs problems share the same structure and use the same evaluation scripts.
This is specified via task-specific subclasses of dcbench.Problem
(e.g. SliceDiscoveryProblem
). The problems themselves are instances of these subclasses. We can access a problem using itβs id:
In [4]: problem = dcbench.tasks["slice_discovery"].problems["p_118919"]
In [5]: problem
Out[5]: SliceDiscoveryProblem(artifacts={'activations': 'DataPanelArtifact', 'base_dataset': 'VisionDatasetArtifact', 'clip': 'DataPanelArtifact', 'model': 'ModelArtifact', 'test_predictions': 'DataPanelArtifact', 'test_slices': 'DataPanelArtifact', 'val_predictions': 'DataPanelArtifact'}, attributes={'alpha': 0.01709975946676697, 'dataset': 'imagenet', 'n_pred_slices': 5, 'slice_category': 'rare', 'slice_names': ['hay.n.01'], 'target_name': 'food.n.01'})
Artifact
ο
Each problem is made up of a set of artifacts: a dataset with features to clean, a dataset and a model to perform error analysis on. In dcbench
, these artifacts are represented by instances of
dcbench.Artifact
. We can think of each Problem
object as a container for Artifact
objects.
In [6]: problem.artifacts
Out[6]:
{'activations': <dcbench.common.artifact.DataPanelArtifact at 0x7fd38c6fc7d0>,
'base_dataset': <dcbench.common.artifact.VisionDatasetArtifact at 0x7fd38c7d3b10>,
'clip': <dcbench.common.artifact.DataPanelArtifact at 0x7fd38c6f44d0>,
'model': <dcbench.common.artifact.ModelArtifact at 0x7fd38c6fc850>,
'test_predictions': <dcbench.common.artifact.DataPanelArtifact at 0x7fd38c6fc890>,
'test_slices': <dcbench.common.artifact.DataPanelArtifact at 0x7fd38c6fc8d0>,
'val_predictions': <dcbench.common.artifact.DataPanelArtifact at 0x7fd38c6fc910>}
Note that Artifact
objects donβt actually hold their underlying data in memory. Instead, they hold pointers to where the Artifact
lives in dcbench
cloud storage and, if itβs been downloaded, where it lives locally on disk. This makes the Problem
objects very lightweight.
dcbench
includes loading functionality for each artifact type. To load an artifact into memory we can use load()
. Note that this will also download the artifact to disk if it hasnβt yet been downloaded.
In [7]: problem.artifacts["model"]
Out[7]: <dcbench.common.artifact.ModelArtifact at 0x7fd38c6fc850>
Easier yet, we can use the index operator directly on Problem
objects to both fetch the artifact and load it into memory.
In [8]: problem["activations"] # shorthand for problem.artifacts["model"].load()
Out[8]: DataPanel(nrows: 9044, ncols: 3)
Downloading to Disk
By default, dcbench
downloads artifacts to ~/.dcbench
but this can be configured by creating a dcbench-config.yaml
as described in βοΈ Configuring dcbench. To download an Artifact
via the Python API, use Artifact.download()
. You can also download all the artifacts in a problem with Problem.download()
.
Solution
ο
π― Tasksο
Minimal Data Selectionο
Given a large training dataset, what is the smallest subset you can sample that still achieves some threshold of performance.
Classes: dcbench.MiniDataProblem
dcbench.MiniDataSolution
Cloud Storage
We recommend downloading Artifacts through the Python API, but you can also explore the Artifacts on the Google Cloud Console.
Problem Artifactsο
name |
type |
description |
---|---|---|
|
A DataPanel of train examples with columns |
|
|
A DataPanel of validation examples with columns |
|
|
A DataPanel of test examples with columns |
Solution Artifactsο
name |
type |
description |
---|---|---|
|
A list of train example ids from the |
Slice Discoveryο
Machine learnings models that achieve high overall accuracy often make systematic erors on important subgroups (or slices) of data. When working with high-dimensional inputs (e.g. images, audio) where data slices are often unlabeled, identifying underperforming slices is challenging. In this task, weβll develop automated slice discovery methods that mine unstructured data for underperforming slices.
Classes: dcbench.SliceDiscoveryProblem
dcbench.SliceDiscoverySolution
Cloud Storage
We recommend downloading Artifacts through the Python API, but you can also explore the Artifacts on the Google Cloud Console.
Problem Artifactsο
name |
type |
description |
---|---|---|
|
A DataPanel of the modelβs predictions with columns id,`target`, and probs. |
|
|
A DataPanel of the modelβs predictions with columns id,`target`, and probs. |
|
|
A DataPanel of the ground truth slice labels with columns id, slices. |
|
|
A DataPanel of the modelβs activations with columns id,`act` |
|
|
A trained PyTorch model to audit. |
|
|
A DataPanel representing the base dataset with columns id and image. |
|
|
A DataPanel of the image embeddings from OpenAIβs CLIP model |
Solution Artifactsο
name |
type |
description |
---|---|---|
|
A DataPanel of predicted slice labels with columns id and pred_slices. |
Data Cleaning on a Budgetο
When it comes to data preparation, data cleaning is an essential yet quite costly task. If we are given a fixed cleaning budget, the challenge is to find the training data examples that would would bring the biggest positive impact on model performance if we were to clean them.
Classes: dcbench.BudgetcleanProblem
dcbench.BudgetcleanSolution
Cloud Storage
We recommend downloading Artifacts through the Python API, but you can also explore the Artifacts on the Google Cloud Console.
Problem Artifactsο
name |
type |
description |
---|---|---|
|
(βFeatures of the dirty training dataset which we need to clean. Each dirty cell contains an embedded list of clean candidate values.β,) |
|
|
Features of the clean training dataset where each dirty value from the dirty dataset is replaced with the correct clean candidate. |
|
|
Labels of the training dataset. |
|
|
Feature of the validtion dataset which can be used to guide the cleaning optimization process. |
|
|
Labels of the validation dataset. |
|
|
(βFeatures of the test dataset used to produce the final evaluation score of the model.β,) |
|
|
Labels of the test dataset. |
Solution Artifactsο
name |
type |
description |
---|---|---|
|
π Installing dcbenchο
This section describes how to install the dcbench
Python package.
pip install dcbench
Optional
Some parts of dcbench
rely on optional dependencies. If you know which optional dependencies youβd like to install, you can do so using something like pip install dcbench[dev]
instead. See setup.py
for a full list of optional dependencies.
Installing from branchο
To install from a specific branch use the command below, replacing main
with the name of any branch in the dcbench repository.
pip install "dcbench @ git+https://github.com/data-centric-ai/dcbench@main"
Installing from cloneο
You can install from a clone of the dcbench
repo with:
git clone https://github.com/data-centric-ai/dcbench.git
cd dcbench
pip install -e .
βοΈ Configuring dcbenchο
Several aspects of dcbench
behavior can be configured by the user.
For example, one may wish to change the directory in which dcbench
downloads artifacts (by default this is ~/.dcbench
).
You can see the current state of the dcbench
configuration with:
In [1]: import dcbench
In [2]: dcbench.config
Out[2]: DCBenchConfig(local_dir='/home/docs/.dcbench', public_bucket_name='dcbench', hidden_bucket_name='dcbench-hidden', celeba_dir='/home/docs/.dcbench/datasets/celeba', imagenet_dir='/home/docs/.dcbench/datasets/imagenet')
Configuring with YAMLο
To change the configuration create a YAML file, like the one below:
Then set the environment variable DCBENCH_CONFIG
to point to the file:
export DCBENCH_CONFIG="/path/to/dcbench-config.yaml"
If youβre using a conda, you can permanently set this variable for your environment:
conda env config vars set DCBENCH_CONFIG="path/to/dcbench-config.yaml"
conda activate env_name # need to reactivate the environment
Configuring Programmaticallyο
You can also update the config programmatically, though unlike the YAML method above, these changes will not persist beyond the lifetime of your program.
dcbench.config.local_dir = "/path/to/storage"
dcbench.config.public_bucket_name = "dcbench-test"
dcbench packageο
Subpackagesο
dcbench.common packageο
Submodulesο
dcbench.common.artifact moduleο
- class Artifact(artifact_id, **kwargs)[source]ο
Bases:
abc.ABC
- Parameters
artifact_id (str) β
- Return type
None
- DEFAULT_EXT: str = ''ο
- classmethod from_data(data, artifact_id=None)[source]ο
- Parameters
data (Any) β
artifact_id (Optional[str]) β
- property is_downloaded: boolο
- property is_uploaded: boolο
- isdir: bool = Falseο
- property local_path: strο
- property remote_url: strο
- static to_yaml(dumper, data)[source]ο
- Parameters
dumper (yaml.dumper.Dumper) β
data (dcbench.common.artifact.Artifact) β
- class ArtifactContainer(id, artifacts, attributes=None)[source]ο
Bases:
abc.ABC
,collections.abc.Mapping
,dcbench.common.table.RowMixin
- Parameters
id (str) β
artifacts (Mapping[str, Artifact]) β
attributes (Mapping[str, BASIC_TYPE]) β
- artifact_specs: Mapping[str, ArtifactSpec]ο
- container_type: strο
- classmethod from_artifacts(artifacts, attributes=None, container_id=None)[source]ο
- Parameters
artifacts (Mapping[str, Artifact]) β
attributes (Mapping[str, BASIC_TYPE]) β
container_id (str) β
- property is_downloaded: boolο
- property is_uploaded: boolο
- task_id: str = 'none'ο
- static to_yaml(dumper, data)[source]ο
- Parameters
dumper (yaml.dumper.Dumper) β
data (dcbench.common.artifact.ArtifactContainer) β
- class ArtifactSpec(description: 'str', artifact_type: 'type')[source]ο
Bases:
object
- Parameters
description (str) β
artifact_type (type) β
- Return type
None
- artifact_type: typeο
- description: strο
- class CSVArtifact(artifact_id, **kwargs)[source]ο
Bases:
dcbench.common.artifact.Artifact
- Parameters
artifact_id (str) β
- Return type
None
- DEFAULT_EXT: str = 'csv'ο
- class DataPanelArtifact(artifact_id, **kwargs)[source]ο
Bases:
dcbench.common.artifact.Artifact
- Parameters
artifact_id (str) β
- Return type
None
- DEFAULT_EXT: str = 'mk'ο
- isdir: bool = Trueο
- class ModelArtifact(artifact_id, **kwargs)[source]ο
Bases:
dcbench.common.artifact.Artifact
- Parameters
artifact_id (str) β
- Return type
None
- DEFAULT_EXT: str = 'pt'ο
- class VisionDatasetArtifact(artifact_id, **kwargs)[source]ο
Bases:
dcbench.common.artifact.DataPanelArtifact
- Parameters
artifact_id (str) β
- Return type
None
- COLUMN_SUBSETS = {'celeba': ['id', 'image', 'identity', 'split'], 'imagenet': ['id', 'image', 'name', 'synset']}ο
- DEFAULT_EXT: str = 'mk'ο
- isdir: bool = Trueο
dcbench.common.download_utils moduleο
This file contains utility functions for downloading datasets. The code in this file is taken from the torchvision package, specifically, https://github.com/pytorch/vision/blob/master/torchvision/datasets/utils.py. We package it here to avoid users having to install the rest of torchvision. It is licensed under the following license:
BSD 3-Clause License
Copyright (c) Soumith Chintala 2016, All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS βAS ISβ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- calculate_md5(fpath, chunk_size=1048576)[source]ο
- Parameters
fpath (str) β
chunk_size (int) β
- Return type
str
- check_integrity(fpath, md5=None)[source]ο
- Parameters
fpath (str) β
md5 (Optional[str]) β
- Return type
bool
- check_md5(fpath, md5, **kwargs)[source]ο
- Parameters
fpath (str) β
md5 (str) β
kwargs (Any) β
- Return type
bool
- download_and_extract_archive(url, download_root, extract_root=None, filename=None, md5=None, remove_finished=False, size=None)[source]ο
- Parameters
url (str) β
download_root (str) β
extract_root (Optional[str]) β
filename (Optional[str]) β
md5 (Optional[str]) β
remove_finished (bool) β
size (Optional[int]) β
- Return type
None
- download_file_from_google_drive(file_id, root, filename=None, md5=None)[source]ο
Download a Google Drive file from and place it in root.
- Parameters
file_id (str) β id of file to be downloaded
root (str) β Directory to place downloaded file in
filename (str, optional) β Name to save the file under. If None, use the id of the file.
md5 (str, optional) β MD5 checksum of the download. If None, do not check
- download_url(url, root, filename=None, md5=None, size=None)[source]ο
Download a file from a url and place it in root.
- Parameters
url (str) β URL to download file from
root (str) β Directory to place downloaded file in
filename (str, optional) β Name to save the file under. If None, use the basename of the URL
md5 (str, optional) β MD5 checksum of the download. If None, do not check
size (Optional[int]) β
- Return type
None
- extract_archive(from_path, to_path=None, remove_finished=False)[source]ο
- Parameters
from_path (str) β
to_path (Optional[str]) β
remove_finished (bool) β
- Return type
None
- list_dir(root, prefix=False)[source]ο
List all directories at a given root.
- Parameters
root (str) β Path to directory whose folders need to be listed
prefix (bool, optional) β If true, prepends the path to each result, otherwise only returns the name of the directories found
- Return type
List[str]
- list_files(root, suffix, prefix=False)[source]ο
List all files ending with a suffix at a given root.
- Parameters
root (str) β Path to directory whose folders need to be listed
suffix (str or tuple) β Suffix of the files to match, e.g. β.pngβ or (β.jpgβ, β.pngβ). It uses the Python βstr.endswithβ method and is passed directly
prefix (bool, optional) β If true, prepends the path to each result, otherwise only returns the name of the files found
- Return type
List[str]
- verify_str_arg(value, arg=None, valid_values=None, custom_msg=None)[source]ο
- Parameters
value (dcbench.common.download_utils.T) β
arg (Optional[str]) β
valid_values (Optional[Iterable[dcbench.common.download_utils.T]]) β
custom_msg (Optional[str]) β
- Return type
dcbench.common.download_utils.T
dcbench.common.method moduleο
- class Method(config=None, **kwargs)[source]ο
Bases:
abc.ABC
- Parameters
config (dict) β
- class Config(n_slices: int = 5, emb_group: str = 'main', emb: str = 'emb', xmodal_emb: str = 'emb')[source]ο
Bases:
object
- Parameters
n_slices (int) β
emb_group (str) β
emb (str) β
xmodal_emb (str) β
- Return type
None
- emb: str = 'emb'ο
- emb_group: str = 'main'ο
- n_slices: int = 5ο
- xmodal_emb: str = 'emb'ο
- RESOURCES_REQUIRED = {'cpu': 1, 'custom_resources': {'ram_gb': 4}}ο
dcbench.common.problem moduleο
- class Problem(id, artifacts, attributes=None)[source]ο
Bases:
dcbench.common.artifact.ArtifactContainer
- Parameters
id (str) β
artifacts (Mapping[str, Artifact]) β
attributes (Mapping[str, BASIC_TYPE]) β
- artifact_specs: Mapping[str, ArtifactSpec]ο
- container_type: str = 'problem'ο
- name: strο
- solution_class: typeο
- summary: strο
dcbench.common.result moduleο
dcbench.common.solution moduleο
dcbench.common.solve moduleο
dcbench.common.utils moduleο
Module contentsο
dcbench.tasks packageο
Subpackagesο
Module contentsο
Submodulesο
dcbench.constants moduleο
dcbench.version moduleο
Module contentsο
The dcbench module is a collection for benchmarks that test various apsects of data preparation and handling in the context of AI workflows.
- class Artifact(artifact_id, **kwargs)[source]ο
Bases:
abc.ABC
- Parameters
artifact_id (str) β
- Return type
None
- DEFAULT_EXT: str = ''ο
- classmethod from_data(data, artifact_id=None)[source]ο
- Parameters
data (Any) β
artifact_id (Optional[str]) β
- property is_downloaded: boolο
- property is_uploaded: boolο
- isdir: bool = Falseο
- property local_path: strο
- property remote_url: strο
- static to_yaml(dumper, data)[source]ο
- Parameters
dumper (yaml.dumper.Dumper) β
data (dcbench.common.artifact.Artifact) β
- class BudgetcleanProblem(id, artifacts, attributes=None)[source]ο
Bases:
dcbench.common.problem.Problem
- Parameters
id (str) β
artifacts (Mapping[str, Artifact]) β
attributes (Mapping[str, BASIC_TYPE]) β
- artifact_specs: Mapping[str, dcbench.common.artifact.ArtifactSpec] = {'X_test': ArtifactSpec(description=('Features of the test dataset used to produce the final evaluation score of the model.',), artifact_type=<class 'dcbench.common.artifact.CSVArtifact'>), 'X_train_clean': ArtifactSpec(description='Features of the clean training dataset where each dirty value from the dirty dataset is replaced with the correct clean candidate.', artifact_type=<class 'dcbench.common.artifact.CSVArtifact'>), 'X_train_dirty': ArtifactSpec(description=('Features of the dirty training dataset which we need to clean. Each dirty cell contains an embedded list of clean candidate values.',), artifact_type=<class 'dcbench.common.artifact.CSVArtifact'>), 'X_val': ArtifactSpec(description='Feature of the validtion dataset which can be used to guide the cleaning optimization process.', artifact_type=<class 'dcbench.common.artifact.CSVArtifact'>), 'y_test': ArtifactSpec(description='Labels of the test dataset.', artifact_type=<class 'dcbench.common.artifact.CSVArtifact'>), 'y_train': ArtifactSpec(description='Labels of the training dataset.', artifact_type=<class 'dcbench.common.artifact.CSVArtifact'>), 'y_val': ArtifactSpec(description='Labels of the validation dataset.', artifact_type=<class 'dcbench.common.artifact.CSVArtifact'>)}ο
- evaluate(solution)[source]ο
- Parameters
solution (dcbench.tasks.budgetclean.problem.BudgetcleanSolution) β
- Return type
- solve(idx_selected, **kwargs)[source]ο
- Parameters
idx_selected (Any) β
kwargs (Any) β
- Return type
- task_id: str = 'budgetclean'ο
- class CSVArtifact(artifact_id, **kwargs)[source]ο
Bases:
dcbench.common.artifact.Artifact
- Parameters
artifact_id (str) β
- Return type
None
- DEFAULT_EXT: str = 'csv'ο
- class DataPanelArtifact(artifact_id, **kwargs)[source]ο
Bases:
dcbench.common.artifact.Artifact
- Parameters
artifact_id (str) β
- Return type
None
- DEFAULT_EXT: str = 'mk'ο
- isdir: bool = Trueο
- class MiniDataProblem(id, artifacts, attributes=None)[source]ο
Bases:
dcbench.common.problem.Problem
- Parameters
id (str) β
artifacts (Mapping[str, Artifact]) β
attributes (Mapping[str, BASIC_TYPE]) β
- artifact_specs: Mapping[str, dcbench.common.artifact.ArtifactSpec] = {'test_data': ArtifactSpec(description='A DataPanel of test examples with columns ``id``, ``input``, and ``target``.', artifact_type=<class 'dcbench.common.artifact.DataPanelArtifact'>), 'train_data': ArtifactSpec(description='A DataPanel of train examples with columns ``id``, ``input``, and ``target``.', artifact_type=<class 'dcbench.common.artifact.DataPanelArtifact'>), 'val_data': ArtifactSpec(description='A DataPanel of validation examples with columns ``id``, ``input``, and ``target``.', artifact_type=<class 'dcbench.common.artifact.DataPanelArtifact'>)}ο
- evaluate(solution)[source]ο
- Parameters
solution (dcbench.common.solution.Solution) β
- task_id: str = 'minidata'ο
- class ModelArtifact(artifact_id, **kwargs)[source]ο
Bases:
dcbench.common.artifact.Artifact
- Parameters
artifact_id (str) β
- Return type
None
- DEFAULT_EXT: str = 'pt'ο
- class Problem(id, artifacts, attributes=None)[source]ο
Bases:
dcbench.common.artifact.ArtifactContainer
- Parameters
id (str) β
artifacts (Mapping[str, Artifact]) β
attributes (Mapping[str, BASIC_TYPE]) β
- container_type: str = 'problem'ο
- name: strο
- solution_class: typeο
- summary: strο
- class SliceDiscoveryProblem(id, artifacts, attributes=None)[source]ο
Bases:
dcbench.common.problem.Problem
- Parameters
id (str) β
artifacts (Mapping[str, Artifact]) β
attributes (Mapping[str, BASIC_TYPE]) β
- artifact_specs: Mapping[str, dcbench.common.artifact.ArtifactSpec] = {'activations': ArtifactSpec(description="A DataPanel of the model's activations with columns `id`,`act`", artifact_type=<class 'dcbench.common.artifact.DataPanelArtifact'>), 'base_dataset': ArtifactSpec(description='A DataPanel representing the base dataset with columns `id` and `image`.', artifact_type=<class 'dcbench.common.artifact.VisionDatasetArtifact'>), 'clip': ArtifactSpec(description="A DataPanel of the image embeddings from OpenAI's CLIP model", artifact_type=<class 'dcbench.common.artifact.DataPanelArtifact'>), 'model': ArtifactSpec(description='A trained PyTorch model to audit.', artifact_type=<class 'dcbench.common.artifact.ModelArtifact'>), 'test_predictions': ArtifactSpec(description="A DataPanel of the model's predictions with columns `id`,`target`, and `probs.`", artifact_type=<class 'dcbench.common.artifact.DataPanelArtifact'>), 'test_slices': ArtifactSpec(description='A DataPanel of the ground truth slice labels with columnsΒ `id`, `slices`.', artifact_type=<class 'dcbench.common.artifact.DataPanelArtifact'>), 'val_predictions': ArtifactSpec(description="A DataPanel of the model's predictions with columns `id`,`target`, and `probs.`", artifact_type=<class 'dcbench.common.artifact.DataPanelArtifact'>)}ο
- evaluate(solution)[source]ο
- Parameters
solution (dcbench.tasks.slice_discovery.problem.SliceDiscoverySolution) β
- Return type
dict
- solve(pred_slices_dp)[source]ο
- Parameters
pred_slices_dp (meerkat.datapanel.DataPanel) β
- Return type
dcbench.tasks.slice_discovery.problem.SliceDiscoverySolution
- task_id: str = 'slice_discovery'ο
- class Solution(id, artifacts, attributes=None)[source]ο
Bases:
dcbench.common.artifact.ArtifactContainer
- Parameters
id (str) β
artifacts (Mapping[str, Artifact]) β
attributes (Mapping[str, BASIC_TYPE]) β
- container_type: str = 'solution'ο
- class Task(task_id, name, summary, problem_class, solution_class, baselines=Empty DataFrame Columns: [] Index: [])[source]ο
Bases:
dcbench.common.table.RowMixin
Task(task_id: str, name: str, summary: str, problem_class: type, solution_class: type, baselines: dcbench.common.table.Table = Empty DataFrame Columns: [] Index: [])
- Parameters
task_id (str) β
name (str) β
summary (str) β
problem_class (type) β
solution_class (type) β
baselines (dcbench.common.table.Table) β
- Return type
None
- baselines: dcbench.common.table.Table = Empty DataFrame Columns: [] Index: []ο
- property local_problems_pathο
- name: strο
- problem_class: typeο
- property problemsο
- property problems_pathο
- property remote_problems_urlο
- solution_class: typeο
- summary: strο
- task_id: strο
- write_problems(containers)[source]ο
- Parameters
containers (Sequence[dcbench.common.artifact.ArtifactContainer]) β
- class VisionDatasetArtifact(artifact_id, **kwargs)[source]ο
Bases:
dcbench.common.artifact.DataPanelArtifact
- Parameters
artifact_id (str) β
- Return type
None
- COLUMN_SUBSETS = {'celeba': ['id', 'image', 'identity', 'split'], 'imagenet': ['id', 'image', 'name', 'synset']}ο
- DEFAULT_EXT: str = 'mk'ο
- isdir: bool = Trueο