Skip to content

Implementation of rough sets based reduction algorithm for Python

License

Notifications You must be signed in to change notification settings

Taha-apa/scikit-roughsets

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scikit-roughsets

https://travis-ci.org/paudan/scikit-roughsets.svg?branch=master

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. Integration with scikit-learn package is also provided.

Installation

The package can be easily installed using Python's pip utility:

pip install git+https://github.com/paudan/scikit-roughsets.git

Usage

The usage is very straightforward, identical to scikit feature selection module:

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:

  • X must be an integer matrix, and y must must be an integer array
  • It does not work with NaN values, thus, initial preprocessing must be performed by the user

Tests

Tests can be run using pytest tool:

pytest tests/tests.py

About

Implementation of rough sets based reduction algorithm for Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%