Skip to main content

A Python library for fuzzy-rough utility functions.

Project description

FRutils Logo

Fuzzy-Rough 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). FRutils (Version 0.0.1) [Computer software]. https://github.com/mehi64/FRutils

BibTeX (for LaTeX users):

@software{Mehran_Amiri_FRutils_2025,
  author = {Amiri, Mehran},
  title = {FRutils},
  url = {https://github.com/mehi64/FRutils},
  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.1.tar.gz (24.8 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.1-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: frsutils-0.0.1.tar.gz
  • Upload date:
  • Size: 24.8 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.1.tar.gz
Algorithm Hash digest
SHA256 4377d734a7d7d68bebdd1226ba7715d7f7fb957eb5c30b0e6bb466e18b94671f
MD5 3b6fc7901c89b690ae9c53238ddd830a
BLAKE2b-256 b13f36260450cc43bbc6416c26c9774de2b3098c36a4fd8ad7d1d59a71fa2a0f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: frsutils-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 23.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d600587b0d98a649a3f01847b5d0042fc8c767039f2106132785c84ce9456048
MD5 32206c3df1c72198fdcfcd5653e847c4
BLAKE2b-256 b576ed515ec7c9f1986e2cbce40849e295950b580162ebe7442c2905530de576

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