Skip to main content

Triage

ML/Data Science Toolkit for Social Good and Public Policy Problems

image image image

Building ML/Data Science systems requires answering many design questions, turning them into modeling choices, which in turn define and machine learning models. Questions such as cohort selection, unit of analysis determination, outcome determination, feature (explanatory variables or predictors) generation, model/classifier training, evaluation, selection, bias audits, interpretation, and list generation are often complicated and hard to make design choices around a priori. In addition, once these choices are made, they have to be combined in different ways throughout the course of a project.

Triage is designed to:

  • Guide users (data scientists, analysts, researchers) through these design choices by highlighting critical operational use questions.
  • Provide an integrated interface to components that are needed throughout a ML/data science project workflow.

Getting Started with Triage

Installation

To install Triage locally, you need:

  • Ubuntu/RedHat
  • Python 3.10+
  • A PostgreSQL 13+ database with your source data (events, geographical data, etc) loaded.
    • NOTE: If your database is PostgreSQL 13+ you will get some speed improvements. We recommend updating to a recent version of PostgreSQL.
  • Ample space on an available disk (or for example in Amazon Web Services's S3) to store the matrices and models that will be created for your experiments

We recommend starting with a new Python virtual environment and pip installing triage there.

$ virtualenv triage-env
$ . triage-env/bin/activate
(triage-env) $ pip install triage

If you get an error related to pg_config executable, run the following command (make sure you have sudo access):

(triage-env) $ sudo apt-get install libpq-dev python3.9-dev

Then rerun pip install triage

(triage-env) $ pip install triage

To test if triage was installed correctly, type:

(triage-env) $ triage -h

Data

Triage needs data in a postgres database and a configuration file that has credentials for the database. The Triage CLI defaults database connection information to a file stored in 'database.yaml' (example in example/database.yaml).

If you don't want to install Postgres yourself, try triage db up to create a vanilla Postgres 12 database using docker. For more details on this command, check out Triage Database Provisioner

Configure Triage for your project

Triage is configured with a config.yaml file that has parameters defined for each component. You can see some sample configuration with explanations to see what configuration looks like.

Using Triage

  1. Via CLI:
triage experiment example/config/experiment.yaml
  1. Import as a python package:
from triage.experiments import SingleThreadedExperiment

experiment = SingleThreadedExperiment(
    config=experiment_config, # a dictionary
    db_engine=create_engine(...), # http://docs.sqlalchemy.org/en/latest/core/engines.html
    project_path='/path/to/directory/to/save/data' # could be an S3 path too: 's3://mybucket/myprefix/'
)
experiment.run()

There are a plethora of options available for experiment running, affecting things like parallelization, storage, and more. These options are detailed in the Running an Experiment page.

Development

Triage was initially developed at University of Chicago's Center For Data Science and Public Policy and is now being maintained at Carnegie Mellon University.

To build this package (without installation), its dependencies may alternatively be installed from the terminal using pip:

pip install -r requirement/main.txt

Testing

To add test (and development) dependencies, use test.txt:

pip install -r requirement/test.txt [-r requirement/dev.txt]

Then, to run tests:

pytest

Development Environment

To quickly bootstrap a development environment, having cloned the repository, invoke the executable develop script from your system shell:

./develop

A "wizard" will suggest set-up steps and optionally execute these, for example:

(install) begin

(pyenv) installed

(python-3.9.10) installed

(virtualenv) installed

(activation) installed

(libs) install?
1) yes, install {pip install -r requirement/main.txt -r requirement/test.txt -r requirement/dev.txt}
2) no, ignore
#? 1

Contributing

If you'd like to contribute to Triage development, see the CONTRIBUTING.md document.

Metadata

Release files for triage 6.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for triage 6.0.0
File Size Uploaded
triage-6.0.0.tar.gz 3.9 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for triage 6.0.0
File Interpreter ABI Platform
triage-6.0.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 4.2 MB

Release files / triage-6.0.0.tar.gz

Download URL triage-6.0.0.tar.gz
Size 3.9 MB
Tags Source
SHA-256 checksum
How to use checksums
38b486d7acc6543bdaa8eaa33f989c7e982c56edf788425b5b69afc174040754
BLAKE2b-256 checksum
How to use checksums
92ed7a85e041415958f804c7fcd333c54c286d625d8a0c588ad0837adbb43281
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / triage-6.0.0-py2.py3-none-any.whl

Download URL triage-6.0.0-py2.py3-none-any.whl
Size 319.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2455088bcaf356840ccdae942583aae12354594bc6abf19e523b228a9b2fe23b
BLAKE2b-256 checksum
How to use checksums
dd358d298444a2e77b0459d4d93b199e9f2aed5efb075725f889e441c54d0d2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

6.0.0 This release

2 release files

5.5.5

2 release files

5.5.4

2 release files

5.5.3

2 release files

5.5.2

2 release files

5.5.1

2 release files

5.5.0

2 release files

5.4.0

2 release files

5.3.3

2 release files

5.3.2

2 release files

5.3.1

2 release files

5.3.0

2 release files

5.2.3

2 release files

5.2.2

2 release files

5.2.1

2 release files

5.2.0

2 release files

5.1.1

2 release files

5.1.0

2 release files

5.0.0

2 release files

4.4.0

2 release files

4.3.1

2 release files

4.2.0

2 release files

4.1.1

2 release files

4.1.0

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.3.0

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.1

2 release files

3.0.2

3 release files

3.0.1

3 release files

2.2.0

3 release files

2.1.0

2 release files

2.0.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.0

2 release files

0.5.0

2 release files

0.3.0

1 release file

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page