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 details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

Details for the file fuzzy-set-measures-0.1.2.tar.gz.

File metadata

  • Download URL: fuzzy-set-measures-0.1.2.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.6

File hashes

Hashes for fuzzy-set-measures-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8e5e4a33b7375663d9886237425fbd5e75567d037af51489120a74c5f72d78f5
MD5 c51345a627ab16a6e000189db7d951f9
BLAKE2b-256 8faf6015bde73ec8c2a8e2b131ce6d8d10c0c28e735dbfdb66e0ff100f501120

See more details on using hashes here.

File details

Details for the file fuzzy_set_measures-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for fuzzy_set_measures-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d1adb9a460426be6c6f81c636886d863cbb4ed4dc59482f9d4b0678dde9f8b92
MD5 b801d2c6ee79d7e6311991a29bd0dade
BLAKE2b-256 33cf9a18b68a6674b5e596c669e205789cb2acfcb3137182593b83c3fd76a10b

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