A sklearn-compatible Python implementation of Multifactor Dimensionality Reduction (MDR) for feature construction.

Overview

Master status: Build Status Code Health Coverage Status

Development status: Build Status Code Health Coverage Status

Package information: Python 2.7 Python 3.6 License PyPI version

Join the chat at https://gitter.im/EpistasisLab/scikit-mdr

MDR

A scikit-learn-compatible Python implementation of Multifactor Dimensionality Reduction (MDR) for feature construction. This project is still under active development and we encourage you to check back on this repository regularly for updates.

MDR is an effective feature construction algorithm that is capable of modeling higher-order interactions and capturing complex patterns in data sets.

MDR currently only works with categorical features and supports both binary classification and regression problems. We are working on expanding the algorithm to cover more problem types and provide more convenience features.

License

Please see the repository license for the licensing and usage information for the MDR package.

Generally, we have licensed the MDR package to make it as widely usable as possible.

Installation

MDR is built on top of the following existing Python packages:

  • NumPy

  • SciPy

  • scikit-learn

  • matplotlib

All of the necessary Python packages can be installed via the Anaconda Python distribution, which we strongly recommend that you use. We also strongly recommend that you use Python 3 over Python 2 if you're given the choice.

NumPy, SciPy, scikit-learn, and matplotlib can be installed in Anaconda via the command:

conda install numpy scipy scikit-learn matplotlib

Once the prerequisites are installed, you should be able to install MDR with a pip command:

pip install scikit-mdr

Please file a new issue if you run into installation problems.

Examples

MDR has been coded with a scikit-learn-like interface to be easy to use. The typical fit, transform, and fit_transform methods are available for every feature construction algorithm. For example, MDR can be used to construct a new feature composed from two existing features:

from mdr import MDR
import pandas as pd

genetic_data = pd.read_csv('https://github.com/EpistasisLab/scikit-mdr/raw/development/data/GAMETES_Epistasis_2-Way_20atts_0.4H_EDM-1_1.tsv.gz', sep='\t', compression='gzip')

features = genetic_data.drop('class', axis=1).values
labels = genetic_data['class'].values

my_mdr = MDR()
my_mdr.fit(features, labels)
my_mdr.transform(features)
>>>array([[1],
>>>       [1],
>>>       [1],
>>>       ...,
>>>       [0],
>>>       [0],
>>>       [0]])

You can also use MDR as a classifier, and evaluate the quality of the constructed feature with the score function:

from mdr import MDRClassifier
import pandas as pd

genetic_data = pd.read_csv('https://github.com/EpistasisLab/scikit-mdr/raw/development/data/GAMETES_Epistasis_2-Way_20atts_0.4H_EDM-1_1.tsv.gz', sep='\t', compression='gzip')

features = genetic_data.drop('class', axis=1).values
labels = genetic_data['class'].values

my_mdr = MDRClassifier()
my_mdr.fit(features, labels)
my_mdr.score(features, labels)
>>>0.998125

If you want to use MDR for regression problems, use ContinuousMDR:

from mdr import ContinuousMDR
import pandas as pd

genetic_data = pd.read_csv('https://github.com/EpistasisLab/scikit-mdr/raw/development/data/GAMETES_Epistasis_2-Way_continuous_endpoint_a_20s_1600her_0.4__maf_0.2_EDM-2_01.tsv.gz', sep='\t', compression='gzip')
features = genetic_data[['M0P0', 'M0P1']].values
targets = genetic_data['Class'].values

my_cmdr = ContinuousMDR()
my_cmdr.fit(features, targets)
my_cmdr.transform(features)
>>>array([[0],
>>>       [1],
>>>       [1],
>>>       ...,
>>>       [0],
>>>       [1],
>>>       [1]])

Contributing to MDR

We welcome you to check the existing issues for bugs or enhancements to work on. If you have an idea for an extension to the MDR package, please file a new issue so we can discuss it.

Having problems or have questions about MDR?

Please check the existing open and closed issues to see if your issue has already been attended to. If it hasn't, file a new issue on this repository so we can review your issue.

Citing MDR

If you use this software in a publication, please consider citing it. You can cite the repository directly with the following DOI:

[blank for now]

Support for MDR

The MDR package was developed in the Computational Genetics Lab with funding from the NIH. We're incredibly grateful for their support during the development of this project.

Owner
Epistasis Lab at UPenn
Prof. Jason H. Moore's research lab at the University of Pennsylvania
Epistasis Lab at UPenn
open-source feature selection repository in python

scikit-feature Feature selection repository scikit-feature in Python. scikit-feature is an open-source feature selection repository in Python develope

Jundong Li 1.3k Jan 05, 2023
A scikit-learn-compatible Python implementation of ReBATE, a suite of Relief-based feature selection algorithms for Machine Learning.

Master status: Development status: Package information: scikit-rebate This package includes a scikit-learn-compatible Python implementation of ReBATE,

Epistasis Lab at UPenn 374 Dec 15, 2022
scikit-learn addon to operate on set/"group"-based features

skl-groups skl-groups is a package to perform machine learning on sets (or "groups") of features in Python. It extends the scikit-learn library with s

Danica J. Sutherland 41 Apr 06, 2022
A sklearn-compatible Python implementation of Multifactor Dimensionality Reduction (MDR) for feature construction.

Master status: Development status: Package information: MDR A scikit-learn-compatible Python implementation of Multifactor Dimensionality Reduction (M

Epistasis Lab at UPenn 122 Jul 06, 2022
An open source python library for automated feature engineering

"One of the holy grails of machine learning is to automate more and more of the feature engineering process." ― Pedro Domingos, A Few Useful Things to

alteryx 6.4k Jan 05, 2023
A set of tools for creating and testing machine learning features, with a scikit-learn compatible API

Feature Forge This library provides a set of tools that can be useful in many machine learning applications (classification, clustering, regression, e

Machinalis 380 Nov 05, 2022
Automatic extraction of relevant features from time series:

tsfresh This repository contains the TSFRESH python package. The abbreviation stands for "Time Series Feature extraction based on scalable hypothesis

Blue Yonder GmbH 7k Jan 03, 2023
Python implementations of the Boruta all-relevant feature selection method.

boruta_py This project hosts Python implementations of the Boruta all-relevant feature selection method. Related blog post How to install Install with

1.2k Jan 04, 2023
a feature engineering wrapper for sklearn

Few Few is a Feature Engineering Wrapper for scikit-learn. Few looks for a set of feature transformations that work best with a specified machine lear

William La Cava 47 Nov 18, 2022
A fast xgboost feature selection algorithm

BoostARoota A Fast XGBoost Feature Selection Algorithm (plus other sklearn tree-based classifiers) Why Create Another Algorithm? Automated processes l

Chase DeHan 187 Dec 22, 2022