Workspaces

Basic usage

What is a workspace?

A workspace is a collection of data loaders, pipelines and experiments. To initialize a workspace, use

causy workspace init

Data Loaders

First, you need to load data into causy via a data loader.

causy workspace dataloader add

allows you to choose between loading data from a JSON file, a JSONL file or to load data dynamically via a python script. Choosing an option will ask you to provide the path to the file or the script as well as to choose a name for the data loader. This name is used to reference the data loader when configuring your experiments.

To remove a data loader, use

causy workspace dataloader remove

Pipelines

Pipelines are a sequence of steps that are executed in order and define your causal discovery process. You can add a pipeline with

causy workspace pipeline add 

Running the previous command will ask you to use a preconfigured pipeline, manipulate and existing pipeline or create a new pipeline skeleton as a python module. You are then asked to provide a pipeline name. This is useful when you want to run different algorithms or modified versions of the same algorithm on the same data. You are then asked to provide a name for your pipeline to reference it when configuring your experiments.

You can remove a pipeline with

causy workspace pipeline remove

Experiments

You can add an experiment with

causy workspace experiment add

You will be asked to provide a name for the experiment and to choose a data loader and a pipeline. After setting up your first experiment, a workspace has been created and you can find the workspace.yml file in the current directory.

You can adjust your experiment configurations by editing the workspace.yml file. For example, if you want to use the thresholds 0.05 and 0.01 for the independence tests in your PC pipeline, you can edit the thresholds in your workspace.yml file:

name: your_workspace_name
author: your_name
pipelines:
  pc:
    reference: PC
    type: name
dataloaders:
  your_dataloader_name:
    options: null
    reference: your_data_name.json
    type: json
experiments:
  your_first_experiment:
    dataloader: your_dataloader_name
    pipeline: pc
    variables:
      threshold: 0.005
  your_second_experiment:
    dataloader: your_dataloader_name
    pipeline: pc
    variables:
      threshold: 0.01

Alternatively, you can change variables using the command

causy workspace experiment update-variable your_experiment_name your_variable_name your_variable_value

Executing a workspace

You can run all experiments that have not been executed yet in your workspace with

causy workspace execute

The first time, this will execute all experiments. Later, it will only execute new experiments that have not been executed yet. If you want to execute all experiments, even the ones that have been executed before, use

causy workspace execute --force-reexecution 

If you want to execute a specific experiment, use

causy workspace execute --experiment-name

Compare graphs in the command line

To compare the graphs of some or all experiments using different models or hyperparameters via a matrix plot, use

causy workspace diff experiment_name_1 experiment_name_2 experiment_name_3

Use causy UI

To compare the graphs in the UI, switch between different experiments and visualize the causal discovery process, use

causy ui

The sidebar allows you to further analyze each step of your pipeline and check which edge was updated when and why. You can click on edges to see the correlation and the direct effect if one exists.

Supported algorithms

Currently, causy supports the following algorithms:

  • PC (Peter-Clark)
    • PC - the original PC algorithm without any modifications causy.algorithms.PC
    • ParallelPC - a parallelized version of the PC algorithm causy.algorithms.ParallelPC

Advanced usage

Documentation on how to create custom pipelines and more will be added soon.

Last Updated: