
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
A Python package for integrating scikit-learn feature selection with multi-label problem transformation methods.
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.
pip install scikit-ptm-fs
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
, orPairwiseComparison
similarly.
This project is licensed under the MIT License.
FAQs
A Python package for integrating scikit-learn feature selection with multi-label problem transformation methods.
We found that scikit-ptm-fs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.