API and modules
Feature selection methods with selective inference. |
|
Domain adaptation methods with selective inference. |
|
Test statistic definitions for selective inference. |
Global pythonsi
functions and classes:
- class pythonsi.Data(parent: any = None)[source]
Data object (node) which is used to store data and parametrized data.
- Parameters:
parent (any, optional) – Parent node to compute data from. If None, data must be set directly.
- data
The observed data stored in this node
- Type:
array-like or None
- parent
Parent node for computation
- Type:
any or None
- a
Parametrized intercept
- Type:
array-like or None
- b
Parametrized coefficient for inference
- Type:
array-like or None
- inference_data
Data used in the inference process
- Type:
array-like or None
- inference(z: float)[source]
Perform inference computation with given scalar z.
Computes the linear relationship \(\mathbf{data} = \mathbf{a} + \mathbf{b} \cdot z\) and retrieves the feasible interval from parent if available.
- Parameters:
z (float) – Parameter value for inference computation
- Returns:
inference_data (array-like, shape (d,)) – Computed inference data
a (array-like, shape (d,)) – Parametrized intercept
b (array-like, shape (d,)) – Parametrized coefficient
interval (list of float) – Feasible interval from parent or [-inf, inf] if no parent
- parametrize(a: ndarray[tuple[Any, ...], dtype[floating]] = None, b: ndarray[tuple[Any, ...], dtype[floating]] = None, data: ndarray[tuple[Any, ...], dtype[floating]] = None)[source]
Set parameters for selective inference process.
- Parameters:
a (array-like, shape (d,), optional) – Linear intercept parameter
b (array-like, shape (d,), optional) – Linear coefficient parameter
data (array-like, shape (n, d), optional) – Inference data to store
- class pythonsi.Pipeline(inputs: List[Data], output: Data, test_statistic: any)[source]
Selective inference for Feature selection pipeline.
- Parameters:
- test_statistic
Test statistic computation object
- Type:
object
- inference(output_id: int, covariances: List[ndarray[tuple[Any, ...], dtype[floating]]], output: ndarray[tuple[Any, ...], dtype[floating]]) float [source]
Perform selective inference for a single specific data based on the chosen hypothesis and test statistic.
For example, testing if a specific selected feature has a non-zero coefficient
- Parameters:
feature_id (int) – Index of the feature to test (within selected features)
covariances (list of array-like) – Covariance matrices for noise in each input
output (array-like, shape (k,)) – Array of selected feature indices
- Returns:
p_value – Selective p-value for the data
- Return type:
float