Interfaces for CIT implementations
- class ITestCI
Interface specifying how to expose (custom) CIT-implementations. Supports the efficient dispatch of large collections of blocks.
See also
For use with the current mCIT implementation, also the interfaces for
IProvideVarianceForCITand potentiallyIProvideAnalyticQuantilesForCITshould be exposed. For details, see also Interfaces for Custom Stages.- class Result
Output format for (custom) CIT-implementations.
- global_score: float
Score for the entire dataset.
- dependent: bool
Dependency on the entire dataset.
- block_scores: ndarray | None = None
Score for each block individually (if applicable).
- __init__(global_score: float, dependent: bool, block_scores: ndarray | None = None) None
- run_single(data: CIT_DataPatterned) Result
Run a single CIT on all data.
- Parameters:
data (CIT_DataPatterned) – The data-set to use.
- Returns:
Structured test-output.
- Return type:
- static ITestCI._extract_cache_id(fname: str, data: CIT_DataPatterned | BlockView) tuple
Extract a cache-id from a given query. A fallback returning
data.cache_idis provided; it is possible, but not typically necessary to overwrite this fallback.See also
For a discussion of cache-IDs, see Cache IDs.
- Parameters:
fname (str) – name of the method to cache
data (CIT_DataPatterned | BlockView) – data containing the cache-id
- Returns:
extracted cache-id, here simply
data.cache_id.- Return type:
tuple
- class IProvideAnalyticQuantilesForCIT
Interface to expose for (custom) CIT-implementations if the homogeneity-test
Homogeneity_Binomialis used. Quantiles can also be bootstrapped, if no implementation (None) of this interface is provided.- cit_quantile_estimate(data: BlockView, cit_result: Result, beta: float, cit_obj: ITestCI) float
Provide an estimate of the \(\beta\)-quantile for the test implemented by cit_obj.
- Parameters:
data (BlockView) – The data-blocks to operate on.
cit_result (ITestCI.Result) – The CIT result for the data (currently always run previously anyway).
beta (float) – The quantile \(\beta\) to estimate.
cit_obj (ITestCI) – The underlying cit-instance for which the quantile should be computed. (The present interface
IProvideAnalyticQuantilesForCITcan, but does not have to, be exposed on the CIT-type itself.)
- Returns:
Estimate of the dependence-value at the quantile \(\beta\)
- Return type:
float
- class IProvideVarianceForCIT
Interface to expose for (custom) CIT-implementations if one of the acceptance-interval tests (
IndicatorImplication_AcceptanceIntervalorIndicatorImplication_AcceptanceInterval) is used. These tests require variance-estimates for the block-wise dependence-scores provided by the CIT.- get_variance_estimate(N: int, dim_Z: int, cit_obj: ITestCI) float
Get an estimate of the block-wise variance of the dependence score implemented by cit_obj.
- Parameters:
N (int) – The sample count N.
dim_Z (int) – The dimension of (number of variables in) the condition conditioning set Z.
cit_obj (ITestCI) – The underlying cit-instance for which the variance should be computed. (The present interface
IProvideVarianceForCITcan, but does not have to, be exposed on the CIT-type itself.)
- Returns:
The estimated value of the variance.
- Return type:
float
- get_std_estimate(N: int, dim_Z: int, cit_obj: ITestCI) float
Get an estimate of the block-wise standard-deviation of the dependence score implemented by cit_obj. Implementation is optional, if this method is not overridden, the square-root of the variance is used.
- Parameters:
N (int) – The sample count N.
dim_Z (int) – The dimension of (number of variables in) the condition conditioning set Z.
cit_obj (ITestCI) – The underlying cit-instance for which the standard-deviation should be computed. (The present interface
IProvideVarianceForCITcan, but does not have to, be exposed on the CIT-type itself.)
- Returns:
The estimated value of the standard-deviation.
- Return type:
float