Main Content

Tuning Fuzzy Inference Systems

Designing a complex fuzzy inference system (FIS) with a large number of inputs and membership functions (MFs) is a challenging problem due to the large number of MF parameters and rules. To design such a FIS, you can use a data-driven approach to learn rules and tune FIS parameters. To tune a fuzzy system, you can use:

  • Fuzzy Logic Designer — Interactively tune FIS rules and parameters (since R2023a)

  • tunefis — Programmatically tune FIS rules and parameters

Using Fuzzy Logic Toolbox™ software, u can tune the following types of fuzzy systems.

During tuning, the optimization algorithm generates candidate FIS parameter sets. The fuzzy system is updated with each parameter set and then evaluated using the a cost function.

If you have input/output training data, the cost function for each solution is computed based on the difference between the output of the fuzzy system and the expected output values from the training data. For examples that use this approach, see Tune Fuzzy Inference System Using Fuzzy Logic Designer and Tune Mamdani Fuzzy Inference System.

The cost for a given parameter set is computed by comparing the output of the fuzzy system with the expected output from the training data.

If you do not have input/output training data, you can specify a custom model and cost function for evaluating candidate FIS parameter sets. The cost measurement function sends an input to the fuzzy system and receives the evaluated output. The cost is based on the difference between the evaluated output and the output expected by the model. For more information and an example that uses this approach, see Tune Fuzzy Robot Obstacle Avoidance System Using Custom Cost Function.

A custom cost function computes the cost for a given parameter set by comparing the output of the fuzzy system with the output computed by a custom model.

Tuning Methods

The following table shows the tuning methods supported by Fuzzy Logic Designer and tunefis function.

MethodDescriptionMore Information
Genetic algorithmPopulation-based global optimization method that searches randomly by mutation and crossover among population membersWhat Is the Genetic Algorithm? (Global Optimization Toolbox)
Particle swarm optimizationPopulation-based global optimization method in which population members step throughout a search regionWhat Is Particle Swarm Optimization? (Global Optimization Toolbox)
Pattern searchDirect-search local optimization method that searches a set of points near the current point to find a new optimumWhat Is Direct Search? (Global Optimization Toolbox)
Simulated annealingA local optimization method that simulates a heating and cooling process to that finds a new optimal point near the current pointWhat Is Simulated Annealing? (Global Optimization Toolbox)
Adaptive neuro-fuzzy inferenceBack-propagation algorithm that tunes membership function parameters. Alternatively, you can use the anfis function.Neuro-Adaptive Learning and ANFIS

The first four tuning methods require Global Optimization Toolbox software.

Global optimization methods, such as genetic algorithms and particle swarm optimization, perform better for large parameter tuning ranges. These algorithms are useful for both the rule-learning and parameter-tuning stages of FIS optimization.

On the other hand, local search methods, such as pattern search and simulated annealing, perform better for small parameter ranges. If you generate a FIS from training data or a rule base is already added to a FIS, then these algorithms can produce faster convergence compared to global optimization methods.

Prevent Overfitting of Tuned System

Data overfitting is a common problem in FIS parameter optimization. When overfitting occurs, the tuned FIS produces optimized results for the training data set but performs poorly for a test data set. To overcome the data overfitting problem, a tuning process can stop early based on an unbiased evaluation of the model using a separate validation dataset.

You can prevent overfitting using k-fold cross validation. For more information and a command-line example, see Optimize FIS Parameters with K-Fold Cross-Validation. You can also configure k-fold cross validation when setting the tuning options in Fuzzy Logic Designer. For more information, see Configure Tuning Options in Fuzzy Logic Designer.

The ANFIS tuning method does not support k-fold cross validation. Instead, you must specify separate validation data. For more information, see Neuro-Adaptive Learning and ANFIS.

Improve Tuning Results

To improve the performance of your tuned fuzzy systems, consider the following guidelines.

  • Use multiple phases in your tuning process. For example, first learn the rules of a fuzzy system, and then tune input/output MF parameters using the learned rule base.

  • Increase the number of iterations in both the rule-learning and parameter-tuning phases. Doing so increases the duration of the optimization process and can also increase validation error due to overtuned system parameters with the training data. To avoid overfitting, train your system using k-fold cross validation.

  • Change the clustering technique when you create a FIS from data. Depending on the clustering technique, the generated rules can differ in their representation of the training data, which can affect the tuning performance.

  • Change FIS properties. Try changing properties such as the type of FIS, number of inputs, number of input/output MFs, MF types, and number of rules. A Sugeno system has fewer output MF parameters (assuming constant MFs) and faster defuzzification. Therefore, for fuzzy systems with a large number of inputs, a Sugeno FIS generally converges faster than a Mamdani FIS. Small numbers of MFs and rules reduce the number of parameters to tune, producing a faster tuning process. Furthermore, a large number of rules might overfit the training data.

  • Modify tunable parameter settings for MFs and rules. For example, you can tune the support of a triangular MF without changing its peak location. Doing so reduces the number of tunable parameters and can produce a faster tuning process for specific applications. For rules, you can exclude zero MF indices, which reduces the overall number of rules during the learning phase.

To improve the tuning results for FIS trees, consider the following guidelines.

  • If you have the corresponding training data, you can separately tune the parameters of each FIS in a FIS tree. You can then tune all the fuzzy systems together to generalize the parameter values.

  • Change FIS tree properties, such as the number of fuzzy systems and the connections between the fuzzy systems.

  • Use different rankings and groupings of the inputs to a FIS tree. For more information about creating FIS trees, see Fuzzy Trees.

See Also



Related Topics

External Websites