Registry / ai-ml / mrmr-selection

mrmr-selection

JSON →
library0.2.8pypypi✓ verified 84d ago

mrmr-selection implements the minimum-Redundancy-Maximum-Relevance (mRMR) algorithm for feature selection. Version 0.2.8 is current, with releases on a slow cadence. It supports classification and regression tasks, using mutual information and F-statistic to rank features.

pip install mrmr-selection
INSTALL
IMPORT
SIG · MRMR-SELECTION
M
mrmr-selection
ai-mlpythonv0.2.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mrmr_classif
from mrmr import mrmr_classif
from mrmr_selection import mrmr_classif
Module name is 'mrmr', not 'mrmr_selection'.
mrmr_regression
from mrmr import mrmr_regression
import mrmr_selection
Direct import of the package fails; use 'from mrmr import'.

Select the top 2 features from the Iris dataset using mRMR classification.

import pandas as pd from sklearn.datasets import load_iris from mrmr import mrmr_classif iris = load_iris() X = pd.DataFrame(iris.data, columns=iris.feature_names) y = pd.Series(iris.target) selected_features = mrmr_classif(X=X, y=y, K=2) print(selected_features)
Debug
Known issues
breakingInput X must be a pandas DataFrame, not numpy array. Passing a numpy array silently fails or raises an error in recent versions.
fix
Convert X to a pandas DataFrame before calling mrmr_classif or mrmr_regression.
affects: >=0.2.0
deprecatedThe parameter 'n_features' was renamed to 'K' in v0.2.0. Using 'n_features' still works but will raise a DeprecationWarning.
fix
Use K=... instead of n_features=... in function calls.
affects: >=0.2.0
gotchaFor regression tasks, mrmr_regression uses F-statistic by default, not mutual information. This may not capture non-linear dependencies.
fix
If you need mutual information for regression, consider preprocessing or alternative implementations.
affects: *
gotchaThe algorithm is deterministic only if the DataFrame columns have a consistent order. Shuffling columns leads to different selections.
fix
Ensure columns are in the same order across runs or set a random_state if using tie-breaking (not yet supported).
affects: *
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'mrmr_selection'
Incorrect import path; the module is named 'mrmr', not 'mrmr_selection'.
fix
pip install mrmr-selection and then use 'from mrmr import mrmr_classif'.
TypeError: X must be a pandas DataFrame
Input X is not a DataFrame (e.g., numpy array or list).
fix
Convert X to pd.DataFrame(X, columns=...) before passing to mrmr.
ValueError: The number of features to select must be positive and <= n_features
K is larger than the number of features in X or K <= 0.
fix
Set K to a positive integer less than or equal to X.shape[1].
Upgrade
Version history
0.2.8latest on PyPI · released Jun 30, 2023
Audit
Dependencies
numpyrequiredNumerical operations
pandasrequiredData handling for input DataFrames
scikit-learnrequiredMutual information and F-statistic computation
tqdmrequiredProgress bars during feature selection
Agent activity
10 hits · last 30 days
node
4
Resources
mrmr-selection — pip install mrmr-selection · libregistry