Learn R Programming

Rfuzzycoco (version 0.1.0)

fit.fuzzycoco_model: fit the FuzzyCoco model using the formula interface

Description

N.B: fix_xy() is the workhorse, fit() is a simple formula-based layer

Usage

# S3 method for fuzzycoco_model
fit(
  object,
  formula,
  data,
  engine = FUZZY_COCO_HYBRID_ENGINE,
  max_generations = object$params$global_params$max_generations,
  max_fitness = object$params$global_params$max_fitness,
  seed = object$seed,
  verbose = object$verbose,
  ...
)

Value

the fit as a named list

Arguments

object

the fuzzycoco_model object to fit

formula

the fuzzy coco model as a formula

data

the data to fit as a data frame. The output variables must be grouped AFTER the input variables

engine

the fuzzy coco fit engine to use, one of rcpp and hybrid

max_generations

The maximum number of iterations of the algorithm. Each iteration produces a new generation of the rules and membership functions populations.

max_fitness

a stop condition: the iterations stop as soon as a generated fuzzy system fitness reaches that threshold.

seed

the RNG seed to use (to fit the model)

verbose

whether to be verbose

...

Arguments passed on to fit_xy.fuzzycoco_model

x

the input variables data (usually to fit) as a dataframe

y

the output variables data (usually to fit) as a dataframe

Examples

Run this code
model <- fuzzycoco("regression", example_mtcars()$params, seed = 123)
df <- mtcars[c("mpg", "hp", "wt", "qsec")]
fit <- fit(model, qsec ~ ., df, seed = 456, max_generations = 10, progress = FALSE)
print(names(fit))

Run the code above in your browser using DataLab