A fuzzy logic C++ library
Density information


Low Priority Todo:
Reformat this page

This page describes one of the features of the libray: the ability to show the user information about how does the data fit to the input and output membership functions. The aim is to let the user know if the functions do not correctly fit the input data, so that he can change them. This information is produced in two forms:

The histograms can be automatically plotted by a corresponding generated script file, if gnuplot is available (see https://en.wikipedia.org/wiki/Gnuplot).

This can be useful in two situations and is completely transparent:

This corresponding data files can be generated at any time with the function SLIFIS::GenerateHistogramFile() :

        SLIFIS fis
        // ... do lots of things here...

This will generate on disk in the current folder a series of files:

On GNU/Linux, the latter script file can be called directly from command line, say with something like this in a shell:

> gnuplot SLIFIS_histo.plt

On Windows, you need to feed it to a gnuplot instance. An example of produced histogram can be seen below (automatically generated from build-rule-base.cpp):

Example 1 Example 2
Example 1: the chosen functions badly fit the inputs, one function gets triggered for most of the values. One should probably reconsider how the set of functions is build. Example 2: the chosen functions fit nicely the inputs, all the input functions are triggered an equivalent number of times

The stored information can be reset using SLIFIS::ClearCounters(). Note that this is done automatically at each FIS modification (adding or deleting input in a FIS, editing output functions, ...)

You can also access the values programmaticaly, using the following code:

        std::vector<size_t> v_out_hits, v_in_hits;
        fis.GetOutputTriggerValues( v_out_hits );
        fis.GetInputTriggerValues( 1, v_in_hits );


Please note that in the above code, you do not need to allocate memory for the vectors, this is handled by the functions. If they are already allocated, they will be cleared.

If required, you can also use the inputs name, for example:

        fis.GetInputTriggerValues( "Temperature", v_in_hits );

Related functions:

Related data fields: