Science Score: 49.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README -
○Academic publication links
-
✓Committers with academic emails
3 of 8 committers (37.5%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.7%) to scientific vocabulary
Keywords
Repository
A friendly python library for fuzzy logic reasoning
Basic Info
Statistics
- Stars: 139
- Watchers: 7
- Forks: 36
- Open Issues: 10
- Releases: 20
Topics
Metadata Files
README.md
simpful
A Python library for fuzzy logic reasoning, designed to provide a simple and lightweight API, as close as possible to natural language. Simpful supports Mamdani and Sugeno reasoning of any order, parsing any complex fuzzy rules involving AND, OR, and NOT operators, using arbitrarily shaped fuzzy sets. For more information on its usage, try out the example scripts in this repository or check our online documentation.
Installation
pip install simpful
Citing Simpful
If you find Simpful useful for your research, please cite our work as follows:
Spolaor S., Fuchs C., Cazzaniga P., Kaymak U., Besozzi D., Nobile M.S.: Simpful: a user-friendly Python library for fuzzy logic, International Journal of Computational Intelligence Systems, 13(1):1687–1698, 2020 DOI:10.2991/ijcis.d.201012.002
Usage example 1: controlling a gas burner with a Takagi-Sugeno fuzzy system
This example shows how to specify the information about the linguistic variables, fuzzy sets, fuzzy rules, and input values to Simpful. The last line of code prints the result of the fuzzy reasoning.
``` import simpful as sf
A simple fuzzy model describing how the heating power of a gas burner depends on the oxygen supply.
FS = sf.FuzzySystem()
Define a linguistic variable.
S1 = sf.FuzzySet( points=[[0, 1.], [1., 1.], [1.5, 0]], term="lowflow" ) S2 = sf.FuzzySet( points=[[0.5, 0], [1.5, 1.], [2.5, 1], [3., 0]], term="mediumflow" ) S3 = sf.FuzzySet( points=[[2., 0], [2.5, 1.], [3., 1.]], term="highflow" ) FS.addlinguisticvariable("OXI", sf.LinguisticVariable( [S1, S2, S_3] ))
Define consequents.
FS.setcrispoutputvalue("LOWPOWER", 0) FS.setcrispoutputvalue("MEDIUMPOWER", 25) FS.setoutputfunction("HIGH_FUN", "OXI**2")
Define fuzzy rules.
RULE1 = "IF (OXI IS lowflow) THEN (POWER IS LOWPOWER)" RULE2 = "IF (OXI IS mediumflow) THEN (POWER IS MEDIUMPOWER)" RULE3 = "IF (NOT (OXI IS lowflow)) THEN (POWER IS HIGHFUN)" FS.add_rules([RULE1, RULE2, RULE3])
Set antecedents values, perform Sugeno inference and print output values.
FS.setvariable("OXI", .51) print (FS.Sugenoinference(['POWER'])) ```
Usage example 2: tipping with a Mamdani fuzzy system
This second example shows how to model a FIS using Mamdani inference. It also shows some facilities that make modeling more concise and clear: automatic Triangles (i.e., pre-baked linguistic variables with equally spaced triangular fuzzy sets) and the automatic detection of the inference method.
``` from simpful import *
FS = FuzzySystem()
TLV = AutoTriangle(3, terms=['poor', 'average', 'good'], universeofdiscourse=[0,10]) FS.addlinguisticvariable("service", TLV) FS.addlinguisticvariable("quality", TLV)
O1 = TriangleFuzzySet(0,0,13, term="low") O2 = TriangleFuzzySet(0,13,25, term="medium") O3 = TriangleFuzzySet(13,25,25, term="high") FS.addlinguisticvariable("tip", LinguisticVariable([O1, O2, O3], universeofdiscourse=[0,25]))
FS.add_rules([ "IF (quality IS poor) OR (service IS poor) THEN (tip IS low)", "IF (service IS average) THEN (tip IS medium)", "IF (quality IS good) OR (service IS good) THEN (tip IS high)" ])
FS.setvariable("quality", 6.5) FS.setvariable("service", 9.8)
tip = FS.inference() ```
Usage example 3: fuzzy sets naming
This example shows how to automatically assign names to fuzzy sets. Such a tool can be handy when dealing with automatically genereted Fuzzy Systems.
``` from simpful import * from simpful.clusterlabeling import approximatefs_labels
------ EXAMPLE FUZZY SYSTEM ------
FS = FuzzySystem()
Input Variable 1: Temperature
TS1 = FuzzySet(function=GaussianMF(mu=0, sigma=8), term="cold") TS2 = FuzzySet(function=GaussianMF(mu=40, sigma=8), term="hot") Temperature = LinguisticVariable([TS1, TS2], concept="Temperature", universeofdiscourse=[0, 40]) FS.addlinguisticvariable("Temperature", Temperature)
Input Variable 2: Humidity
HS1 = FuzzySet(function=GaussianMF(mu=0, sigma=20), term="dry") HS2 = FuzzySet(function=GaussianMF(mu=100, sigma=20), term="wet") Humidity = LinguisticVariable([HS1, HS2], concept="Humidity", universeofdiscourse=[0, 100]) FS.addlinguisticvariable("Humidity", Humidity)
Output Variable
FS1 = FuzzySet(function=GaussianMF(mu=0, sigma=25), term="slow") FS2 = FuzzySet(function=GaussianMF(mu=100, sigma=25), term="fast") FanSpeed = LinguisticVariable([FS1, FS2], concept="Fan Speed", universeofdiscourse=[0, 100])
R1 = "IF (Temperature IS hot) AND (Humidity IS wet) THEN (FanSpeed IS fast)" R2 = "IF (Temperature IS cold) THEN (FanSpeed IS slow)" FS.add_rules([R1, R2])
------ USAGE EXAMPLE ------
The generate_report parameter allows the creation of a PDF report with graphs and rules.
The plotcolorbyruleoutput allows to color membership functions based on their rule effect
approximatefslabels(FS, outputpath="output", generatereport=False, plotcolorbyruleoutput=True) ```
Additional examples
Additional example scripts are available in the examples folder of this GitHub and in our Code Ocean capsule.
Further info
Created by Marco S. Nobile at the Eindhoven University of Technology and Simone Spolaor at the University of Milano-Bicocca.
If you need further information, please write an e-mail at: marco.nobile@unive.it.
Owner
- Name: Marco S. Nobile
- Login: aresio
- Kind: user
- Location: Venice, Italy
- Company: Ca' Foscari University
- Website: http://msnobile.it
- Twitter: aresio
- Repositories: 18
- Profile: https://github.com/aresio
I have a BS, MS and Ph.D. in Computer Science. I am a Associate Professor at the Ca' Foscari University of Venice
GitHub Events
Total
- Issues event: 1
- Watch event: 11
- Push event: 1
- Pull request event: 2
- Fork event: 2
Last Year
- Issues event: 1
- Watch event: 11
- Push event: 1
- Pull request event: 2
- Fork event: 2
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| Simone Spolaor | s****r@c****t | 61 |
| MSN | m****e@t****l | 45 |
| Simone Spolaor | s****r@u****t | 37 |
| Marco S. Nobile | n****e@d****t | 33 |
| Nikhilrs1993 | 3****3 | 15 |
| Simone Spolaor | s****r@t****l | 11 |
| Marco S. Nobile | m****e@u****t | 6 |
| akdenizince | 1****e | 2 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 20
- Total pull requests: 13
- Average time to close issues: 6 months
- Average time to close pull requests: 5 months
- Total issue authors: 16
- Total pull request authors: 8
- Average comments per issue: 1.65
- Average comments per pull request: 0.38
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 5
- Average time to close issues: N/A
- Average time to close pull requests: 2 minutes
- Issue authors: 1
- Pull request authors: 4
- Average comments per issue: 1.0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ZA0068 (4)
- cupressus (2)
- limgl1998 (1)
- ggian00 (1)
- smejkka3 (1)
- mojtabatorabii (1)
- jonas-eschle (1)
- khinggan (1)
- pbsds (1)
- tawdes (1)
- RakshaAg (1)
- Susi-Eva (1)
- MtthVt (1)
- JoseVinicius1998 (1)
- DManowitz (1)
Pull Request Authors
- NikhilNRS (5)
- Nikhilrs1993 (4)
- LeoneBacciu (2)
- DanikVitek (2)
- guilherme-marcello (2)
- MattVsTheWorld (2)
- ggian00 (1)
- akdenizince (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 13
-
Total downloads:
- pypi 41,930 last-month
- Total docker downloads: 13,860
-
Total dependent packages: 3
(may contain duplicates) -
Total dependent repositories: 65
(may contain duplicates) - Total versions: 108
- Total maintainers: 3
pypi.org: simpful
A user-friendly Python library for fuzzy logic
- Homepage: https://github.com/aresio/simpful
- Documentation: https://simpful.readthedocs.io/
- License: LICENSE.txt
-
Latest release: 2.12.0
published almost 2 years ago
Rankings
alpine-v3.18: py3-simpful-pyc
Precompiled Python bytecode for py3-simpful
- Homepage: https://github.com/aresio/simpful
- License: GPL-3.0-or-later
-
Latest release: 2.10.0-r1
published almost 3 years ago
Rankings
Maintainers (1)
alpine-v3.18: py3-simpful
A friendly python library for fuzzy logic reasoning
- Homepage: https://github.com/aresio/simpful
- License: GPL-3.0-or-later
-
Latest release: 2.10.0-r1
published almost 3 years ago
Rankings
Maintainers (1)
alpine-edge: py3-simpful
A friendly python library for fuzzy logic reasoning
- Homepage: https://github.com/aresio/simpful
- License: AFL-3.0
-
Latest release: 2.12.0-r1
published almost 2 years ago
Rankings
Maintainers (1)
alpine-edge: py3-simpful-pyc
Precompiled Python bytecode for py3-simpful
- Homepage: https://github.com/aresio/simpful
- License: AFL-3.0
-
Latest release: 2.12.0-r1
published almost 2 years ago
Rankings
Maintainers (1)
alpine-v3.20: py3-simpful
A friendly python library for fuzzy logic reasoning
- Homepage: https://github.com/aresio/simpful
- License: AFL-3.0
-
Latest release: 2.12.0-r1
published almost 2 years ago
Rankings
Maintainers (1)
alpine-v3.21: py3-simpful
A friendly python library for fuzzy logic reasoning
- Homepage: https://github.com/aresio/simpful
- License: AFL-3.0
-
Latest release: 2.12.0-r1
published almost 2 years ago
Rankings
Maintainers (1)
alpine-v3.21: py3-simpful-pyc
Precompiled Python bytecode for py3-simpful
- Homepage: https://github.com/aresio/simpful
- License: AFL-3.0
-
Latest release: 2.12.0-r1
published almost 2 years ago
Rankings
Maintainers (1)
alpine-v3.19: py3-simpful
A friendly python library for fuzzy logic reasoning
- Homepage: https://github.com/aresio/simpful
- License: GPL-3.0-or-later
-
Latest release: 2.11.1-r0
published over 2 years ago
Rankings
Maintainers (1)
alpine-v3.20: py3-simpful-pyc
Precompiled Python bytecode for py3-simpful
- Homepage: https://github.com/aresio/simpful
- License: AFL-3.0
-
Latest release: 2.12.0-r1
published almost 2 years ago
Rankings
Maintainers (1)
alpine-v3.22: py3-simpful
A friendly python library for fuzzy logic reasoning
- Homepage: https://github.com/aresio/simpful
- License: AFL-3.0
-
Latest release: 2.12.0-r1
published almost 2 years ago
Rankings
Maintainers (1)
alpine-v3.19: py3-simpful-pyc
Precompiled Python bytecode for py3-simpful
- Homepage: https://github.com/aresio/simpful
- License: GPL-3.0-or-later
-
Latest release: 2.11.1-r0
published over 2 years ago
Rankings
alpine-v3.22: py3-simpful-pyc
Precompiled Python bytecode for py3-simpful
- Homepage: https://github.com/aresio/simpful
- License: AFL-3.0
-
Latest release: 2.12.0-r1
published almost 2 years ago
Rankings
Maintainers (1)
Dependencies
- Sphinx ==3.3.1
- jinja2 <3.1.0
- numpy *
- scipy *
- sphinx-rtd-theme ==0.5.0
- sphinxcontrib-napoleon ==0.7
- numpy *
- requests *
- scipy *
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite