A Python package for integrating scikit-learn feature selection with multi-label problem transformation methods.
Project description
Scikit-PTM-FS
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, orPairwiseComparisonsimilarly.
🧠 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
- 📦 PyPI: https://pypi.org/project/scikit-ptm-fs
- 🛠️ Source Code: https://github.com/Omaimah-AlHosni/scikit-ptm-fs
📄 License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scikit_ptm_fs-0.11.tar.gz.
File metadata
- Download URL: scikit_ptm_fs-0.11.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12894532f2515b258d3959cd0a77b12668df695f535ab76d05b16b05666fc2eb
|
|
| MD5 |
f11add9788babb4a4a5b8c32ed13cb9d
|
|
| BLAKE2b-256 |
6b1f8b14deaf561ed567a9fcee5143161e0fe421611b219adc52ded5b04e1e69
|
File details
Details for the file scikit_ptm_fs-0.11-py3-none-any.whl.
File metadata
- Download URL: scikit_ptm_fs-0.11-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d042558acf2790909330a15c9832149c2152459a060d7fb6e9465f78543c9852
|
|
| MD5 |
1d672b32c6339ab565bc3fddba75a67f
|
|
| BLAKE2b-256 |
9829c4c18b637e06edb5530d3a98b0a7a7445ee5ed9c5b04ffa681a958ad6809
|