| Type: | Package |
| Title: | Fuzzy Inference System Design and Optimization |
| Version: | 1.1.4 |
| Author: | Serge Guillaume [aut], Brigitte Charnomordic [aut], Jean-Luc Lablée [aut, cre], Hazaël Jones [ctb], Lydie Desperben [ctb], INRAE [cph] (National Research Institute for Agriculture, Food and Environment, France) |
| Maintainer: | Jean-Luc Lablée <jean-luc.lablee@inrae.fr> |
| URL: | https://www.fispro.org |
| Description: | Fuzzy inference systems are based on fuzzy rules, which have a good capability for managing progressive phenomenons. This package is a basic implementation of the main functions to use a Fuzzy Inference System (FIS) provided by the open source software 'FisPro'https://www.fispro.org. 'FisPro' allows to create fuzzy inference systems and to use them for reasoning purposes, especially for simulating a physical or biological system. |
| License: | CeCILL version 2 |CECILL-2.1 [expanded from: CeCILL] |
| Encoding: | UTF-8 |
| Depends: | R (≥ 3.6.0) |
| Imports: | methods, utils, Rdpack, Rcpp (≥ 1.0.0) |
| RdMacros: | Rdpack |
| NeedsCompilation: | yes |
| LinkingTo: | Rcpp, BH |
| Suggests: | testthat, rlang, knitr, rmarkdown |
| RoxygenNote: | 7.2.3 |
| VignetteBuilder: | knitr |
| Packaged: | 2023-03-16 08:47:52 UTC; jllablee |
| Repository: | CRAN |
| Date/Publication: | 2023-03-16 09:30:02 UTC |
FisPro package
Description
This package is a basic implementation of the main functions to use a "Fuzzy Inference System" that can be used for reasoning purposes, especially for simulating a physical or biological system. It is derived from theFisPro open source software. Fuzzy inference systems are briefly described in theFuzzy Logic Elementary Glossary. They are based on fuzzy rules, which have a good capability for managing progressive phenomenons. Fuzzy logic, since the pioneer work by Zadeh, has proven to be a powerful interface between symbolic and numerical spaces. One of the reasons for this success is the ability of fuzzy systems to incorporate human expert knowledge with its nuances, as well as to express the behaviour of the system in an interpretable way for humans. Another reason is the possibility of designing data-driven FIS to make the most of available data.
To design a fuzzy system that can be handled by this package the user can use theFisPro software. If needed, the package can be extended to other functions.
All the mentioned publications are available from theFisPro web site.
EnjoyFisPro!
Author(s)
FisPro Teamcontact@fispro.org
References
Guillaume S, Charnomordic B (2011).“Learning interpretable Fuzzy Inference Systems with FisPro.”International Journal of Information Sciences,181(20), 4409-4427.doi:10.1016/j.ins.2011.03.025, Special Issue on Interpretable Fuzzy Systems.
Guillaume S, Charnomordic B (2012).“Fuzzy Inference Systems: an integrated modelling environment for collaboration between expert knowledge and data using FisPro.”Expert Systems with Applications,39(10), 8744-8755.doi:10.1016/j.eswa.2012.01.206.
See Also
Class "Fis"
Description
Class to manage a Fis "Fuzzy Inference System"
Fields
namecharacter vector, The name of the Fis
conjunctioncharacter vector, The conjunction operator of rules in the Fis
Allowed values are: "min" (the default), "prod" or "luka"
Constructors
Fis()The default constructor to build an empty Fis
The Fis is initialized with "min" conjunction and empty name
The design must be completed using the available functions to add inputs, outputs and rules before it can be used for inference- return:
Fis object
Fis(fis_file)The constructor to build a Fis from a configuration file
The configuration file can be designed using theFisPro open source software
Methods
input_size()- return:
integer value, The number of inputs in the Fis
add_input(input)- argument:
input FisIn object, The input to add in the Fis
- argument:
get_input(input_index)get_inputs()Get all inputs in the Fis
output_size()- return:
integer value, The number of outputs in the Fis
add_output(output)- argument:
output FisOut object, The output to add in the Fis
- argument:
get_output(output_index)get_outputs()Get all outputs in the Fis
rule_size()- return:
integer value, The number of rules in the Fis
add_rule(rule)- argument:
rule Rule object, The rule to add in the Fis
- argument:
get_rule(rule_index)get_rules()Get all rules in the Fis
infer(data)Infers all outputs
- argument:
data numeric vector,matrix ordata.frame, The input data or dataset to infer (the vector length or the number of columns must be equal to the number of inputs)
- return:
- argument:
infer_output(data, output_index)Infers a single output
- argument:
data numeric vector,matrix ordata.frame, The input data or dataset to infer (the vector length or the number of columns must be equal to the number of inputs)
- argument:
output_index integer value, The index (1-based index) of the output to infer
- return:
numeric value or vector (in case of 2D input data)
- argument:
See Also
Fuzzy Logic Elementary Glossary
Examples
# build a Fis from a configuration filefis_file <- system.file("extdata", "test.fis", package = "FisPro")fis <- NewFis(fis_file)# infers all outputsinferred <- fis$infer(c(0.25, 0.75))# infers first outputinferred_output1 <- fis$infer_output(c(0.25, 0.75), 1)# infers second outputinferred_output2 <- fis$infer_output(c(0.25, 0.75), 2)# infers test_data datasettest_file <- system.file("extdata", "test_data.csv", package = "FisPro")dataset <- read.csv(test_file)inferred_dataset <- fis$infer(dataset)######################################################################### or build a Fis from scratchfis <- NewFis()fis$name <- "foo"# build the first inputfisin1 <- NewFisIn(0, 1)fisin1$name <- "input1"fisin1$add_mf(NewMfTrapezoidalInf(0, 1))fisin1$add_mf(NewMfTrapezoidalSup(0, 1))fis$add_input(fisin1)# build the second inputfisin2 <- NewFisIn(0, 1)fisin2$name <- "input2"fisin2$add_mf(NewMfTrapezoidalInf(0, 0.5))fisin2$add_mf(NewMfTriangular(0, 0.5, 1))fisin2$add_mf(NewMfTrapezoidalSup(0.5, 1))fis$add_input(fisin2)# build an outputfisout <- NewFisOutCrisp(0, 1)fisout$name <- "output"fis$add_output(fisout)# add rules to the Fisfis$add_rule(NewRule(c(1, 2), 0))fis$add_rule(NewRule(c(2, 0), 1))Class "Fisin"
Description
Class to manage aFis input
Fields
namecharacter vector, The name of the input
Constructors
FisIn()The default constructor to build an empty input with the default range [0, 1]
- return:
FisIn object
FisIn(minimum, maximum)The constructor to build an empty input
FisIn(number_of_mfs, minimum, maximum)The constructor to build an input with a regular standardized fuzzy partition
FisIn(breakpoints, minimum, maximum)The constructor to build an input with an irregular standardized fuzzy partition
Methods
range()- return:
numeric vector, The range of the input (min max values)
mf_size()- return:
integer value, The number of Mfs in the input partition
add_mf(mf)Add an Mf in the input partition
- argument:
mf Mf object, The Mf to add
- argument:
get_mf(mf_index)get_mfs()Get all mfs in the input
is_standardized()- return:
logical value,
TRUEif the input is a standardized fuzzy partition,FALSEotherwise
See Also
Fuzzy Logic Elementary Glossary
Examples
input <- NewFisIn(0, 2)input$name <- "foo"input$add_mf(NewMfTrapezoidalInf(0, 1))input$add_mf(NewMfTriangular(0, 1, 2))input$add_mf(NewMfTrapezoidalSup(1, 2))Class "FisOut"
Description
The base class ofFis output (cannot be instantiate)
Use derived classesFisOutCrisp orFisOutFuzzy
Fields
namecharacter vector, The name of the output
Methods
range()- return:
numeric vector, The range of the output (min max values)
Class "FisOutCrisp"
Description
Class to manage aFis crisp output
Fields
defuzzificationcharacter vector, The defuzzification operator of the crisp output
Allowed values are: "sugeno" (the default) or "MaxCrisp"disjunctioncharacter vector, The disjunction operator of the crisp output
Allowed values are: "max" (the default) or "sum"
Inherits
FisOutCrisp class inherits all fields and methods ofFisOut class
Constructors
FisOutCrisp()The default constructor to build a crisp output with the default range [0, 1]
- return:
FisOutCrisp object
FisOutCrisp(minimum, maximum)The constructor to build a crisp output
- argument:
minimum numeric value, The minimum range value of the output
- argument:
maximum numeric value, The maximum range value of the output
- return:
FisOutCrisp object
- argument:
See Also
Fuzzy Logic Elementary Glossary
Examples
output <- NewFisOutCrisp(0, 1)output$name <- "foo"output$defuzzification <- "sugeno"output$disjunction <- "max"Class "FisOutFuzzy"
Description
Class to manage aFis fuzzy output
Fields
defuzzificationcharacter vector, The defuzzification operator of the fuzzy output
Allowed values are: "sugeno" (the default) "MeanMax", or "area"disjunctioncharacter vector, The disjunction operator of the fuzzy output
Allowed values are: "max" (the default) or "sum"
Inherits
FisOutFuzzy class inherits all fields and methods ofFisOut class
Constructors
FisOutFuzzy()The default constructor to build a fuzzy output with the default range [0, 1]
- return:
FisOutFuzzy object
FisOutFuzzy(minimum, maximum)The constructor to build a fuzzy output
- argument:
minimum numeric value, The minimum range value of the output
- argument:
maximum numeric value, The maximum range value of the output
- return:
FisOutFuzzy object
- argument:
FisOutFuzzy(number_of_mfs, minimum, maximum)The constructor to build a fuzzy with a regular standardized fuzzy partition
- argument:
number_of_mfs integer value, The number of Mfs in the fuzzy partition
- argument:
minimum numeric value, The minimum range value of the output
- argument:
maximum numeric value, The maximum range value of the output
- return:
FisOutFuzzy object
- argument:
FisOutFuzzy(breakpoints, minimum, maximum)The constructor to build a fuzzy with an irregular standardized fuzzy partition
- argument:
breakpoints numeric vector, The breakpoint values (sorted in ascending order) of the Mfs in the fuzzy partition
- argument:
minimum numeric value, The minimum range value of the output
- argument:
maximum numeric value, The maximum range value of the output
- return:
FisOutFuzzy object
- argument:
Methods
mf_size()- return:
integer value, The number of Mfs in the output partition
add_mf(mf)Add an Mf in the output partition
- argument:
mf Mf object, The Mf to add
- argument:
get_mf(mf_index)get_mfs()Get all mfs in the output
is_standardized()- return:
logical value,
TRUEif the output is a standardized fuzzy partition,FALSEotherwise
See Also
Fuzzy Logic Elementary Glossary
Examples
output <- NewFisOutFuzzy(0, 2)output$name <- "foo"output$defuzzification <- "sugeno"output$disjunction <- "max"output$add_mf(NewMfTrapezoidalInf(0, 1))output$add_mf(NewMfTriangular(0, 1, 2))output$add_mf(NewMfTrapezoidalSup(1, 2))Deprecated classes in packageFisPro.
Description
The classes listed below are deprecated and will be removed in future version.Alternative classes with similar functionality are also mentioned.
Help pages for deprecated functions are available athelp("<class>-deprecated").
Deprecated classes
Forfis, useFis instead
Formf, useMf instead
Formf_triangular, useMfTriangular instead
Formf_trapezoidal_inf, useMfTrapezoidalInf instead
Formf_trapezoidal_sup, useMfTrapezoidalSup instead
Formf_trapezoidal, useMfTrapezoidal instead
See Also
fis-deprecated
mf-deprecated
mf_triangular-deprecated
mf_trapezoidal_inf-deprecated
mf_trapezoidal_sup-deprecated
mf_trapezoidal-deprecated
Class "Mf"
Description
The base class of all "membership function" classes (cannot be instantiate)
Use derived classesMfTriangular,MfTrapezoidal,MfTrapezoidalInf orMfTrapezoidalSup
Fields
labelcharacter vector, The label of the membership function
Methods
degree(value)Get the membership degree
See Also
Fuzzy Logic Elementary Glossary
Class "MfTrapezoidal"
Description
Class to manage a trapezoidal membership function
Inherits
MfTrapezoidal class inherits all fields and methods ofMf class
Constructors
MfTrapezoidal(lower_support, lower_kernel, upper_kernel, upper_support)- argument:
lower_support numeric lower value of support
- argument:
lower_kernel numeric lower value of kernel
- argument:
upper_kernel numeric upper value of kernel
- argument:
upper_support numeric upper value of support
- return:
MfTrapezoidal object
- argument:
See Also
Examples
mf <- NewMfTrapezoidal(0, 1, 2, 3)mf$degree(0.5)Class "MfTrapezoidalInf"
Description
Class to manage a trapezoidal inf membership function
Inherits
MfTrapezoidalInf class inherits all fields and methods ofMf class
Constructors
MfTrapezoidalInf(upper_kernel, upper_support)- argument:
upper_kernel numeric upper value of kernel
- argument:
upper_support numeric upper value of support
- return:
MfTrapezoidalInf object
- argument:
See Also
Examples
mf <- NewMfTrapezoidalInf(0, 1)mf$degree(0.5)Class "MfTrapezoidalSup"
Description
Class to manage a trapezoidal sup membership function
Inherits
MfTrapezoidalSup class inherits all fields and methods ofMf class
Constructors
MfTrapezoidalSup(lower_support, lower_kernel)- argument:
lower_support numeric lower value of support
- argument:
lower_kernel numeric lower value of kernel
- return:
MfTrapezoidalSup object
- argument:
See Also
Examples
mf <- NewMfTrapezoidalSup(0, 1)mf$degree(0.5)Class "MfTriangular"
Description
Class to manage a triangular membership function
Inherits
MfTriangular class inherits all fields and methods ofMf class
Constructors
MfTriangular(lower_support, kernel, upper_support)- argument:
lower_support numeric lower value of support
- argument:
kernel numeric value of kernel
- argument:
upper_support numeric upper value of support
- return:
MfTriangular object
- argument:
See Also
Examples
mf <- NewMfTriangular(0, 1, 2)mf$degree(0.5)Create object of class "Fis"
Description
Function to create object of classFis
Usage
NewFis(...)Arguments
... | arguments ofFis constructor |
Value
Fis object
Create object of class "FisIn"
Description
Function to create object of classFisIn
Usage
NewFisIn(...)Arguments
... | arguments ofFisIn constructor |
Value
FisIn object
Create object of class "FisOutCrisp"
Description
Function to create object of classFisOutCrisp
Usage
NewFisOutCrisp(...)Arguments
... | arguments ofFisOutCrisp constructor |
Value
FisOutCrisp object
Create object of class "FisOutFuzzy"
Description
Function to create object of classFisOutFuzzy
Usage
NewFisOutFuzzy(...)Arguments
... | arguments ofFisOutFuzzy constructor |
Value
FisOutFuzzy object
Create object of class "MfTrapezoidal"
Description
Function to create object of classMfTrapezoidal
Usage
NewMfTrapezoidal(...)Arguments
... | arguments ofMfTrapezoidal constructor |
Value
MfTrapezoidal object
Create object of class "MfTrapezoidalInf"
Description
Function to create object of classMfTrapezoidalInf
Usage
NewMfTrapezoidalInf(...)Arguments
... | arguments ofMfTrapezoidalInf constructor |
Value
MfTrapezoidalInf object
Create object of class "MfTrapezoidalSup"
Description
Function to create object of classMfTrapezoidalSup
Usage
NewMfTrapezoidalSup(...)Arguments
... | arguments ofMfTrapezoidalSup constructor |
Value
MfTrapezoidalSup object
Create object of class "MfTriangular"
Description
Function to create object of classMfTriangular
Usage
NewMfTriangular(...)Arguments
... | arguments ofMfTriangular constructor |
Value
MfTriangular object
Create object of class "Rule"
Description
Function to create object of classRule
Usage
NewRule(...)Arguments
... | arguments ofRule constructor |
Value
Rule object
Class "Rule"
Description
Class to manage aFis rule
Fields
premisesinteger vector, The premises of the rule
A premise is the 1-based index of MF in theFisIn
0 means the input is not taken into account for this rule, i.e. the rule is incomplete
The vector length must be equal to the number of inputs in theFisconclusionsnumeric vector, The conclusions of the rule
A conclusion is anumeric value for crisp outputFisOutCrisp, or the 1-based index of MF in the fuzzy outputFisOutFuzzy
The vector length must be equal to the number of outputs in theFis
Constructors
Rule()The default constructor to build an empty rule
The rule is initialized with empty premises and conclusions- return:
Rule object
Rule(premises, conclusions)The constructor to build a rule
See Also
Fuzzy Logic Elementary Glossary
Examples
rule1 <- NewRule()rule1$premises <- c(1, 2, 0)rule1$conclusions <- c(1, 2)rule2 <- NewRule(c(2, 1, 1), c(2, 1))Deprecated class "fis"
Description
Thefis class is deprecated and will be removed in future version, useFis instead
Methods
infer_output(data, output_index)WARNING !!! the
output_indexis now 1-based indexed inFis, was 0-based indexed infis
See Also
Deprecated class "mf"
Description
Themf class is deprecated and will be removed in future version, useMf instead
See Also
Deprecated class "mf_trapezoidal"
Description
Themf_trapezoidal class is deprecated and will be removed in future version, useMfTrapezoidal instead
See Also
Deprecated class "mf_trapezoidal_inf"
Description
Themf_trapezoidal_inf class is deprecated and will be removed in future version, useMfTrapezoidalInf instead
See Also
Deprecated class "mf_trapezoidal_sup"
Description
Themf_trapezoidal_sup class is deprecated and will be removed in future version, useMfTrapezoidalSup instead
See Also
Deprecated class "mf_triangular"
Description
Themf_triangular class is deprecated and will be removed in future version, useMfTriangular instead