Implementation of rough sets based reduction algorithm for Python
.. image:: https://travis-ci.org/paudan/scikit-roughsets.svg?branch=master :target: https://travis-ci.org/paudan/scikit-roughsets
This is an implementation of rough sets feature reduction algorithm, based on MATLAB code from
Dingyu Xue, YangQuan Chen. Solving applied mathematical problems with MATLAB <https://books.google.lt/books?id=V4vulPEc29kC>
_. Integration with scikit-learn package is also provided.
The package can be easily installed using Python's pip
utility:
.. code:: shell
pip install git+https://github.com/paudan/scikit-roughsets.git
The usage is very straightforward, identical to scikit
feature selection module:
.. code:: python
from scikit_roughsets.rs_reduction import RoughSetsSelector
import numpy as np
y = np.array([[1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1]]).T
X = np.array([[1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0],
[0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1],
[1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0],
[0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1],
[1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1],
[1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1],
[1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1],
[1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1],
[1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1],
[1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1]])
selector = RoughSetsSelector()
X_selected = selector.fit(X, y).transform(X)
Several restrictions apply to its current use:
Tests can be run using pytest
tool:
.. code:: shell
pytest tests/tests.py