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)

indices = np.where(lp_selector.get_support())[0]
print("The Number of Selected Features:", len(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.12.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.12-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scikit_ptm_fs-0.12.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.12.tar.gz
Algorithm Hash digest
SHA256 c1cc170894894b6befc4937477753d154666d2bc57d42cd8f5e6df0e6d87572c
MD5 f164b61cef1f1322eb13a67c3054957e
BLAKE2b-256 417c15c6f66c0315ca536987fcdb48c0a0426576cab7c702d2c45e5233b02b03

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scikit_ptm_fs-0.12-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.12-py3-none-any.whl
Algorithm Hash digest
SHA256 25c1161a122722d78d92c1fdd8c7b815a6f6fe7553ab5773926337d5123cd297
MD5 51ab84481e4b0fa6071026a35b31f7d8
BLAKE2b-256 8418fb0d46561b482b21584cc58e8c0ad9ee3b7b1223119897ef58fd2453f028

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