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

🚀 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.1.8.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.1.8-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scikit_ptm_fs-0.1.8.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.1.8.tar.gz
Algorithm Hash digest
SHA256 47d7b1f3a77b7420a864d6a505c242ca4f0f0879db980819208d66b514b5d9f9
MD5 40ec1b05684a1fc196c63c21e34b345c
BLAKE2b-256 2a254a045cd09bce4e5b3c01fdceb434fec37a5347e78bd246147577efd7e2e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scikit_ptm_fs-0.1.8-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.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9741c6ad03d015a4b0a7c90d33fbba1c840ef68e9669bf2aa5187acc4d8096cc
MD5 1c21fd09205a536456540a9a6a9bce93
BLAKE2b-256 1cb8b9988afaeedad166941613f6128cf54612543ec743bf7190f85c5a2c8184

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