Skip to main content

A Python package for Parallelized Minimum Redundancy, Maximum Relevance (mRMR) Ensemble Feature selections.

Project description

PymRMRe

Description

Feature selection is one of the main challenges in analyzing high-throughput genomic data. Minimum redundancy maximum relevance (mRMR) is a particularly fast feature selection method for finding a set of both relevant and complementary features. The Pymrmre package, extend the mRMR technique by using an ensemble approach to better explore the feature space and build more robust predictors. To deal with the computational complexity of the ensemble approach, the main functions of the package are implemented and parallelized in C++ using openMP Application Programming Interface. The package also supports making best selections with some fixed-selected features.

Prerequisite

Python(>=3.6.0)
Cython(>=0.29.12)
numpy(>=1.16.4)
pandas(>=0.25.0)

Installation

pip install Pymrmre

Insturctions

Two primary functions are provided in this package currently:

  • mrmr_ensemble: It provides the ensemble (multiple) solutions of feature selection given the input of feature dataset and target column, it supports the feature selection with preselection as well.

    • :param features: Pandas dataframe, the input dataset
    • :param targets: Pandas dataframe, the target features
    • :param fixed_features: List, the list of fixed features (column names), the default is empty list
    • :param category_features: List, the list of features whose types are categorical (column names), the default is empty list
    • :param solution_length: Integer, the number of features contained in one solution
    • :param solution_count: Integer, the number of solutions to be returned, the default is 1
    • :param estimator: String, the way of computing continuous estimators, the default is Pearson
    • :param return_index: Boolean, to determine whether the solution contains the indices or column names of selected features, the default is False
    • :param return_with_fixed: Boolean, to determine whether the solution contains the fixed selected features, the default is True
    • :return: Pandas series, the solutions of selected features
  • mrmr_ensemble_survival: It provides the ensemble (multiple) solutions of feature selection given the input of feature dataset and target column, it supports the feature selection with preselection as well.

    • :param features: Pandas dataframe, the input dataset
    • :param targets: Pandas dataframe, the target features, it must have two columns (event and time of survival data)
    • :param fixed_features: List, the list of fixed features (column names), the default is empty list
    • :param category_features: List, the list of features whose types are categorical (column names), the default is empty list
    • :param solution_length: Integer, the number of features contained in one solution
    • :param solution_count: Integer, the number of solutions to be returned, the default is 1
    • :param estimator: String, the way of computing continuous estimators, the default is Pearson
    • :param return_index: Boolean, to determine whether the solution contains the indices or column names of selected features, the default is False
    • :param return_with_fixed: Boolean, to determine whether the solution contains the fixed selected features, the default is True
    • :return: Pandas series, the solutions of selected features

Example code:

import pandas as pd
from Pymrmre import mrmr

Load the input data and target variable, suppose for input X we have ten features (f1, f2, ..., f10):

X = pd.read_csv('train_x.csv')
Y = pd.read_csv('train_y.csv')

Suppose we want to generate 3 solutions, where each solution has 5 features. We want to see f1 exists in all solutions (preselection), and we know that f4 and f5 are categorical variables as well, the code should be like this:

solutions = mrmr.mrmr_ensemble(features=X,targets=Y,fixed_features=['f1'],category_features=['f4','f5'],solution_length=5,solution_count=3)

Because the solution we generated is of the type Pandas series, which has the target variable name as column header. To access the contents of all three solutions, the code is like this:

solutions.iloc[0]

To access one of the solutions, the code is like this (i is 0 - 2 here since we generate 3 solutions here):

solutions.iloc[0][i]

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

pymrmre-1.0.2.tar.gz (18.5 MB view details)

Uploaded Source

Built Distributions

pymrmre-1.0.2-py3.8-linux-x86_64.egg (359.6 kB view details)

Uploaded Egg

pymrmre-1.0.2-py3.7-linux-x86_64.egg (428.1 kB view details)

Uploaded Egg

File details

Details for the file pymrmre-1.0.2.tar.gz.

File metadata

  • Download URL: pymrmre-1.0.2.tar.gz
  • Upload date:
  • Size: 18.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pymrmre-1.0.2.tar.gz
Algorithm Hash digest
SHA256 325fd17a99a9d65793257c852a35c896ad11c6b5f22b7a588b76e3fb67e7eb52
MD5 857cf20d7ef01159706d4484366c5ccf
BLAKE2b-256 9e3fced09b595c62f36608fa56caf98fffe4ab2add9311d822f3a7dfed02eb85

See more details on using hashes here.

File details

Details for the file pymrmre-1.0.2-py3.8-linux-x86_64.egg.

File metadata

  • Download URL: pymrmre-1.0.2-py3.8-linux-x86_64.egg
  • Upload date:
  • Size: 359.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for pymrmre-1.0.2-py3.8-linux-x86_64.egg
Algorithm Hash digest
SHA256 905f7af77b4ef0dcaa9c511736baf2fb240f9ad24cbd4c7ac1ef2a96c574556b
MD5 c517f04c2f012df6c7cab06191be2e1c
BLAKE2b-256 7e6b8d4c14f10641862437571d4bd8fc984db2d1f4dbe3ed665fd6ccb3d0f422

See more details on using hashes here.

File details

Details for the file pymrmre-1.0.2-py3.7-linux-x86_64.egg.

File metadata

  • Download URL: pymrmre-1.0.2-py3.7-linux-x86_64.egg
  • Upload date:
  • Size: 428.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pymrmre-1.0.2-py3.7-linux-x86_64.egg
Algorithm Hash digest
SHA256 bd318a92e598ed35f01be68d1f037f12d90e8b357376b4fef6a6c7b60d430dee
MD5 8dc3122dfb56bfdbc628ed85e5c14ae0
BLAKE2b-256 56433f0809d3f5c1e5cb399c1e64f13701bb8275125dacc3617cf58ce916df08

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page