Skip to content

MachineLearningVisionRG/fsmpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pypi

fsmpy Development Repository

fsmpy_library_process

fsmpy (Fuzzy Set Measures) is a Python module for the application of Fuzzy Set Theory and is distributed under the 3-Clause BSD license.

website: https://machinelearningvisionrg.github.io/fsmpy-docs/

Installation

Dependencies

  • Python (>=3.7)
  • NumPy (>= 1.14.6)
  • scikit-learn (>=0.24.2)

User installation

If you have a working installation of NumPy and scikit-learn, the simplest way to install fsmpy is using the package installer for Python, pip

pip install fuzzy-set-measures

Changelog

See the changelog for a history important changes to the library.

Development & Contributions

All contributions of any level and kind are welcome. Please follow the Development Guide for further information about the contribution process, documentation, tests and more.

All tests are run by executing pytest in the top level directory. No subset of tests is available for the time being.

Source code

You can get the latest version of the source code using this command:

git clone https://github.com/MachineLearningVisionRG/fsmpy

Pull request submission

Before opening a pull request, take a look at the contribution page.

Examples

Some basic usage examples are provided below. Please take a look at the documentation for further information and detailed examples.

Fuzzy sets representation

Fuzzy Sets are represented through the IntuitionisticFuzzySet class which includes attributes for the corresponding membership and non-membership values. A Fuzzy Set S with membership and non-membership values is initialized in the following manner:

S = IntuitionisticFuzzySet(membership_values: Iterable, non_membership_values: Iterable = None)

To represent the following Fuzzy Set patterns in X:

S1

S2

S3

use the IntuitionisticFuzzySet class to initialize an object like so:

S1 = IntuitionisticFuzzySet([0.5, 0.8, 0.7], [0.4, 0.0, 0.1])
S1 = IntuitionisticFuzzySet([1.0, 0.0, 1.0], [0.0, 0.0, 0.1])
S1 = IntuitionisticFuzzySet([0.9, 0.8, 0.0], [0.5, 0.3, 0.0])

Note that patterns that do not represent a set should be set to 0.

Fuzzy measure usage

Calculate the normalized Euclidean distance between two Fuzzy Sets A and B:

import fsmpy as fsm
from fsmpy.distances import atanassov

atanassov(A, B, fsm.DISTANCE_NORMALIZED_EUCLIDEAN)

Calculate the second similarity measure proposed by Liang and Shi (2003):

import fsmpy as fsm
from fsmpy.similarities import liang_shi

liang_shi(A, B, fsm.LIANG_SHI_SIMILARITY_2, p=2)

Pattern Recognition

Load the provided medical diagnosis data used in the literature and classify the first patient's symptoms to the corresponding diagnosis with the distance measure proposed by Wang and Xin (2005), with $p=2$:

from fsmpy.distances import wang_xin
from fsmpy.utils import classify
from fsmpy.datasets import load_patients_diagnoses

diagnoses, patients = load_patients_diagnoses()
classify(diagnoses, patients[0], wang_xin, p=2)

Citation

If you use fsmpy in a scientific publication, please use the following bibtex citation:

@article{
      2022, 
      title={Fsmpy: A Fuzzy Set Measures Python Library}, 
      volume={13}, 
      ISSN={2078-2489}, 
      url={http://dx.doi.org/10.3390/info13020064}, 
      DOI={10.3390/info13020064}, 
      number={2}, 
      journal={Information}, 
      publisher={MDPI AG}, 
      author={Sidiropoulos, George K. and Apostolidis, Kyriakos D. and Damianos, Nikolaos and Papakostas, George A.}, 
      year={2022}, 
      month={Jan}, 
      pages={64}
}

About

Generalized measures for application in Fuzzy Set Theory.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages