Now, let's implement a simple code that can be used in the neuro-fuzzy and neuro-genetic networks. First, we need to define Gaussian functions for activation that will be the membership functions:
public class Gaussian implements ActivationFunction{ double A=1.0,B=0.0,C=1.0; public Gaussian(double A){ ///… } public double calc(double x){ return this.A*Math.exp(-Math.pow(x-this.B,2.0) / 2*Math.pow(this.C,2.0)); } }
The fuzzy sets and rules need to be represented in a way that a neural network can understand and drive the execution. This representation includes the quantity of sets per input, therefore having the information on how the neurons are connected; and the membership functions for each set. A simple way to represent the quantity is an array. The array of sets just indicates how many sets there are for each variable; and the array of rules is a matrix, where each row represents a rule and each column represents a variable; each set...