Open joewheaton opened 6 years ago
Just for completeness in my travels, I found that the International Electrotechnical Commission (IEC) has a dedicated language for fuzzy logic processing:
http://ffll.sourceforge.net/fcl.htm
They even have their own language which is in some ways an improvement over the Matlab FIS file specification we use.
Background: Way back when GCD was DoD and the whole thing was based off of Matlab, I used the fuzzy logic toolbox, which allows you to specify your fuzzy inference system based on a text
*.fis
file. The format of these is really simple, and we decided to use it in our own C++ (GCD 5 -> GCD 6), as well as our C# implementation of FIS. The advantage is that for Matlab users that have fuzzy logic toolbox, the*.fis
file we use in GCD will also work in the toolbox.However, in the decade that has followed, there are increasingly less Matlab users (because it is proprietary software) and many more Python scripters. As such, in some of our newer script tools that use FIS (e.g. RCAT and BRAT), we've come to rely on the scikit-fuzzy toolpbox, which has its own Git repo. The Request:
Thus, we'd really like to be able to support BOTH Matlab and scikit implementations of fuzzy inference systems. So the enhancement is to expand our FIS Library so that it includes:
*.fis
files it always has that works in Matlab's fuzzy logic toolgox.*.py
scikit-fuzzy compatible FIS script for the model that would work with scikitThis is not a high priority, but something that would be nice in a future version of GCD and I'd like to flag up the thinking and a example here from Rebecca Rossi's thesis:
The Details: The actual 'model' part of SciKit also uses a text file (in this case, a
*.py
file typically` FIS_Rossi_SFM.txtScikit: Note that the scikit version, relies on various commands to define the model. In the header, you import the
skfuzzy
library.In Becca's case, she defines the inputs and their corresponding membership functions using the
.trapmf()
command (here using thefuzz
object she instatitated above. An example for a two input system is shown below:She was modelling DEM elevation error as her output membership function and defined it as follows:
The rules are then used the
.Rule()
command out of the skfuzzy controls, to define the rule system (here using thecntrl
object she instantiated above.Matlab So this is different than in Matlab's Fuzzy Logic Toolbox where the whole model is saved in a separate
*.fis
text file. In that file there is a header section, an input membership function section, an output membership section and a rule table. Below, I show the translation of the scikit above, into each:You can either read below, or just watch in this video the process of manual transformation. https://youtu.be/fY0AQMj7WGU
First, the header in Matlab:
Next, we have the two inputs:
Then the specification of the output membership functions:
Finally, the translation of the rule table (note I added two rules here for logical consistency, that Becca probably omitted because they did not occur in her input data):
And here's the
SFM-Pole_ZError_SLPdeg_SR_Meters.fis
file: SFM-Pole_ZError_SLPdeg_SR_Meters.fis.txtAnd that's all she wrote...