Skip to main content

Generalized measures for application in fuzzy set theory.

Project description

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}
}

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

fuzzy-set-measures-0.1.2.tar.gz (22.1 kB view hashes)

Uploaded Source

Built Distribution

fuzzy_set_measures-0.1.2-py3-none-any.whl (24.9 kB view hashes)

Uploaded Python 3

Supported by

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