{"id":30237693,"url":"https://github.com/devopshq/fuzzyroutines","last_synced_at":"2025-09-05T19:48:48.766Z","repository":{"id":57432758,"uuid":"205661275","full_name":"devopshq/FuzzyRoutines","owner":"devopshq","description":"Library contains some routines for work with fuzzy logic operators, fuzzy datasets and fuzzy scales. See article (ru): https://math-n-algo.blogspot.com/2014/08/FuzzyClassificator.html#chapter_3","archived":false,"fork":false,"pushed_at":"2020-12-25T20:09:43.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-28T02:13:23.954Z","etag":null,"topics":["fset","fuzzy","fuzzy-datasets","fuzzy-levels","fuzzy-scales","fuzzyset"],"latest_commit_sha":null,"homepage":"https://t.me/tgilmullin_blog","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devopshq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-01T10:30:42.000Z","updated_at":"2025-04-08T22:49:02.000Z","dependencies_parsed_at":"2022-08-27T20:50:57.607Z","dependency_job_id":null,"html_url":"https://github.com/devopshq/FuzzyRoutines","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/devopshq/FuzzyRoutines","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devopshq%2FFuzzyRoutines","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devopshq%2FFuzzyRoutines/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devopshq%2FFuzzyRoutines/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devopshq%2FFuzzyRoutines/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devopshq","download_url":"https://codeload.github.com/devopshq/FuzzyRoutines/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devopshq%2FFuzzyRoutines/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273812698,"owners_count":25172882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fset","fuzzy","fuzzy-datasets","fuzzy-levels","fuzzy-scales","fuzzyset"],"created_at":"2025-08-15T02:07:34.644Z","updated_at":"2025-09-05T19:48:48.741Z","avatar_url":"https://github.com/devopshq.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FuzzyRoutines\nLibrary contains some routines for work with fuzzy logic operators, fuzzy datasets and fuzzy scales.\n\n[![FuzzyRoutines build status](https://travis-ci.org/devopshq/FuzzyRoutines.svg?branch=master)](https://travis-ci.org/devopshq/FuzzyRoutines) [![FuzzyRoutines on PyPI](https://img.shields.io/pypi/v/FuzzyRoutines.svg)](https://pypi.python.org/pypi/FuzzyRoutines) [![FuzzyRoutines license](https://img.shields.io/pypi/l/FuzzyRoutines.svg)](https://github.com/devopshq/FuzzyRoutines/blob/master/LICENSE)\n\n*Index:*\n- [Install](#Chapter_1)\n- [Usage examples](#Chapter_2)\n    - [Work with membership functions](#Chapter_2_1)\n    - [Work with fuzzy set](#Chapter_2_2)\n    - [Work with fuzzy scales](#Chapter_2_3)\n    - [Work with Universal Fuzzy Scale](#Chapter_2_4)\n    - [Work with fuzzy logic operators](#Chapter_2_5)\n    - [Working with other methods](#Chapter_2_6)\n\n\u003ca name=\"Chapter_1\"\u003e\u003c/a\u003eInstall\n-------------------------------\n\nYou can install FuzzyRoutines using pip:\n\n    pip install fuzzyroutines [--upgrade] [--pre]\n    \nor using setuptools to build local version:\n\n    git clone https://github.com/devopshq/FuzzyRoutines.git\n    cd FuzzyRoutines\n    python setup.py install\n\nAfter installing you can check the version of the FuzzyRoutines library:\n\n    pip show fuzzyroutines\n\n\n\u003ca name=\"Chapter_2\"\u003e\u003c/a\u003eUsage examples\n--------------------------------------\n\nYou can see and run Example.py script:\n\n    cd fuzzyroutines\n    python Examples.py\n\nExample.py contains some examples of working with fuzzy library. Just copying and run examples below. Do not forget to import FuzzyRoutines module before use:\n\n    from fuzzyroutines.FuzzyRoutines import *\n\n\n\u003ca name=\"Chapter_2_1\"\u003e\u003c/a\u003e***Work with membership functions***\n\nUsage of some membership functions:\n\n    mjuPars = {'a': 7, 'b': 4, 'c': 0}  # hyperbolic params example\n    funct = MFunction(userFunc='hyperbolic', **mjuPars)  # creating instance of hyperbolic function\n    print('Printing Membership function with parameters: ', funct)\n    \n    mjuPars = {'a': 0, 'b': 0.3, 'c': 0.4}  # bell params example\n    funct = MFunction(userFunc='bell', **mjuPars)  # creating instance of bell function\n    print('Printing Membership function with parameters: ', funct)\n    \n    mjuPars = {'a': 0, 'b': 1}  # parabolic params example\n    funct = MFunction(userFunc='parabolic', **mjuPars)  # creating instance of parabolic function\n    print('Printing Membership function with parameters: ', funct)\n    \n    mjuPars = {'a': 0.2, 'b': 0.8, 'c': 0.7}  # triangle params example\n    funct = MFunction(userFunc='triangle', **mjuPars)  # creating instance of triangle function\n    print('Printing Membership function with parameters: ', funct)\n    \n    mjuPars = {'a': 0.5, 'b': 0.15}  # exponential params example\n    funct = MFunction(userFunc='exponential', **mjuPars)  # creating instance of exponential function\n    print('Printing Membership function with parameters: ', funct)\n    \n    mjuPars = {'a': 15, 'b': 0.5}  # sigmoidal params example\n    funct = MFunction(userFunc='sigmoidal', **mjuPars)  # creating instance of sigmoidal function\n    print('Printing Membership function with parameters: ', funct)\n    \n    funct = MFunction(userFunc='desirability')  # creating instance of desirability function without parameters\n    print('Printing Membership function with parameters: ', funct)\n    \n    mjuPars = {'a': 0.1, 'b': 1, 'c': 0.5, 'd': 0.8}  # trapezium params example\n    funct = MFunction(userFunc='trapezium', **mjuPars)  # creating instance of trapezium function\n    print('Printing Membership function with parameters: ', funct)\n\nOutput:\n\n    Printing Membership function with parameters:  Hyperbolic(x, {\"a\": 7, \"b\": 4, \"c\": 0})\n    Printing Membership function with parameters:  Bell(x, {\"a\": 0, \"b\": 0.3, \"c\": 0.4})\n    Printing Membership function with parameters:  Parabolic(x, {\"a\": 0, \"b\": 1})\n    Printing Membership function with parameters:  Triangle(x, {\"a\": 0.2, \"b\": 0.8, \"c\": 0.7})\n    Printing Membership function with parameters:  Exponential(x, {\"a\": 0.5, \"b\": 0.15})\n    Printing Membership function with parameters:  Sigmoidal(x, {\"a\": 15, \"b\": 0.5})\n    Printing Membership function with parameters:  Desirability(y)\n    Printing Membership function with parameters:  Trapezium(x, {\"a\": 0.1, \"b\": 1, \"c\": 0.5, \"d\": 0.8})\n\n\nCalculating Trapezium function's values in [0, 1]:\n\n    xPar = 0\n    for i in range(0, 10, 1):\n        xPar = (xPar + i) / 10\n        res = funct.mju(xPar)  # calculate one value of MF with given parameters\n        print('x = {:.1f}, {} = {:1.4f}'.format(xPar, funct, res))\n\nOutput:\n\n    x = 0.0, Trapezium(x, {\"a\": 0.1, \"b\": 1, \"c\": 0.5, \"d\": 0.8}) = 0.0000\n    x = 0.1, Trapezium(x, {\"a\": 0.1, \"b\": 1, \"c\": 0.5, \"d\": 0.8}) = 0.0000\n    x = 0.2, Trapezium(x, {\"a\": 0.1, \"b\": 1, \"c\": 0.5, \"d\": 0.8}) = 0.2750\n    x = 0.3, Trapezium(x, {\"a\": 0.1, \"b\": 1, \"c\": 0.5, \"d\": 0.8}) = 0.5525\n    x = 0.4, Trapezium(x, {\"a\": 0.1, \"b\": 1, \"c\": 0.5, \"d\": 0.8}) = 0.8302\n    x = 0.5, Trapezium(x, {\"a\": 0.1, \"b\": 1, \"c\": 0.5, \"d\": 0.8}) = 1.0000\n    x = 0.7, Trapezium(x, {\"a\": 0.1, \"b\": 1, \"c\": 0.5, \"d\": 0.8}) = 1.0000\n    x = 0.8, Trapezium(x, {\"a\": 0.1, \"b\": 1, \"c\": 0.5, \"d\": 0.8}) = 1.0000\n    x = 0.9, Trapezium(x, {\"a\": 0.1, \"b\": 1, \"c\": 0.5, \"d\": 0.8}) = 0.6173\n    x = 1.0, Trapezium(x, {\"a\": 0.1, \"b\": 1, \"c\": 0.5, \"d\": 0.8}) = 0.0617\n\n\n\u003ca name=\"Chapter_2_2\"\u003e\u003c/a\u003e***Work with fuzzy set***\n\n    fuzzySet = FuzzySet(funct, (0., 1.))  # creating fuzzy set A = \u003cmju_funct, support_set\u003e\n    print('Printing fuzzy set after init and before changes:', fuzzySet)\n    print('Defuz({}) = {:1.2f}'.format(fuzzySet.name, fuzzySet.Defuz()))\n    \n    changedMjuPars = copy.deepcopy(mjuPars)  # change parameters of membership function with deepcopy example:\n    changedMjuPars['a'] = 0\n    changedMjuPars['b'] = 1\n    changedSupportSet = (0.5, 1)  # change support set\n    fuzzySet.name = 'Changed fuzzy set'\n    \n    fuzzySet.mFunction.parameters = changedMjuPars\n    fuzzySet.supportSet = changedSupportSet\n    \n    print('New membership function with parameters: ', fuzzySet.mFunction)\n    print('New support set: ', fuzzySet.supportSet)\n    print('New value of Defuz({}) = {:1.2f}'.format(fuzzySet.name, fuzzySet.Defuz()))\n    print('Printing fuzzy set after changes:', fuzzySet)\n\nOutput:\n\n    Printing fuzzy set after init and before changes: FuzzySet = \u003cTrapezium(x, {\"a\": 0.1, \"b\": 1, \"c\": 0.5, \"d\": 0.8}), [0.0, 1.0]\u003e\n    Defuz(FuzzySet) = 0.59\n    New membership function with parameters:  Trapezium(x, {\"a\": 0, \"b\": 1, \"c\": 0.5, \"d\": 0.8})\n    New support set:  (0.5, 1)\n    New value of Defuz(Changed fuzzy set) = 0.59\n    Printing fuzzy set after changes: Changed fuzzy set = \u003cTrapezium(x, {\"a\": 0, \"b\": 1, \"c\": 0.5, \"d\": 0.8}), [0.5, 1]\u003e\n\n\n\u003ca name=\"Chapter_2_3\"\u003e\u003c/a\u003e***Work with fuzzy scales***\n\nFuzzy scale is an ordered set of linguistic variables that looks like this:\n\nS = [{'name': 'name_1', 'fSet': fuzzySet_1}, {'name': 'name_2', 'fSet': fuzzySet_2}, ...]\n\nwhere name is a linguistic name of fuzzy set, fSet is a user define fuzzy set of FuzzySet type.\n\n    scale = FuzzyScale()  # intialize new fuzzy scale with default levels\n    \n    print('Printing default fuzzy scale in human-readable:', scale)\n    \n    print('Defuz() of all default levels:')\n    for item in scale.levels:\n        print('Defuz({}) = {:1.2f}'.format(item['name'], item['fSet'].Defuz()))\n\nOutput:\n\n    Printing default fuzzy scale in human-readable: DefaultScale = {Min, Med, High}\n        Minimum = \u003cHyperbolic(x, {\"a\": 7, \"b\": 4, \"c\": 0}), [0.0, 1.0]\u003e\n        Medium = \u003cBell(x, {\"a\": 0.35, \"b\": 0.5, \"c\": 0.6}), [0.0, 1.0]\u003e\n        High = \u003cTriangle(x, {\"a\": 0.7, \"b\": 1, \"c\": 1}), [0.0, 1.0]\u003e\n    Defuz() of all default levels:\n    Defuz(Min) = 0.10\n    Defuz(Med) = 0.55\n    Defuz(High) = 0.90\n\nAdd new fuzzy levels:\n\n    print('Define some new levels:')\n    \n    minFunct = MFunction('hyperbolic', **{'a': 2, 'b': 20, 'c': 0})\n    levelMin = FuzzySet(membershipFunction=minFunct, supportSet=(0., 0.5), linguisticName='min')\n    print('Printing Level 1 in human-readable:', levelMin)\n    \n    medFunct = MFunction('bell', **{'a': 0.4, 'b': 0.55, 'c': 0.7})\n    levelMed = FuzzySet(membershipFunction=medFunct, supportSet=(0.25, 0.75), linguisticName='med')\n    print('Printing Level 2 in human-readable:', levelMed)\n    \n    maxFunct = MFunction('triangle', **{'a': 0.65, 'b': 1, 'c': 1})\n    levelMax = FuzzySet(membershipFunction=maxFunct, supportSet=(0.7, 1.), linguisticName='max')\n    print('Printing Level 3 in human-readable:', levelMax)\n\nOutput:\n\n    Define some new levels:\n    Printing Level 1 in human-readable: min = \u003cHyperbolic(x, {\"a\": 2, \"b\": 20, \"c\": 0}), [0.0, 0.5]\u003e\n    Printing Level 2 in human-readable: med = \u003cBell(x, {\"a\": 0.4, \"b\": 0.55, \"c\": 0.7}), [0.25, 0.75]\u003e\n    Printing Level 3 in human-readable: max = \u003cTriangle(x, {\"a\": 0.65, \"b\": 1, \"c\": 1}), [0.7, 1.0]\u003e\n\nChange scale levels:\n\n    scale.name = 'New Scale'\n    scale.levels = [{'name': levelMin.name, 'fSet': levelMin}, {'name': levelMed.name, 'fSet': levelMed},\n                    {'name': levelMax.name, 'fSet': levelMax}]  # add new ordered set of linguistic variables into scale\n    \n    print('Changed List of levels as objects:', scale.levels)\n    print('Printing changed fuzzy scale in human-readable:', scale)\n    \n    print('Defuz() of all New Scale levels:')\n    for item in scale.levels:\n        print('Defuz({}) = {:1.2f}'.format(item['name'], item['fSet'].Defuz()))\n\nOutput:\n\n    Changed List of levels as objects: [{'name': 'min', 'fSet': \u003cfuzzyroutines.FuzzyRoutines.FuzzySet object at 0x000001AECB3F17B8\u003e}, {'name': 'med', 'fSet': \u003cfuzzyroutines.FuzzyRoutines.FuzzySet object at 0x000001AECB337D68\u003e}, {'name': 'max', 'fSet': \u003cfuzzyroutines.FuzzyRoutines.FuzzySet object at 0x000001AECB3F18D0\u003e}]\n    Printing changed fuzzy scale in human-readable: New Scale = {min, med, max}\n        min = \u003cHyperbolic(x, {\"a\": 2, \"b\": 20, \"c\": 0}), [0.0, 0.5]\u003e\n        med = \u003cBell(x, {\"a\": 0.4, \"b\": 0.55, \"c\": 0.7}), [0.25, 0.75]\u003e\n        max = \u003cTriangle(x, {\"a\": 0.65, \"b\": 1, \"c\": 1}), [0.7, 1.0]\u003e\n    Defuz() of all New Scale levels:\n    Defuz(min) = 0.24\n    Defuz(med) = 0.61\n    Defuz(max) = 0.89\n\n\n\u003ca name=\"Chapter_2_4\"\u003e\u003c/a\u003e***Work with Universal Fuzzy Scale***\n\nUniversal fuzzy scales S_f = {Min, Low, Med, High, Max} pre-defined in UniversalFuzzyScale() class.\n\n    uniFScale = UniversalFuzzyScale()\n    print('Levels of Universal Fuzzy Scale:', uniFScale.levels)\n    print('Printing scale:', uniFScale)\n\n    print('Defuz() of all Universal Fuzzy Scale levels:')\n    for item in uniFScale.levels:\n        print('Defuz({}) = {:1.2f}'.format(item['name'], item['fSet'].Defuz()))\n\nOutput:\n\n    Levels of Universal Fuzzy Scale: [{'name': 'Min', 'fSet': \u003cfuzzyroutines.FuzzyRoutines.FuzzySet object at 0x000001AECB34F7B8\u003e}, {'name': 'Low', 'fSet': \u003cfuzzyroutines.FuzzyRoutines.FuzzySet object at 0x000001AECB34F198\u003e}, {'name': 'Med', 'fSet': \u003cfuzzyroutines.FuzzyRoutines.FuzzySet object at 0x000001AECB34F048\u003e}, {'name': 'High', 'fSet': \u003cfuzzyroutines.FuzzyRoutines.FuzzySet object at 0x000001AECB34F0F0\u003e}, {'name': 'Max', 'fSet': \u003cfuzzyroutines.FuzzyRoutines.FuzzySet object at 0x000001AECB34F710\u003e}]\n    Printing scale: FuzzyScale = {Min, Low, Med, High, Max}\n        Min = \u003cHyperbolic(x, {\"a\": 8, \"b\": 20, \"c\": 0}), [0.0, 0.23]\u003e\n        Low = \u003cBell(x, {\"a\": 0.17, \"b\": 0.23, \"c\": 0.34}), [0.17, 0.4]\u003e\n        Med = \u003cBell(x, {\"a\": 0.34, \"b\": 0.4, \"c\": 0.6}), [0.34, 0.66]\u003e\n        High = \u003cBell(x, {\"a\": 0.6, \"b\": 0.66, \"c\": 0.77}), [0.6, 0.83]\u003e\n        Max = \u003cParabolic(x, {\"a\": 0.77, \"b\": 0.95}), [0.77, 1.0]\u003e\n    Defuz() of all Universal Fuzzy Scale levels:\n    Defuz(Min) = 0.06\n    Defuz(Low) = 0.29\n    Defuz(Med) = 0.50\n    Defuz(High) = 0.71\n    Defuz(Max) = 0.93\n\nUse Fuzzy() function to looking for level on Fuzzy Scale:\n\n    xPar = 0\n    for i in range(0, 10, 1):\n        xPar = (xPar + i) / 10\n        res = uniFScale.Fuzzy(xPar)  # calculate fuzzy level for some real values\n        print('Fuzzy({:1.1f}, {}) = {}, {}'.format(xPar, uniFScale.name, res['name'], res['fSet']))\n\nOutput:\n\n    Fuzzy(0.0, FuzzyScale) = Min, Min = \u003cHyperbolic(x, {\"a\": 8, \"b\": 20, \"c\": 0}), [0.0, 0.23]\u003e\n    Fuzzy(0.1, FuzzyScale) = Min, Min = \u003cHyperbolic(x, {\"a\": 8, \"b\": 20, \"c\": 0}), [0.0, 0.23]\u003e\n    Fuzzy(0.2, FuzzyScale) = Low, Low = \u003cBell(x, {\"a\": 0.17, \"b\": 0.23, \"c\": 0.34}), [0.17, 0.4]\u003e\n    Fuzzy(0.3, FuzzyScale) = Low, Low = \u003cBell(x, {\"a\": 0.17, \"b\": 0.23, \"c\": 0.34}), [0.17, 0.4]\u003e\n    Fuzzy(0.4, FuzzyScale) = Med, Med = \u003cBell(x, {\"a\": 0.34, \"b\": 0.4, \"c\": 0.6}), [0.34, 0.66]\u003e\n    Fuzzy(0.5, FuzzyScale) = Med, Med = \u003cBell(x, {\"a\": 0.34, \"b\": 0.4, \"c\": 0.6}), [0.34, 0.66]\u003e\n    Fuzzy(0.7, FuzzyScale) = High, High = \u003cBell(x, {\"a\": 0.6, \"b\": 0.66, \"c\": 0.77}), [0.6, 0.83]\u003e\n    Fuzzy(0.8, FuzzyScale) = High, High = \u003cBell(x, {\"a\": 0.6, \"b\": 0.66, \"c\": 0.77}), [0.6, 0.83]\u003e\n    Fuzzy(0.9, FuzzyScale) = Max, Max = \u003cParabolic(x, {\"a\": 0.77, \"b\": 0.95}), [0.77, 1.0]\u003e\n    Fuzzy(1.0, FuzzyScale) = Max, Max = \u003cParabolic(x, {\"a\": 0.77, \"b\": 0.95}), [0.77, 1.0]\u003e\n\nFinding fuzzy level using GetLevelByName() function with exact matching:\n\n    print('Finding level by name with exact matching:')\n\n    res = uniFScale.GetLevelByName('Min')\n    print('GetLevelByName(Min, {}) = {}, {}'.format(uniFScale.name, res['name'] if res else 'None', res['fSet'] if res else 'None'))\n\n    res = uniFScale.GetLevelByName('High')\n    print('GetLevelByName(High, {}) = {}, {}'.format(uniFScale.name, res['name'] if res else 'None', res['fSet'] if res else 'None'))\n\n    res = uniFScale.GetLevelByName('max')\n    print('GetLevelByName(max, {}) = {}, {}'.format(uniFScale.name, res['name'] if res else 'None', res['fSet'] if res else 'None'))\n\nOutput:\n\n    Finding level by name with exact matching:\n    GetLevelByName(Min, FuzzyScale) = Min, Min = \u003cHyperbolic(x, {\"a\": 8, \"b\": 20, \"c\": 0}), [0.0, 0.23]\u003e\n    GetLevelByName(High, FuzzyScale) = High, High = \u003cBell(x, {\"a\": 0.6, \"b\": 0.66, \"c\": 0.77}), [0.6, 0.83]\u003e\n    GetLevelByName(max, FuzzyScale) = None, None\n\nFinding fuzzy level using GetLevelByName() function without exact matching:\n\n    print('Finding level by name without exact matching:')\n\n    res = uniFScale.GetLevelByName('mIn', exactMatching=False)\n    print(\"GetLevelByName('mIn', {}) = {}, {}\".format(uniFScale.name, res['name'] if res else 'None', res['fSet'] if res else 'None'))\n\n    res = uniFScale.GetLevelByName('max', exactMatching=False)\n    print(\"GetLevelByName('max', {}) = {}, {}\".format(uniFScale.name, res['name'] if res else 'None', res['fSet'] if res else 'None'))\n\n    res = uniFScale.GetLevelByName('Hig', exactMatching=False)\n    print(\"GetLevelByName('Hig', {}) = {}, {}\".format(uniFScale.name, res['name'] if res else 'None', res['fSet'] if res else 'None'))\n\n    res = uniFScale.GetLevelByName('LOw', exactMatching=False)\n    print(\"GetLevelByName('LOw', {}) = {}, {}\".format(uniFScale.name, res['name'] if res else 'None', res['fSet'] if res else 'None'))\n\n    res = uniFScale.GetLevelByName('eD', exactMatching=False)\n    print(\"GetLevelByName('eD', {}) = {}, {}\".format(uniFScale.name, res['name'] if res else 'None', res['fSet'] if res else 'None'))\n\n    res = uniFScale.GetLevelByName('Highest', exactMatching=False)\n    print(\"GetLevelByName('Highest', {}) = {}, {}\".format(uniFScale.name, res['name'] if res else 'None', res['fSet'] if res else 'None'))\n\nOutput:\n\n    Finding level by name without exact matching:\n    GetLevelByName('mIn', FuzzyScale) = Min, Min = \u003cHyperbolic(x, {\"a\": 8, \"b\": 20, \"c\": 0}), [0.0, 0.23]\u003e\n    GetLevelByName('max', FuzzyScale) = Max, Max = \u003cParabolic(x, {\"a\": 0.77, \"b\": 0.95}), [0.77, 1.0]\u003e\n    GetLevelByName('Hig', FuzzyScale) = None, None\n    GetLevelByName('LOw', FuzzyScale) = Low, Low = \u003cBell(x, {\"a\": 0.17, \"b\": 0.23, \"c\": 0.34}), [0.17, 0.4]\u003e\n    GetLevelByName('eD', FuzzyScale) = None, None\n    GetLevelByName('Highest', FuzzyScale) = None, None\n\n\n\u003ca name=\"Chapter_2_5\"\u003e\u003c/a\u003e***Work with fuzzy logic operators***\n\nChecks that number is in [0, 1]:\n\n    print('IsCorrectFuzzyNumberValue(0.5) =', IsCorrectFuzzyNumberValue(0.5))\n    print('IsCorrectFuzzyNumberValue(1.1) =', IsCorrectFuzzyNumberValue(1.1))\n\nOutput:\n\n    IsCorrectFuzzyNumberValue(0.5) = True\n    IsCorrectFuzzyNumberValue(1.1) = False\n\nCalculates result of fuzzy NOT, fuzzy NOT with alpha parameter and parabolic fuzzy NOT operations:\n\n    print('FNOT(0.25) =', FuzzyNOT(0.25))\n    print('FNOT(0.25, alpha=0.25) =', FuzzyNOT(0.25, alpha=0.25))\n    print('FNOT(0.25, alpha=0.75) =', FuzzyNOT(0.25, alpha=0.75))\n    print('FNOT(0.25, alpha=1) =', FuzzyNOT(0.25, alpha=1))\n\n    print('FNOTParabolic(0.25, alpha=0.25) =', FuzzyNOTParabolic(0.25, alpha=0.25))\n    print('FNOTParabolic(0.25, alpha=0.75) =', FuzzyNOTParabolic(0.25, alpha=0.75))\n\nOutput:\n\n    FNOT(0.25) = 0.75\n    FNOT(0.25, alpha=0.25) = 0.25\n    FNOT(0.25, alpha=0.75) = 0.9166666666666666\n    FNOT(0.25, alpha=1) = 1.0\n    FNOTParabolic(0.25, alpha=0.25) = 0.25000000000000017\n    FNOTParabolic(0.25, alpha=0.75) = 0.9820000000000008\n\nCalculates result of fuzzy AND/OR operations:\n\n    print('FuzzyAND(0.25, 0.5) =', FuzzyAND(0.25, 0.5))\n    print('FuzzyOR(0.25, 0.5) =', FuzzyOR(0.25, 0.5))\n\nOutput:\n\n    FuzzyAND(0.25, 0.5) = 0.25\n    FuzzyOR(0.25, 0.5) = 0.5\n\nCalculates result of T-Norm operations, where T-Norm is one of conjunctive operators - logic, algebraic, boundary, drastic:\n\n    print(\"TNorm(0.25, 0.5, 'logic') =\", TNorm(0.25, 0.5, normType='logic'))\n    print(\"TNorm(0.25, 0.5, 'algebraic') =\", TNorm(0.25, 0.5, normType='algebraic'))\n    print(\"TNorm(0.25, 0.5, 'boundary') =\", TNorm(0.25, 0.5, normType='boundary'))\n    print(\"TNorm(0.25, 0.5, 'drastic') =\", TNorm(0.25, 0.5, normType='drastic'))\n\nOutput:\n\n    TNorm(0.25, 0.5, 'logic') = 0.25\n    TNorm(0.25, 0.5, 'algebraic') = 0.125\n    TNorm(0.25, 0.5, 'boundary') = 0\n    TNorm(0.25, 0.5, 'drastic') = 0\n\nCalculates result of S-coNorm operations, where S-coNorm is one of disjunctive operators - logic, algebraic, boundary, drastic:\n\n    print(\"SCoNorm(0.25, 0.5, 'logic') =\", SCoNorm(0.25, 0.5, normType='logic'))\n    print(\"SCoNorm(0.25, 0.5, 'algebraic') =\", SCoNorm(0.25, 0.5, normType='algebraic'))\n    print(\"SCoNorm(0.25, 0.5, 'boundary') =\", SCoNorm(0.25, 0.5, normType='boundary'))\n    print(\"SCoNorm(0.25, 0.5, 'drastic') =\", SCoNorm(0.25, 0.5, normType='drastic'))\n\nOutput:\n\n    SCoNorm(0.25, 0.5, 'logic') = 0.5\n    SCoNorm(0.25, 0.5, 'algebraic') = 0.625\n    SCoNorm(0.25, 0.5, 'boundary') = 0.75\n    SCoNorm(0.25, 0.5, 'drastic') = 1\n\nCalculates result of T-Norm operations for N numbers, N \u003e 2:\n\n    print(\"TNormCompose(0.25, 0.5, 0.75, 'logic') =\", TNormCompose(0.25, 0.5, 0.75, normType='logic'))\n    print(\"TNormCompose(0.25, 0.5, 0.75, 'algebraic') =\", TNormCompose(0.25, 0.5, 0.75, normType='algebraic'))\n    print(\"TNormCompose(0.25, 0.5, 0.75, 'boundary') =\", TNormCompose(0.25, 0.5, 0.75, normType='boundary'))\n    print(\"TNormCompose(0.25, 0.5, 0.75, 'drastic') =\", TNormCompose(0.25, 0.5, 0.75, normType='drastic'))\n\nOutput:\n\n    TNormCompose(0.25, 0.5, 0.75, 'logic') = 0.25\n    TNormCompose(0.25, 0.5, 0.75, 'algebraic') = 0.09375\n    TNormCompose(0.25, 0.5, 0.75, 'boundary') = 0\n    TNormCompose(0.25, 0.5, 0.75, 'drastic') = 0\n\nCalculates result of S-coNorm operations for N numbers, N \u003e 2:\n\n    print(\"SCoNormCompose(0.25, 0.5, 0.75, 'logic') =\", SCoNormCompose(0.25, 0.5, 0.75, normType='logic'))\n    print(\"SCoNormCompose(0.25, 0.5, 0.75, 'algebraic') =\", SCoNormCompose(0.25, 0.5, 0.75, normType='algebraic'))\n    print(\"SCoNormCompose(0.25, 0.5, 0.75, 'boundary') =\", SCoNormCompose(0.25, 0.5, 0.75, normType='boundary'))\n    print(\"SCoNormCompose(0.25, 0.5, 0.75, 'drastic') =\", SCoNormCompose(0.25, 0.5, 0.75, normType='drastic'))\n\nOutput:\n\n    SCoNormCompose(0.25, 0.5, 0.75, 'logic') = 0.75\n    SCoNormCompose(0.25, 0.5, 0.75, 'algebraic') = 0.90625\n    SCoNormCompose(0.25, 0.5, 0.75, 'boundary') = 1\n    SCoNormCompose(0.25, 0.5, 0.75, 'drastic') = 1\n\n\n\u003ca name=\"Chapter_2_6\"\u003e\u003c/a\u003e***Working with other methods***\n\nConverting some strings to range of sorted unique numbers with DiapasonParser():\n\n    print(\"Converting some strings to range of sorted unique numbers:\")\n    print('String \"1,5\" converted to:', DiapasonParser(\"1,5\"))\n    print('String \"1-5\" converted to:', DiapasonParser(\"1-5\"))\n    print('String \"8-10, 1-5, 6\" converted to:', DiapasonParser(\"8-10, 1-5, 6\"))\n    print('String \"11, 11, 12, 12, 1-5, 3-7\" converted to:', DiapasonParser(\"11, 12, 1-5, 3-7\"))\n\nOutput:\n\n    Converting some strings to range of sorted unique numbers:\n    String \"1,5\" converted to: [1, 5]\n    String \"1-5\" converted to: [1, 2, 3, 4, 5]\n    String \"8-10, 1-5, 6\" converted to: [1, 2, 3, 4, 5, 6, 8, 9, 10]\n    String \"11, 11, 12, 12, 1-5, 3-7\" converted to: [1, 2, 3, 4, 5, 6, 7, 11, 12]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevopshq%2Ffuzzyroutines","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevopshq%2Ffuzzyroutines","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevopshq%2Ffuzzyroutines/lists"}