Creating a reduced SPI set
Filtering an SPI Set
If you would like to filter SPIs based on their corresponding keywords, you can do so using the filter_spis
function in pyspi. This will return a new config file containing the reduced SPI set that you can provide to the Calculator
object.
As an example, let's use the filter to obtain a subset of SPIs with the keywords linear
and signed
:
Note that here we do not specify a source config.yaml file. By default, the filter_spis
function will use the original config.yaml (containing the full set of SPIs) located in the pyspi directory. If you would like to provide a custom YAML as the source file, you can provide the location of the file to the function with the optional keyword configfile.
We should obtain a reduced subset of SPIs with the keywords "linear" and "signed". Let's now compute this reduced set on some data:
Manually specifying a reduced set
You can use a subset of the SPIs by copying a version of the config.yaml
file to a local directory and manually removing those you don’t want the calculator to compute. First, copy the config.yaml
file to your workspace:
Once you've got a local copy of config.yaml
edit the file to remove any SPIs you're not interested in. A minimal configuration file might look like the following if you're only interested in computing a covariance matrix using the maximum likelihood estimator:
Ensure you retain the labels
and dependencies
keys from the original config.yaml file when creating your custom set.
When you instantiate the calculator, instead of using the default config.yaml,
you can input your bespoke configuration file:
Then use the calculator as normal (see Getting Started).
Last updated