Skip to main content

A Python library for fuzzy-rough set utility functions.

Project description

FRsutils Logo

Installation

  • $pip install frsutils

  • Requirements

    • Python
    • Numpy

Fuzzy-Rough set utilities (Under development)

A basic Python library needed for fuzzy rough set calculations e.g.:

  • lower approximation
  • upper approximation
  • positive region
  • boundry region

Algorithgms and containings

  • Implicators
    • Gaines
    • Goedel
    • Kleene–Dienes
    • Reichenbach
    • Lukasiewicz
  • T-norms
    • min tnorm
    • product tnorm
  • ITFRS (Implicator/T-norm Fuzzy-Rough Sets)

Notes

  • All functions expect to get normalized scalar of normalized numpy arrays.
  • Make sure the input dataset is normalized. This library expects all inputs to all functions are in range [0,1]
  • This library will use all features of data instances to calculate the fuzzzy-rough measures.

Some technical information to remember

In ITFRS

lower approximation for each instance:

lower aaproximation

upper approximation for each instance:

upper aproximation

Since for the calculations of lower approximation, we calculate Inf which is basically a minimum, to exclude the same instance from calculations we don’t need anything because the main diagonal is set to 1.0 which is ignored by min operator. To be sure all is correct, inside code, we set main diagonal to 1.0

Since for the calculations of upper approximation, we calculate sup which is basically a maximum, to exclude the same instance from calculations we need to set the main diagonal to 0.0 which is ignored by max operator. Otherwise all upper approxamations will be 1.0.

In ITFRS, POS(x) = lower_approximation(x) where x is a data instance, and datasets having crisp classes.

tnorms

  • works on 1D vectors (for aggregating the values to a scalar in similarity calculations)
  • works on nxnx2 maps for fast calculations
  • min tnorm and product tnorm will act the same if one of the input parameters takes the binary values; So, no matter which one you use, they provide the same reults
min_tnorm
product_tnorm

Implicators

  • Since in this library, A(y) in implicators--if instance x has the same class of instance y, is used, therefore different implicators boil down to the same thing:
    • Goedel and Gaines produce the same results
    • KD, Reichenbach and Luk also produce the same results
  • implicators work on scalar but can be vectorized with np.vectorize()
  • implicators do not generate the same values for these (0,0) , (1,0) , (0,1) , (1,1). Their behavior is different. Do not draw a general conclusion on them.
Luk
Goedel
KD
Reichenbach
Gaines

where x, y are two data instances; A(y) means if the instance y has the same class as X and returns 0.0 or 1.0.

Docs

  • We use Doxygen-style (Javadoc-like) Python Docstrings and documents are generated by Doxygen
  • To see online documentations, please visit online documentations

How to run tests

These are two ways:

  • use pytest and it finds and runs all tests
  • If you want to run tests in debug mode, find and run the file experimental_tests.py (Make sure all functions in test files are called in this file. Maybe some are forgotten)

TODO:

  • Add tests for tnorms with non-binary masks
  • Implemene and debug OWAFRS (Ordered Weighted Average Fuzzy-Rough Sets)
  • Implemene and debug VQRS (Vaguely Quantified Rough Sets)

License

This project is licensed under the AGPL-3.0 License. See the LICENSE file for details.

How to Cite us in your research papers

If you use this library in your research, please cite it as follows:

APA :

Mehran Amiri. (2025). FRsutils (Version 0.0.1) [Computer software]. https://github.com/mehi64/FRsutils

BibTeX (for LaTeX users):

@software{Mehran_Amiri_FRsutils_2025,
  author = {Amiri, Mehran},
  title = {FRsutils},
  url = {https://github.com/mehi64/FRsutils},
  version = {0.0.1},
  year = {2025}
}

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

frsutils-0.0.2.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

frsutils-0.0.2-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file frsutils-0.0.2.tar.gz.

File metadata

  • Download URL: frsutils-0.0.2.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for frsutils-0.0.2.tar.gz
Algorithm Hash digest
SHA256 57789fee581657553166e82b02c6da9132e3b168217213069abcac99345ac71e
MD5 e17cc966131895483ee282dfdd5ec22f
BLAKE2b-256 0e08b238572c41c7d9d6358308d8bf021d3e4a808dcba6c04b709dcdb58fbafe

See more details on using hashes here.

File details

Details for the file frsutils-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: frsutils-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for frsutils-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eb8dff25b4a21fb1b8af71b586581fc0a41c2a2119b220f15c521c032124f939
MD5 376558f70f7630afac305b6aa54ff34e
BLAKE2b-256 b5794f64a63ea97d7cd623cfe106079753ff90281c683c8118de75a08977b32a

See more details on using hashes here.

Supported by

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