Skip to main content

Python implementation of Integrated Path Stability Selection (IPSS)

Project description

Integrated path stability selection (IPSS)

Integrated path stability selection (IPSS) is a general method for improving feature selection algorithms that yields more robust, accurate, and interpretable models. It does so by allowing users to control the expected number of falsely selected features, E(FP), while producing far more true positives than other versions of stability selection. This implementation of IPSS applied to L1-regularized linear and logistic regression is easy to use, requiring only the X (features) and y (response) data and specification of E(FP).

Associated paper

arXiv: https://arxiv.org/abs/2403.15877

Installation

To install from PyPI:

pip install ipss

To clone from GitHub:

git clone git@github.com:omelikechi/ipss.git

Or clone from GitHub using HTTPS:

git clone https://github.com/omelikechi/ipss.git

Dependencies

For ipss:

pip install joblib numpy scikit-learn scipy

Additional dependencies required for examples:

pip install matplotlib seaborn

Examples

Examples are available in the examples folder as both .py and .ipynb files. These include

Usage

Given an n-by-p numpy array of features, X (n = number of samples, p = number of features), an n-by-1 numpy array of responses, y, and a target number of expected false positives, EFP:

from ipss import ipss

# Load/generate X and y
# Specify EFP
# Run IPSS:
result = ipss(X, y, EFP)

# Print indices of features selected by IPSS
print(result['selected_features'])

Results

result = ipss(X, y, EFP) is a dictionary containing:

  • alphas: Grid of regularization parameters (array of shape (n_alphas,)).
  • average_select: Average number of features selected at each regularization (array of shape (n_alphas,)).
  • scores: IPSS score for each feature (array of shape (p,)).
  • selected_features: Indices of features selected by IPSS (list of ints).
  • stability_paths: Estimated selection probabilities at each regularization (array of shape (n_alphas, p))
  • stop_index: Index of regularization value at which IPSS threshold is passed (int).
  • threshold: The calculated threshold value tau = Integral value / EFP (scalar).

Full ist of arguments

ipss takes the following arguments (only X and y are required, and typically only EFP is specified):

  • X: Features (array of shape (n,p)).
  • y: Responses (array of shape (n,) or (n, 1)). IPSS automatically detects if y is continuous or binary.
  • EFP: Target expected number of false positives (positive scalar; default is 1).
  • cutoff: Together with EFP, determines IPSS threshold (positive scalar; default is 0.05).
  • B: Number of subsampling steps (int; default is 50).
  • n_alphas: Number of values in regularization grid (int; default is 25).
  • q_max: Max number of features selected (int; default is None, in which case q_max = p/2).
  • Z_sparse: If True, tensor of subsamples, Z, is sparse (default is False).
  • lars: Implements least angle regression for linear regression if True, lasso otherwise (default is False).
  • selection_function: Function to apply to the stability paths. If a positive int, m, function is h_m(x) = (2x - 1)**m if x >= 0.5 and 0 if x < 0.5 (int, callable, or None; default is None, in which case function is h_2 if y is binary, or h_3 if continuous).
  • with_stability: If True, uses a stability measure in selection process (default is False).
  • delta: Determines scaling of regularization interval (scalar; default is 1).
  • standardize_X: If True, standardizes all features (default is True).
  • center_y: If True, centers y when it is continuous (default is True).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ipss-0.4.2.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

ipss-0.4.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file ipss-0.4.2.tar.gz.

File metadata

  • Download URL: ipss-0.4.2.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for ipss-0.4.2.tar.gz
Algorithm Hash digest
SHA256 513a655e4f124991f98f6615f24093062c6c8718895dabb6b63d52fb180678d0
MD5 9c9bb1fdbec6c0971c587bbec1a47f2e
BLAKE2b-256 42e265fa9ac41293fe02b73f64d9bd301878a63934e195dec14c1531d07ca71c

See more details on using hashes here.

File details

Details for the file ipss-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: ipss-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for ipss-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 80c27f5d409d56fde661d12e1a9ed3ff064514366daec014e80cda3e47596ffc
MD5 9cb67d937297eae892cedf92c0a3e808
BLAKE2b-256 f5392674171e70ed3e21a8681d91dc72f4ed4f1c85cb00d3f0fd68bec69e8ace

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page