Skip to main content

A Python package for integrating scikit-learn feature selection with multi-label problem transformation methods.

Project description

Scikit-PTM-FS

PyPI version Python License: MIT

Scikit-PTM-FS is a Python library that enables seamless integration of scikit-learn feature selection methods with multi-label classification via problem transformation methods (PTMs). The framework enables transformation-aware feature selection without requiring classification stages, allowing researchers to analyze the behavior of FS methods across various PTMs.


📦 Installation

pip install scikit-ptm-fs==0.10

🚀 Usage Example

Here is a basic example of how to apply a feature selection method within a problem transformation method using Scikit-PTM-FS:

from scikit_ptm_fs.problem_transformation import LabelPowerset
from sklearn.feature_selection import SelectKBest, f_classif

# Example feature and label matrices (replace with your own)
# X = ...  # shape (n_samples, n_features)
# y = ...  # shape (n_samples, n_labels)

# Step 1: Define a scikit-learn selector
selector = SelectKBest(score_func=f_classif, k=5)

# Step 2: Wrap it using the LabelPowerset PTM
lp_selector = LabelPowerset(selector=selector, require_dense=[False, True])

# Step 3: Apply feature selection
X_selected = lp_selector.fit_transform(X, y)

# Step 4: Get selected feature indices
selected_indices = lp_selector.get_support()
print("Selected features:", selected_indices)

💡 You can use other PTMs like BinaryRelevance, PPT, or PairwiseComparison similarly.


🧠 Supported Problem Transformation Methods (PTMs)

  • Binary Relevance (BR) — One-vs-All decomposition.
  • Label Powerset (LP) — Unique labelset encoding.
  • Pairwise Comparison (PW) — One-vs-One label pair modeling.
  • Pruned Problem Transformation (PPT) — Labelset pruning before transformation.
  • Entropy-based Label Assignment (ELA) — Copy-based transformation for NLP.

🔗 Project Links


📄 License

This project is licensed under the MIT License.

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

scikit_ptm_fs-0.10.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

scikit_ptm_fs-0.10-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file scikit_ptm_fs-0.10.tar.gz.

File metadata

  • Download URL: scikit_ptm_fs-0.10.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for scikit_ptm_fs-0.10.tar.gz
Algorithm Hash digest
SHA256 83cd8b48c53e46c4c62458c34c4c52817eb5d87cb92d8728100ef17cbd90b078
MD5 a191edc4a0cca2c20f286796814d35ad
BLAKE2b-256 f25fd44fa068001b6cbde654417181fb7a07aeae39ddacb64495e268be155755

See more details on using hashes here.

File details

Details for the file scikit_ptm_fs-0.10-py3-none-any.whl.

File metadata

  • Download URL: scikit_ptm_fs-0.10-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for scikit_ptm_fs-0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 80ef2d5c64e27278b1c3e2f5d6d79c938acbf30526c3e7731f01a7e991383fd1
MD5 1f3527f07ac457555024ca09ac09fe67
BLAKE2b-256 13de97c4e2eddd91eecd47c7668c220ca636d9a2e3c635e5f2985fa57a5bf111

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