CLI¶
Cocoa ships a command-line interface, cocoa, that drives every stage of the
pipeline. Each stage has its own command, and there are two convenience commands
for running everything at once and for merging datasets.
Commands¶
| Command | What it does |
|---|---|
cocoa collate |
Collate raw tables into a denormalized event stream. |
cocoa tokenize |
Tokenize collated data into integer timelines. |
cocoa winnow |
Prepare held-out timelines for evaluation. |
cocoa pipeline |
Run collate, tokenize, and winnow end-to-end. |
cocoa combine-datasets |
Merge multiple processed datasets into one. |
Every stage command accepts --processed-data-home / -p (the working directory
for intermediate and output files) and --verbose / -v (extra logging and
summary statistics). Each also takes an optional -c config file that overrides
the packaged default for that stage.
Run any command with -h / --help to see its full set of options:
Typical usage¶
Run the whole pipeline in one go:
Or drive the stages individually — for example, to reuse a previously learned
tokenizer via --tokenizer-home (see the
Tokenizer Transfer recipe):
cocoa collate --raw-data-home /path/to/raw --processed-data-home ./processed/ucmc
cocoa tokenize --tokenizer-home ./processed/mimic/tokenizer.yaml \
--processed-data-home ./processed/ucmc
cocoa winnow --processed-data-home ./processed/ucmc
CLI for cocoa - configurable collation and tokenization
collate(collation_config=None, raw_data_home=..., processed_data_home=..., verbose=False)
¶
Collate raw data into a denormalized format.
Reads collation configuration and produces a MEDS-like parquet file with collated events.
Source code in src/cocoa/cli.py
combine_datasets(input_data_dirs, output_data_dir=...)
¶
Combine multiple processed datasets into one.
Merges parquet files and validates that tokenizer configurations match across all input directories.
Source code in src/cocoa/cli.py
pipeline(collation_config=None, tokenization_config=None, winnowing_config=None, raw_data_home=..., processed_data_home=..., verbose=False)
¶
Run the full pipeline: collate, tokenize, & winnow.
Source code in src/cocoa/cli.py
tokenize(tokenization_config=None, processed_data_home=..., tokenizer_home=None, verbose=False)
¶
Tokenize collated data into integer sequences.
Reads collated parquet files and produces tokenized timelines with vocabulary and bin information.
Source code in src/cocoa/cli.py
winnow(winnowing_config=None, processed_data_home=..., verbose=False)
¶
Winnow held-out data for evaluation.
Filters held-out timelines and assigns flags to disqualify certain subjects from evaluation based on the configured criteria.