MyNixOS website logo
Description

Provides an R Interface to the 'FuzzyCoCo' C++ Library and Extends It.

Provides and extends the 'Fuzzy Coco' algorithm by wrapping the 'FuzzyCoCo' 'C++' Library, cf <https://github.com/Lonza-RND-Data-Science/fuzzycoco>. 'Fuzzy Coco' constructs systems that predict the outcome of a human decision-making process while providing an understandable explanation of a possible reasoning leading to it. The constructed fuzzy systems are composed of rules and linguistic variables. This package provides a 'S3' classic interface (fit_xy()/fit()/predict()/evaluate()) and a 'tidymodels'/'parsnip' interface, a custom engine with custom iteration stop criterion and progress bar support as well as a systematic implementation that do not rely on genetic programming but rather explore all possible combinations.

Rfuzzycoco

R-CMD-check codecov License: AGPL-3.0-or-later

Rfuzzycoco provides the FuzzyCoCo algorithm by wrapping the fuzzycoco C++ library, and extending its possibilities.

Fuzzy Coco

The Fuzzy CoCo (Fuzzy Cooperative Coevolution) algorithm — by Carlos A. Peña-Reyes (2000) — is an evolutionary fuzzy modeling method designed to automatically generate interpretable fuzzy rule-based systems from data.

Unlike traditional evolutionary approaches that evolve full rule bases as single entities, Fuzzy CoCo uses a cooperative coevolutionary strategy:

  • Each fuzzy rule (or rule component) is evolved in a separate subpopulation.
  • The membership functions parameters are evolved in a second subpopulation.

Both rule structures and membership functions are optimized jointly to balance accuracy and interpretability.

This decomposition enables Fuzzy CoCo to efficiently handle complex systems and produce transparent, linguistically meaningful models.

Reference

Peña-Reyes, C. A., & Sipper, M. (2001).
Fuzzy CoCo: A cooperative-coevolutionary approach to fuzzy modeling.
IEEE Transactions on Fuzzy Systems, 9(5), 727–737.
DOI: 10.1109/91.963759
📄 PDF (moshesipper.com)

License

This fuzzycoco software is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).

Installation

You can install the development version of Rfuzzycoco from github. Because the Rfuzzycoco uses a git submodule, the usual easy ways to install packages, like remotes::install_github() and pak::pak() do not work.

The easiest way is thus to clone the github repository, fetch the submodule and install the local package source from the terminal:

git clone https://github.com/Lonza-RND-Data-Science/Rfuzzycoco.git
cd Rfuzzycoco/
git submodule update --init

# install devtools from CRAN if needed
R -e "install.packages('devtools')"

# install the local package
R -e "devtools::install('.')"

Synopsis

cf the Getting Started vignette:

library(Rfuzzycoco)

pms <- params(
  nb_rules = 2, nb_max_var_per_rule = 3,        # structural parameters
  rules.pop_size = 100, mfs.pop_size = 100,     # coevolution population sizes
  ivars.nb_sets = 3, , ivars.nb_bits_pos = 8,   # input vars: 3 fuzzy sets, and 8 bits to discretize the values 
  ovars.nb_sets = 3, ovars.nb_bits_pos = 8,     # output vars: 3 fuzzy sets, and 8 bits to discretize the values 
  metricsw.sensitivity = 0, metricsw.specificity = 0, metricsw.rmse = 1, # we just use RMSE (root mean square error)
  output_vars_defuzz_thresholds = 17            # threshold for the qsec output variable
)

x <- mtcars[c("mpg", "hp", "wt")]
y <- mtcars["qsec"]
df <- cbind(x, y)

fit <- fit(model, qsec ~ ., df, engine = "rcpp", seed = 456, max_generations = 20)

res <- evaluate(fit, df)

y2 <- predict(fit, x)

Documentation

The package documentation, including the reference manual and the vignettes, is available online here: https://lonza-rnd-data-science.github.io/Rfuzzycoco/.

The underlying fuzzycoco C++ library and its documentation is available here: https://github.com/Lonza-RND-Data-Science/fuzzycoco

Local setup

  • clone the repo
  • get the submodule: git submodule update --init.
Metadata

Version

0.1.0

License

Unknown

Platforms (76)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows