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 --upgrade scikit-ptm-fs==0.1.9

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: scikit_ptm_fs-0.1.9.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.9.tar.gz
Algorithm Hash digest
SHA256 58b5cccabca910108fc435ee605ce0582123e58b4376e4f3aae4d0b7e7183076
MD5 c8d7d6a5b70b60914cb28904cbe0ddc4
BLAKE2b-256 d2573c309f6d4bec0e631ca8c06de679c191a5b22cca962cd74344fa864835df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scikit_ptm_fs-0.1.9-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.9-py3-none-any.whl
Algorithm Hash digest
SHA256 88642f92245b49f3fd0395207aa8e40673d2bb9ea8f5c5ae444216200864a198
MD5 4e6a61c5a06913efa8fbb92e0b3acc6c
BLAKE2b-256 b384eb99c907327154c9cd2518c9aae6afbf062140a5c6e288ad0d67a2fe6d9c

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