Skip to main content

A package for feature selection using Subsampling Winner Algorithm

Project description

subsamp Feature Selection with Subsampling Winner Algorithm

Subsampling Winner Algorithm (SWA)

SubsampWinner is a Python package that implements the Subsampling Winner Algorithm (SWA) for feature selection in high-dimensional datasets. It includes a robust double assurance procedure to enhance stability and reliability in feature selection.

Features

  • Subsampling Winner Algorithm (SWA) for efficient feature selection;
  • Double Assurance procedure for improved stability;
  • Support for both homoskedastic and heteroskedastic data;
  • Parallel processing capabilities for improved performance;
  • Flexible parameter tuning and multiple testing correction methods.

Installation

You can install SubsampWinner using pip:

pip install subsampwinner

Quick Start

We start the experiment by generating a dataset with 80 samples and 100 features. We test the performance of the subsampling winner algorithm against different levels of signal strength. The output includes the indices of the selected features and the summary of the final model.

Additionally, we run the double assurance procedure to further enhance the stability of the feature selection.

### setup
import numpy as np
from subsampwinner.subsamp import subsamp
from subsampwinner.SubsampDoubleAssurance import SubsampDoubleAssurance
from subsampwinner.GenerateData import generate_heteroskedastic_data

# Generate sample data
n, p = 80, 100
beta0 = np.array([0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5])
beta0_index = np.arange(len(beta0))
beta = np.zeros(p)
beta[beta0_index] = beta0
gamma = np.zeros(p)

X, y, _, _ = generate_heteroskedastic_data(n, p, hetero_func=lambda x: 1.2,
    beta=beta, gamma=gamma, type='diagonal')

# Initialize and run SWA
swa = subsamp(s=25, m=1000, qnum=15)
swa.fit(X, y)

We obtain the following selected feature indices:

# selected variables
selected_features = [selected_var + 1 for selected_var in swa.finalists]

print("Selected features:", selected_features)

and the following summary of the final model:

# A summary of selected features
swa.final_model.summary()

We verify the stability of the feature selection by running the double assurance procedure.

# Run Double Assurance procedure
sda = SubsampDoubleAssurance(m=1000)
results = sda.double_assurance(X, y, s0=26, T=0.9, I_max=20, init_range=0.3, r=0.75)

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

subsampwinner-0.0.8.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

subsampwinner-0.0.8-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file subsampwinner-0.0.8.tar.gz.

File metadata

  • Download URL: subsampwinner-0.0.8.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for subsampwinner-0.0.8.tar.gz
Algorithm Hash digest
SHA256 a7cb809d95b020cbbba5736df458ff0f339745168607280bd0024393f8dd88ef
MD5 5ce920ca92aeb00381efd6c992296301
BLAKE2b-256 aa5450bbbfbc9c45bd0259a46f5d3fb467e7197af2a149647bfb0bfd7f30208a

See more details on using hashes here.

File details

Details for the file subsampwinner-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: subsampwinner-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for subsampwinner-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 1c39abaf685d5174604629137392ae59eee5d968f90adaff7965fb876cee825b
MD5 73d2b63cb634259a63de3bf31966ecdf
BLAKE2b-256 3bd1ea92aee3dc1c61184621170ac093e3b5d1019e6d3ccbff4ab8a45d993e9f

See more details on using hashes here.

Supported by

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