Tune Sugeno-type fuzzy inference system using training data

`fis = anfis(trainingData)`

`fis = anfis(trainingData,options)`

```
[fis,trainError]
= anfis(___)
```

```
[fis,trainError,stepSize]
= anfis(___)
```

```
[fis,trainError,stepSize,chkFIS,chkError]
= anfis(trainingData,options)
```

generates a single-output Sugeno fuzzy inference system (FIS) and tunes the
system parameters using the specified input/output training data. The FIS object
is automatically generated using grid partitioning.`fis`

= anfis(`trainingData`

)

The training algorithm uses a combination of the least-squares and backpropagation gradient descent methods to model the training data set.

tunes
an FIS using the specified training data and options. Using this syntax,
you can specify:`fis`

= anfis(`trainingData`

,`options`

)

An initial FIS object to tune.

Validation data for preventing overfitting to training data.

Training algorithm options.

Whether to display training progress information.

`[`

returns the root mean square training
error for each training epoch.`fis`

,`trainError`

]
= anfis(___)

`[`

returns the training step size
at each training epoch.`fis`

,`trainError`

,`stepSize`

]
= anfis(___)

`[`

returns the validation data error for each training epoch,
`fis`

,`trainError`

,`stepSize`

,`chkFIS`

,`chkError`

]
= anfis(`trainingData`

,`options`

)`chkError`

, and the tuned FIS object for which the
validation error is minimum, `chkFIS`

. To use this syntax,
you must specify validation data using
`options.ValidationData`

.

`tunefis`

FunctionStarting in R2019a, you can tune a fuzzy system using `tunefis`

. This function provides
several other options for tuning algorithms, specified by the `tunefisOptions`

object.

To use ANFIS, specify the tuning algorithm as `"anfis"`

in
`tunefisOptions`

. Then, use
the options object as an input argument for `tunefis`

. For example:

Create the initial fuzzy inference system, and define the tunable parameter settings.

```
x = (0:0.1:10)';
y = sin(2*x)./exp(x/5);
options = genfisOptions('GridPartition');
options.NumMembershipFunctions = 5;
fisin = genfis(x,y,options);
[in,out,rule] = getTunableSettings(fisin);
```

Tune the membership function parameters with `"anfis"`

.

opt = tunefisOptions("Method","anfis"); fisout = tunefis(fisin,[in;out],x,y,opt);

[1] Jang, J.-S. R., "Fuzzy Modeling Using Generalized Neural Networks and Kalman Filter
Algorithm," *Proc. of the Ninth National Conf. on Artificial Intelligence
(AAAI-91)*. July 1991, pp. 762-767.

[2] Jang, J.-S. R., "ANFIS: Adaptive-Network-based Fuzzy Inference Systems,"
*IEEE Transactions on Systems, Man, and Cybernetics*, Vol. 23,
No. 3, May 1993, pp. 665-685.