## A SELF-ORGANIZING FUZZY NEURAL NETWORK FOR SEQUENCE LEARNING

## A PREPRINT

## Armin Salimi-Badr

Faculty of Computer Science and Engineering Shahid Beheshti University Tehran, Iran a\_salimibadr@sbu.ac.ir

November 2, 2020

## ABSTRACT

In this paper, a new self-organizing fuzzy neural network model is presented which is able to learn and reproduce different sequences accurately. Sequence learning is important in performing skillful tasks, such as writing and playing piano. The structure of the proposed network is composed of two parts: 1sequence identifier which computes a novel sequence identity value based on initial samples of a sequence, and detects the sequence identity based on proper fuzzy rules, and 2sequence locator , which locates the input sample in the sequence. Therefore, by integrating outputs of these two parts in fuzzy rules, the network is able to produce the proper output based on current state of the sequence. To learn the proposed structure, a gradual learning procedure is proposed. First, learning is performed by adding new fuzzy rules, based on coverage measure, using available correct data. Next, the initialized parameters are fine-tuned, by gradient descent algorithm, based on fed back approximated network output as the next input. The proposed method has a dynamic structure which is able to learn new sequences online. The proposed method is used to learn and reproduce different sequences simultaneously which is the novelty of this method.

Keywords: Self-Organizing Fuzzy Neural Networks . Sequence Learning . Gradual Learning The full version of this preprint is accepted for publication in IEEE Transactions on Cybernetics as "A Novel Self-Organizing Fuzzy Neural Network to Learn and Mimic Habitual Sequential Tasks," with

DOI :

10 1109 . /TCY B. 2020 2984646 .

## 1 Introduction

Fuzzy neural network (FNN) (Jang, 1993; Kasabov, 2001; Wu et al., 2001; de Jesus Rubio, 2009; Khayat et al., 2009; Ebadzadeh and Salimi-Badr, 2015; Ebadzadeh and Salimi-Badr, 2017; de Jesús Rubio and Bouchachia, 2015; Ma et al., 2016; Ganji et al., 2017; Han et al., 2017, 2018) is a hybrid method that combines the learning capability of a neural network with the interpretability of a rule-based fuzzy system. It is proved that FNNs are universal approximators (Kosko, 1994; Ying, 1998; Xu et al., 2000; Ebadzadeh and Salimi-Badr, 2015; Das et al., 2015). The functionality of FNN as a powerful tool is investigated in different applications including data mining, signal processing, system modeling, fault diagnosis, robotics and control (Riahi-Madvar et al., 2009; Han et al., 2014; Kim and Chwa, 2015; Asadi-Eydivand et al., 2015; Jahromi et al., 2016; Salimi-Badr et al., 2017; Qiao et al., 2018; Han et al., 2018; Pang et al., 2018; Khodabandelou and Ebadzadeh, 2019; Xu et al., 2019; Wen et al., 2019).

Two important issues in constructing an FNN are the structure identification and parameter estimation (de Jesus Rubio, 2009). The structure identification is related to determining the number of fuzzy rules and the parameter estimation concerns deriving proper values of parameters to construct a reliable system (Khayat et al., 2009).

In (Jang, 1993), the well-known adaptive network-based fuzzy inference system (ANFIS) is proposed. The gradient descent method is used to learn the network parameters. For structure identification, each input variable space is partitioned uniformly into fuzzy sets. In methods such as ANFIS, it is assumed that all data are available at once.

## Mohammad Mehdi Ebadzadeh

Department of Computer Engineering Amirkabir University of Technology Tehran, Iran ebadzadeh@aut.ac.ir

Some previous methods, considering the dynamic nature of real-world problems, utilize online structure identification (Wu and Er, 2000; Kasabov and Song, 2002; Wang et al., 2009; de Jesus Rubio, 2009; Han and Qiao, 2010; Han et al., 2014; Malek et al., 2012; Salimi-Badr et al., 2017; Han et al., 2018). In (Wu and Er, 2000), a fuzzy neural network has been proposed with a dynamic structure. In order to perform structure identification , a hierarchical online self-organizing learning mechanism is used. Generally, such methods try to avoid producing extra rules by selecting them based on some appropriate criteria (Wang et al., 2009; Pizzileo et al., 2012).

A real-world application with dynamic nature is sequence learning. Vertebrates, including human-beings, can learn and reproduce different sequences of actions, and generate different patterns subsequently. This ability is necessary to learn and perform skillful movements, such as playing piano, writing, or singing.

Although previous dynamic FNNs, such as (Wu et al., 2001; Wu and Er, 2000; Kasabov and Song, 2002; Wang et al., 2009; de Jesus Rubio, 2009; Malek et al., 2012; Asadi-Eydivand et al., 2015; Salimi-Badr et al., 2017), are designed to work in dynamic environments, such as learning identity functions of a dynamic system, they are not designed to learn and reproduce different sequences. Sequence learning for ordinary dynamic FNNs is even more complex, when different sequences have similar parts.

In this paper, a new Self-organizing FNN architecture is proposed for sequence learning. The proposed structure composed of two parts, sequence identifier and sequence locator . The first part receives only the initial samples of a sequence, to identify the sequence pattern among different learned sequences. The second part is designed to locate the current state in the current sequence. By combining the outputs of these parts and utilizing them in fuzzy rules, the network is able to identify the sequence and the current location, to produce the next sample properly.

The proposed network is utilized to learn two different sequences with a similar part. Since the network is designed to identify each sequence based on initial samples by sequence identifier part, it can learn these trajectories precisely. It is also used to learn different patterns and generate them periodically, as a pattern generator. As a real world problem, different hand writing character trajectories are learned and reproduced by the proposed network successfully.

The rest of this paper is organized as follows. In Section 2, the structure of the proposed architecture, initialization method and fine-tuning algorithm are discussed in details. Section 3 reports the effectiveness of the proposed method in learning different sequences. Finally, conclusions are presented in Section 4.

## 2 Proposed Method

In this section, the main ideas underlying the proposed algorithm are presented. After describing the proposed structure of the Fuzzy Neural Network (FNN), the initialization algorithm and the fine-tuning method are presented.

## 2.1 Proposed Architecture

The structure of the proposed FNN is shown in Fig. 1. The network is composed of two parts: 1sequence identifier , and 2sequence locator . Each part contains two distinct layers. The sequence identifier receives T initial samples of a sequence, and identifies the sequence. The second part, sequence locator , receives the current sample of a sequence ( x t ( ) ) and detects its location in the sequence. The outputs of these two parts are integrated into a fuzzy rule firing strength, which is utilized to calculate the next sample of the identified sequence ( ˆ( x t +1) ). It is assumed that the network would identify the sequence and produce the samples of sequence after T samples. Therefore, there are three switches, S 1 to S 3 in the proposed circuit to manage the information flow in the network. Initially, S 1 and S 3 are closed and the network receives the correct sequence sample x t ( ) . After receiving T samples, these switches become open and S 2 would become closed. Thus, the sequence locator part receives the previous network output as the input, and the sequence identifier part does not receive any inputs. Indeed, the output of the this part would remain constant after T samples.

Totally, the proposed network is composed of seven distinct layers. These layers are the discrimination layer , the sequence fuzzy sets layer , the memory layer , the sample fuzzy sets layer , the fuzzy rules layer , the normalization layer and finally the output layer . The output layer plays a role in determining the consequent parts of the rules, and the others serve as premise parts. We denote l as the layer number, and o ( ) l i as the output of the i th node of the l th layer.

The details of each layer are as follows:

- 1. The discrimination layer : The function of this layer is to calculate discriminative identity number for each sequence. This layer receive T samples of the sequence. It contains neurons with polynomial function f i . If

Figure 1: The proposed architecture for sequence learning. The network is composed of two parts, sequence identifier and sequence locator . The discrimination layer contains recurrent neurons which calculate a discriminative identity number for each sequence by using f i s which are polynomial integrating functions. Memory layer contains recurrent neurons which play the role of low-pass filters with different time-constants τ j . Sequence fuzzy sets layer and Sample fuzzy sets layer are composed of RBF neurons with multivariate Gaussian functions. The sequence identifier identifies the sequence and the sequence locator detect the location of the current sample. Next, their outputs are combined in the fuzzy rules layer . After applying normalization in the normalization layer , next sample of the sequence is approximated ( ˆ( x t +1) ) as the network output ( y t ( ) ). In the output layer, w 1 to w R are output weights for each fuzzy rule. It is assumed that the network would identify and produce the sequence after T samples. Therefore, there are three switches S 1 to S 3 . Initially, S 1 and S 3 are closed and the correct sequence sample x t ( ) is received by the network. After T samples, these switches become open and S 2 would be closed. Thus, the sequence locator part receives the previous network output as the input, and the sequence identifier part receives no more inputs. Indeed, the output of the this part would remain constant after T samples.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00617v2-figure-37df5bbb-71fa-4c2b-acd1-6edee85841e2.jpg)

x t ( ) is the input in t th time instant, the function of i th neuron in this layer is as follows:

$$o _ { i } ^ { ( 1 ) } ( t ) = \begin{cases} \ o _ { i } ^ { ( 1 ) } ( t - 1 ) + x ^ { i } ( t ) ; & t \leq T \\ o _ { i } ^ { ( 1 ) } ( t - 1 ) ; & t > T \end{cases}$$

Therefore, after T samples, the output of its i th neuron would be ∑ T t =1 x i ( ) t .

- 2. The sequence fuzzy sets layer : In this layer, multivariate fuzzy sets are defined for different identity numbers which are calculated in the previous layer. Indeed, each neuron of this layer receives a vector which contains all outputs of the previous layer ( o (1) ). The output of the i th neuron of this layer is calculated as follows:

$$o _ { i } ^ { ( 2 ) } = e ^ { - ( o ^ { ( 1 ) } - c 1 _ { i } ) ^ { T } \Sigma _ { 1 } ^ { - 1 } ( o ^ { ( 1 ) } - c 1 _ { i } ) }$$

where, here c 1 i is the vector of i th fuzzy set center and Σ 1 is a diagonal matrix contains width of fuzzy set for each input dimension as follows:

$$\Sigma _ { 1 } = \left [ \begin{array} { c c c c c } \sigma _ { 1 } ^ { 2 } & 0 & \cdots & 0 \\ 0 & \sigma _ { 1 } ^ { 2 } & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & \sigma _ { 1 } ^ { 2 } \end{array} \right ] \\ \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \cdots \end{array}$$

- 3. The memory layer : Each neuron of this layer is a discrete low-pass filter with a different time constant τ i . Indeed, this layer output is a vector which contains current and d previous samples of the sequence and its i th

neuron represents the ( t -i ) th sample. The output of the i th neuron of this layer is calculated as follows:

$$o _ { i } ^ { ( 3 ) } ( t ) = \begin{cases} \lambda _ { i } o _ { i } ^ { ( 3 ) } ( t - 1 ) + ( 1 - \lambda _ { i } ) x ( t ) ; & t \leq T \\ \lambda _ { i } o _ { i } ^ { ( 3 ) } ( t - 1 ) + ( 1 - \lambda _ { i } ) y ( t - 1 ) ; & t > T \end{cases}$$

where λ i = i i +1 . It is assumed that the number of neurons in this layer, ( d ), is lower than number of initial samples T .

- 4. The sample fuzzy sets layer : The function of this layer is similar to the second layer, but its input is the output of the third layer. Therefore, the output of its i th neuron is calculated as follows:

$$o _ { i } ^ { ( 4 ) } = e ^ { - ( o ^ { ( 3 ) } - c 2 _ { j } ) ^ { T } \Sigma _ { 2 } ^ { - 1 } ( o ^ { ( 3 ) } - c 2 _ { j } ) }$$

where, here c 2 i is the vector of i th fuzzy set center and Σ 2 is a diagonal matrix similar to Σ 1 .

- 5. The fuzzy rules layer : Each neuron of this layer represents a fuzzy rule. Its neurons compute a membership value based on applying the T-Norm operator on previous layer's outputs. By considering the inner product as the T-Norm operator, the membership function of i th fuzzy rule is defined as shown bellow:

$$o _ { i } ^ { ( 5 ) } = \mu _ { i } = o _ { j } ^ { ( 2 ) }. o _ { k } ^ { ( 4 ) }$$

where µ i is the membership value of the current sequence and its current location to the i th fuzzy rule.

- 6. The normalization layer : Calculated membership values are normalized in this layer. The output of i th neuron of this layer is calculated as follows:

$$o _ { i } ^ { ( 6 ) } = \phi _ { i } = \frac { o _ { i } ^ { ( 5 ) } } { \sum _ { j = 1 } ^ { R } o _ { j } ^ { ( 5 ) } }$$

where φ i is the normalized membership value of the current sequence and its current location to the i th fuzzy rule, and R is the number of fuzzy rules.

- 7. The output layer : There is one linear neuron for each output, in the last layer that provides the final output of the network. The output of this neuron is the inner product of the input vector with a weight vector ( W ) , which plays the role of the consequent part parameters. The final output of the network is computed as follows:

$$o ^ { ( 7 ) } = y ( t ) = \hat { x } ( t + 1 ) = W ^ { T }. o ^ { ( 6 ) }$$

The advantage of the proposed architecture is to have two distinct parts for sequence identification and location. Indeed, this architecture would be able to recognize different sequences (for example different characters in handwriting) by the sequence identifier part, and also the current state in each sequence by the sequence locator . Therefore, it is proper for sequence learning.

## 2.2 Initialization

Considering the dynamic nature of a sequence, a dynamic learning method is proposed for structure learning. During this phase of learning, switch S 1 is closed and S 2 is open. Switch S 3 is closed for first T samples and after receiving T samples, this switch would be open. Therefore, during this phase of learning, the architecture utilize correct sequence samples ( x t ( ) ).

After receiving T samples, the learning procedure starts with considering the current output of the memory layer as the center of the first fuzzy set in the sample fuzzy sets layer , and the output of the discrimination layer as the center of the first fuzzy set in the sequence fuzzy sets layer . To form the first fuzzy rule, these two fuzzy sets are joint in the fuzzy rules layer . To initialize the output weight for the first fuzzy rule, the desired output of the current sample (x(t+1)) is considered as the output weight.

Next, all samples of the first sequence are fed to the network. If the current set of fuzzy sets in sample fuzzy sets layer do not cover each sample x t ( ) , a new fuzzy set is added to this layer that its center is x t ( ) . Indeed, if the sum of fuzzy sets firing strength ( ∑ m i =1 o 4 i ) is lower than a predefined threshold ( θ 1 ), a fuzzy set is added to the sample fuzzy sets layer . Fig. 2 presents a schematic example of this concept. For the first sequence, each new fuzzy set in the sample fuzzy sets layer would be joint with the fuzzy set in the sequence fuzzy sets layer to from fuzzy rules. To initialize output weight, the desired value of the next sample ( x t ( +1) ) is considered as the output weight of the new fuzzy rule.

After learning the first sequence, the other sequences are fed to the network. If the current set of fuzzy sets in sequence fuzzy sets layer could not cover the new identity number for each sequence, a new fuzzy set would be added to this

Figure 2: A simple example of adding a new fuzzy set in a one-dimensional input space. a The input signal is analyzed by two fuzzy sets with centers c 1 and c 2 . The total coverage for the sample x ∗ is lower than a predefined threshold θ . b A new fuzzy set, which its center is x ∗ , has been added.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00617v2-figure-779d24b9-3978-4c17-8672-12b8852256ef.jpg)

layer which its center would be the current identity number. If a new fuzzy set is added to this layer, it is necessary to form new fuzzy rules for the new sequence. Now, if the current set of fuzzy sets in sample fuzzy sets layer cover sample x t ( ) , the fuzzy set with highest firing strength ( argmax o ( (4) i ) ) would be joint with the added fuzzy set in sequence fuzzy sets layer to form a new fuzzy rule. Else, a new fuzzy set is added to sample fuzzy sets layer that its center is x t ( ) . Then, to form new fuzzy rule, this new fuzzy set is joint with the new fuzzy set in sequence fuzzy sets layer . This algorithm is summarized in Algorithm 1.

## 2.3 Fine-tuning

After initialization, the circuit would work in normal operational mode: For t ≤ T , switches S 1 and S 3 are closed and S 2 is open; for t &gt; T , S 2 is closed and S 1 and S 2 are open. Therefore, the approximated value is fed back to the model as the next input after T samples.

In this phase of learning, only output weights are fine-tuned based on the network output, using gradient descent algorithm as follows:

$$w _ { i } \ & = w _ { i } - \eta \frac { \partial E ( t ) } { \partial w _ { i } } \\ & = w _ { i } - \eta \frac { \partial ( y ( t ) - x ( t + 1 ) ) ^ { 2 } } { \partial w _ { i } } \\ & = w _ { i } - \eta ( y ( t ) - x ( t + 1 ) ) \frac { \partial y ( t ) } { \partial w _ { i } } \\ & = w _ { i } - \eta ( y ( t ) - x ( t + 1 ) ) \phi _ { i } \\ \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \ \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \ \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \,  \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \. \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \ } \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \cdots \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \pm \, \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \, \quad \ \,
 \, \, \,$$

where E t ( ) is the squared error in time instant t , and η is the learning step value.

To ensure that the propagated error due to recurrent nature of network is controlled, a gradual fine-tuning procedure is applied. This gradual fine-tuning method utilizes eq. (9) sequentially for each sample. After reducing the error for sample x t ( ) , iteratively, to lower than a predefined threshold θ 3 , the algorithm is used for the next sample x t ( +1) . This algorithm is summarized in Algorithm 2.

## 3 Experiments

In this section, the performance of the proposed network in sequence learning is investigated. First, it is used to learn two intersected sequences and its performance is compared to the performance of an ordinary dynamic FNN

```
Algorithm 1: Initialization

seq += 1;
m += 0; /* Number of fuzzy sets in sample FSL                                                                                                                                                                                                        
p += 0; /* Number of fuzzy sets in sequence FSL                                                                                                                                                                                                     
R += 0; /* Number of rules                                                                                                                                                                                                        */
rules += []; /* Joint fuzzy sets forming rules                                                                                                                                                                                                       */                                                                                                                                                                                                        *
while seq >= seqNum do {
    nextSe += true;
    | for i += 1 to   to  T do
      |  Update o(1) (eq. (1))
    end
    coverage1 = \sum_{0}_{1}_{0}';
    if newSe && coverage1 >= 0; then
      |  /* Add new fuzzy set in sequence FSL:                                                                                                                                                                                                        +
      |                                                                                                                                                                                                        -
      |                                                                                                                                                                                                 +
       |                                                                                                                                                                                                  +
     |
```

Figure 3: Two intersected sequences with a similar part.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00617v2-figure-980d107f-0822-4deb-b173-ec1c7f856724.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00617v2-figure-1514331a-4103-4683-b734-9c962c292dac.jpg)

Table 1: Parameters values for learning two intersected functions

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00617v2-figure-c5056dba-4c5b-488a-bc8d-21bfde251218.jpg)

|   iter max |   θ 1 |   θ 2 |   θ 3 |   σ |   T |   d |   n |
|------------|-------|-------|-------|-----|-----|-----|-----|
|         20 |   0.3 |   0.3 |  0.01 | 0.1 |  10 |   5 |   1 |

((Salimi-Badr et al., 2017)). Next, the proposed network is utilized as a pattern generator to learn and generate four types of periodic signals. Finally, this network is utilized to learn different character trajectories extracted from UCI character trajectories data set 1 (Williams et al., 2006, 2007, 2008). This data set includes multiple, labelled samples of pen tip trajectories recorded whilst writing individual characters. All samples are from the same writer. Its sample have three dimensions including x y , , and pen tip force. In this paper, only two dimensions x and y are used. To show the ability of proposed FNN to encounter noise and uncertainty, random noise is added to the input samples.

## 3.1 Intersected sequences

In this experiment, the ability of the proposed network is compared to an ordinary self-organizing fuzzy neural network structure ((Wu et al., 2001; Malek et al., 2012; Salimi-Badr et al., 2017)) to learn two different intersected sequences. Indeed, these two sequences are begun from different points, and after some samples, they converge to a similar curve, and then, they diverge in different directions (Fig. 3).

Table 1 shows different parameters values for both approaches and Fig. 4 compares outputs of the proposed network and the ordinary one. According to Fig. 4, the proposed network is able to learn and generate both sequences, but the

1 https://archive.ics.uci.edu/ml/datasets/Character+Trajectories

x

x

Figure 4: Comparison between the proposed architecture and the ordinary one in learning two trajectories with intersected region. a Proposed network output for the first sequence. b Proposed network output for the second sequence. c The output of an ordinary self-organizing network architecture (GDFNN) for the first sequence. d The output of an ordinary self-organizing network architecture (GDFNN) for the second sequence.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00617v2-figure-8f90f108-2795-4d80-a072-17d3ed26bbee.jpg)

Table 2: Parameters values for learning different patterns

|   iter max |   θ 1 |   θ 2 |   θ 3 |   σ |   T |   d |   n |
|------------|-------|-------|-------|-----|-----|-----|-----|
|         20 |   0.4 |   0.1 |  0.01 | 0.1 |  20 |  20 |   2 |

ordinary network could learn just one sequence, due to the intersected region. Therefore, the proposed network is able to learn and generate such sequences by utilizing a small window of the previous samples.

## 3.2 Pattern generation

One application of the proposed network is to be utilized as a pattern generator. In this experiment, the proposed network is used to learn and generate periodic patterns. Four patterns, including sine, square, triangle, and sawtooth waves are used as target sequences. The network should learn to produce one period of all patterns based on receiving the samples of the first period. Next, it would be able to reproduce them periodically, by receiving just the first period. Table 2 shows the values of network parameters. After learning, the number of fuzzy sets of the sequence fuzzy sets layer is 4 and number of fuzzy sets of the sample fuzzy sets layer is 57.

Fig. 5 shows the generated periodic patterns, after receiving the first period. It is shown that the network generates three periods of each pattern, after receiving the first period.

Since the learned sequences are periodic, the output of the sequence identifier part is shift invariant. Indeed, it is expected that the network would be able to produce learned patterns with phase shift. Fig. 6 shows the output of the network for sine wave with different phase shifts ( φ ) including π/ 2 (cosine), π (inverted sine). It is shown that the proposed network is able to reproduce them with a negligible error.

## 3.3 Different character trajectories

In this experiment, the proposed network is utilized to learn and generate nine characters including 'a', 'c', 'd', 'e', 'g', 'o', 'p', 'q', and 'u' from UCI character trajectories data set. These selected characters have some similarities; for example 'a', 'c', 'g', 'q', 'u' and 'o' beginning curves are very similar. The network should receive T = 30 samples, and generate the remaining 150 samples. Table 3 includes different parameters values. To show the ability of the fuzzy network to encounter uncertainty, all input samples are integrated with random noisy samples. After learning, number of fuzzy sets of the sequence fuzzy sets layer is 9 and number of fuzzy sets of the sample fuzzy sets layer is 172.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00617v2-figure-bf02223d-f36c-49b4-8511-d45827014aa3.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00617v2-figure-0d50113c-88e2-45e0-9b3a-ef3ea6d1b955.jpg)

x

Figure 5: Learning four different patterns. a Sine wave. b Square wave. c Triangle wave. d Sawtooth wave.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00617v2-figure-afd4b85a-27b2-4818-81f8-47d67fbe64be.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00617v2-figure-081f0b45-6dd8-4559-b6f5-b5a610775827.jpg)

Figure 6: Generating learned periodic signal with phase shift. a φ = π/ 2 . b φ = π .

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00617v2-figure-c9c5df2c-3bdf-4899-afe5-af6c4d2f7986.jpg)

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00617v2-figure-d22515a8-6f9d-41c6-96ed-a77d786b33b4.jpg)

Fig. 7 shows the input samples to the network and compares the desired and generated trajectories. All character trajectories are begun from a same point (0,0). Uniform random noise in range (-0.3,0.3) is added to the input samples. Although the input to network is noisy (even rows in Fig. 7), the network is able to identify and generate each character trajectory with a little error. Therefore, the network was able to learn and generate different sequences.

## 4 Conclusions

In this paper, a novel self-organizing fuzzy neural network, with a new architecture is proposed for sequence learning. The network composed of two different parts, sequence identifier , to recognize different sequences, and sequence locator to detect the current location of the sequence. The network is able to identify each learned sequence by receiving T initial samples. Afterward, it would be able to produce the next sample based on the location of the current sample.

The learning algorithm is a two step gradual learning method. Firstly, the fuzzy sets are initialized by correct sequence samples. In this step, new fuzzy sets are added based on the amount of fuzzy sets coverage. If the current set of fuzzy sets does not cover the current sample properly, a new fuzzy set is added. After initializing fuzzy sets, the parameters are fine-tuned by a gradient descent based method, while feeding back the current output of the network as the next input.

The proposed network is used in different sequence learning problems. First, it is utilized to learn two different sequences with a similar part. The network can learn these trajectories successfully because, it is designed to identify each sequence based on initial samples. It is also utilized as pattern generator, to learn and generate different patterns periodically. Finally, as a real world problem, different hand writing character trajectories are learned and reproduced by the proposed network successfully.

Figure 7: Learning and generating different trajectories by the network. The first, third and fifth rows compare the desired and actual sequences. The second, fourth and sixth rows, show the corresponding noisy inputs to the network.

![image](https://ac.marcodsn.me/arxiv-markdown-images/1908.00617v2-figure-0e12aa67-40dd-4783-bca9-ac82ee88b37d.jpg)

The proposed network is an FNN with uncorrelated fuzzy sets. Considering correlations among different dimensions in defining fuzzy sets could be useful to decrease number of required fuzzy sets (Ebadzadeh and Salimi-Badr, 2015;

Table 3: Parameters values for learning different character trajectories

|   iter max |   θ 1 |   θ 2 |   θ 3 |   σ |   T |   d |   n |
|------------|-------|-------|-------|-----|-----|-----|-----|
|         20 |   0.2 |   0.2 |  0.01 | 0.2 |  30 |  30 |   2 |

Ebadzadeh and Salimi-Badr, 2017). Extending the proposed network with correlated fuzzy rules is proposed as a future work of the current study.

## References

Mitra Asadi-Eydivand, Mohammad Mehdi Ebadzadeh, Mehran Solati-Hashjin, Christian Darlot, and Noor Azuan Abu Osman. Cerebellum-inspired neural network solution of the inverse kinematics problem. Biological Cybernetics , 109(6):561-574, oct 2015. doi: 10.1007/s00422-015-0661-7. URL http://dx.doi.org/10.1007/ s00422-015-0661-7 .

Ankit Kumar Das, Kartick Subramanian, and Suresh Sundaram. An evolving interval type-2 neurofuzzy inference system and its metacognitive sequential learning algorithm. IEEE Trans. Fuzzy Systems , 23(6):2080-2093, 2015. doi: 10.1109/TFUZZ.2015.2403793. URL http://dx.doi.org/10.1109/TFUZZ.2015.2403793 .

- J. de Jesus Rubio. SOFMLS: Online self-organizing fuzzy modified least-squares network. IEEE Trans. Fuzzy Syst. , 17 (6):1296-1309, dec 2009. doi: 10.1109/tfuzz.2009.2029569. URL http://dx.doi.org/10.1109/TFUZZ.2009. 2029569 .

José de Jesús Rubio and Abdelhamid Bouchachia. MSAFIS: an evolving fuzzy inference system. Soft Computing , nov 2015. doi: 10.1007/s00500-015-1946-4. URL https://doi.org/10.1007%2Fs00500-015-1946-4 .

- Mohammad Mehdi Ebadzadeh and Armin Salimi-Badr. CFNN: correlated fuzzy neural network. Neurocomputing , 148: 430-444, 2015. doi: 10.1016/j.neucom.2014.07.021. URL http://dx.doi.org/10.1016/j.neucom.2014.07. 021 .
- Mohammad Mehdi Ebadzadeh and Armin Salimi-Badr. IC-FNN: a novel fuzzy neural network with interpretable intuitive and correlated-contours fuzzy rules for function approximation. IEEE Transactions on Fuzzy Systems , 2017.

Hamed Ganji, Shahram Khadivi, and Mohammad Mehdi Ebadzadeh. Support vector-based fuzzy classifier with adaptive kernel. Neural Computing and Applications , pages 1-14, 2017.

Hong-Gui Han, Zheng-Lai Lin, and Jun-Fei Qiao. Modeling of nonlinear systems using the self-organizing fuzzy neural network with adaptive gradient algorithm. Neurocomputing , 266:566-578, 2017.

Hong-Gui Han, Zhi-Yuan Chen, Hong-Xu Liu, and Jun-Fei Qiao. A self-organizing interval type-2 fuzzy-neural-network for modeling nonlinear systems. Neurocomputing , 290:196-207, 2018.

Honggui Han and Junfei Qiao. A self-organizing fuzzy neural network based on a growing-and-pruning algorithm. IEEE Trans. Fuzzy Syst. , 18(6):1129-1143, dec 2010. doi: 10.1109/tfuzz.2010.2070841. URL http://dx.doi. org/10.1109/TFUZZ.2010.2070841 .

Honggui Han, Xiao-Long Wu, and Jun-Fei Qiao. Nonlinear systems modeling based on self-organizing fuzzy-neuralnetwork with adaptive computation algorithm. IEEE Trans. Cybern. , 44(4):554-564, apr 2014. doi: 10.1109/tcyb. 2013.2260537. URL http://dx.doi.org/10.1109/TCYB.2013.2260537 .

Amin Torabi Jahromi, Meng Joo Er, Xiang Li, and Beng Siong Lim. Sequential fuzzy clustering based dynamic fuzzy neural network for fault diagnosis and prognosis. Neurocomputing , 196:31-41, 2016.

- J.-S.R. Jang. ANFIS: adaptive-network-based fuzzy inference system. IEEE Transactions on Systems, Man, and Cybernetics , 23(3):665-685, 1993. doi: 10.1109/21.256541. URL http://dx.doi.org/10.1109/21.256541 .

Nikola K. Kasabov. On-line learning, reasoning, rule extraction and aggregation in locally optimized evolving fuzzy neural networks. Neurocomputing , 41(1-4):25-45, oct 2001. doi: 10.1016/s0925-2312(00)00346-5. URL http://dx.doi.org/10.1016/S0925-2312(00)00346-5 .

- N.K. Kasabov and Qun Song. DENFIS: dynamic evolving neural-fuzzy inference system and its application for time-series prediction. IEEE Trans. Fuzzy Syst. , 10(2):144-154, apr 2002. doi: 10.1109/91.995117. URL http: //dx.doi.org/10.1109/91.995117 .
- Omid Khayat, Mohammad Mehdi Ebadzadeh, Hamid Reza Shahdoosti, Ramin Rajaei, and Iman Khajehnasiri. A novel hybrid algorithm for creating self-organizing fuzzy neural networks. Neurocomputing , 73(1-3):517-524, dec 2009. doi: 10.1016/j.neucom.2009.06.013. URL http://dx.doi.org/10.1016/j.neucom.2009.06.013 .

| Ghazaleh Khodabandelou and Mohammad Mehdi Ebadzadeh. Fuzzy neural network with support vector-based learning for classification and regression. Soft Computing , pages 1-16, 2019.                                                                                                                                                                   |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Cheol-Joong Kim and Dongkyoung Chwa. Obstacle avoidance method for wheeled mobile robots using interval type-2 fuzzy neural network. IEEE Trans. Fuzzy Syst. , 23(3):677-687, jun 2015. doi: 10.1109/tfuzz.2014.2321771. URL http://dx.doi.org/10.1109/TFUZZ.2014.2321771 .                                                                          |
| B. Kosko. Fuzzy systems as universal approximators. IEEE Transactions on Computers , 43(11):1329-1333, 1994. doi: 10.1109/12.324566. URL http://dx.doi.org/10.1109/12.324566 .                                                                                                                                                                       |
| Zhiqiang Ma, Guanghui Sun, Di Liu, and Xing Xing. Dissipativity analysis for discrete-time fuzzy neural networks with leakage and time-varying delays. Neurocomputing , 175:579-584, jan 2016. doi: 10.1016/j.neucom.2015.10.098. URL https://doi.org/10.1016%2Fj.neucom.2015.10.098 .                                                               |
| Hamed Malek, Mohammad Mehdi Ebadzadeh, and Mohammad Rahmati. Three new fuzzy neural networks learning algorithms based on clustering, training error and genetic algorithm. Appl. Intell. , 37(2):280-289, 2012. doi: 10.1007/s10489-011-0327-7. URL http://dx.doi.org/10.1007/s10489-011-0327-7 .                                                   |
| Hui Pang, Fan Liu, and Zeren Xu. Variable universe fuzzy control for vehicle semi-active suspension system with mr damper combining fuzzy neural network and particle swarm optimization. Neurocomputing , 306:130-140, 2018.                                                                                                                        |
| B. Pizzileo, Kang Li, G. W. Irwin, and Wanqing Zhao. Improved structure optimization for fuzzy-neural networks. IEEE Trans. Fuzzy Syst. , 20(6):1076-1089, dec 2012. doi: 10.1109/tfuzz.2012.2193587. URL http://dx.doi. org/10.1109/TFUZZ.2012.2193587 .                                                                                            |
| Jun-Fei Qiao, Ying Hou, Lu Zhang, and Hong-Gui Han. Adaptive fuzzy neural network control of wastewater treatment process with multiobjective operation. Neurocomputing , 275:383-393, 2018.                                                                                                                                                         |
| Hossien Riahi-Madvar, Seyed Ali Ayyoubzadeh, Ehsan Khadangi, and Mohammad Mehdi Ebadzadeh. An expert system for predicting longitudinal dispersion coefficient in natural streams by using ANFIS. Expert Systems with Applications , 36(4):8589-8596, may 2009. doi: 10.1016/j.eswa.2008.10.043. URL http://dx.doi.org/10. 1016/j.eswa.2008.10.043 . |
| Armin Salimi-Badr, Mohammad M. Ebadzadeh, and Christian Darlot. Fuzzy neuronal model of motor control inspired by cerebellar pathways to online and gradually learn inverse biomechanical functions in the presence of delay. Biological Cybernetics , 111(5-6):421-438, 2017. doi: 10.1007/s00422-017-0735-9.                                       |
| Ning Wang, Meng Joo Er, and Xianyao Meng. A fast and accurate online self-organizing scheme for parsimonious fuzzy neural networks. Neurocomputing , 72(16-18):3818-3829, oct 2009. doi: 10.1016/j.neucom.2009.05.006. URL http://dx.doi.org/10.1016/j.neucom.2009.05.006 .                                                                          |
| Ziteng Wen, Linbo Xie, Hongwei Feng, and Yong Tan. Infrared flame detection based on a self-organizing ts-type fuzzy neural network. Neurocomputing , 337:67-79, 2019.                                                                                                                                                                               |
| Ben Williams, Marc Toussaint, and Amos J Storkey. Modelling motion primitives and their timing in biologically executed movements. In Advances in neural information processing systems , pages 1609-1616, 2008.                                                                                                                                     |
| Ben H Williams, Marc Toussaint, and Amos J Storkey. Extracting motion primitives from natural handwriting data. In International Conference on Artificial Neural Networks , pages 634-643. Springer, 2006.                                                                                                                                           |
| Ben H Williams, Marc Toussaint, and Amos J Storkey. A primitive based generative model to infer timing information in unpartitioned handwriting data. In IJCAI , pages 1119-1124, 2007.                                                                                                                                                              |
| Shiqian Wu and Meng Joo Er. Dynamic fuzzy neural networks-a novel approach to function approximation. IEEE Trans. Syst., Man, Cybern. B , 30(2):358-364, apr 2000. doi: 10.1109/3477.836384. URL http://dx.doi.org/10. 1109/3477.836384 .                                                                                                            |
| Shiqian Wu, Meng Joo Er, and Yang Gao. A fast approach for automatic generation of fuzzy rules by generalized dynamic fuzzy neural networks. IEEE Transactions on Fuzzy Systems , 9(4):578-594, 2001. doi: 10.1109/91.940970. URL https://doi.org/10.1109%2F91.940970 .                                                                              |
| Shaohua Xu, Kun Liu, and Xuegui Li. A fuzzy process neural network model and its application in process signal classification. Neurocomputing , 335:1-8, 2019.                                                                                                                                                                                       |
| Wen-Li Xu, Nai-Yao Zhang, and Ke Zeng. A comparative study on sufficient conditions for takagi-sugeno fuzzy systems as universal approximators. IEEE Trans. Fuzzy Syst. , 8(6):773-780, 2000. doi: 10.1109/91.890337. URL http://dx.doi.org/10.1109/91.890337 .                                                                                      |
| Hao Ying. General SISO takagi-sugeno fuzzy systems with linear rule consequent are universal approximators. IEEE Trans. Fuzzy Syst. , 6(4):582-587, 1998. doi: 10.1109/91.728456. URL http://dx.doi.org/10.1109/91.                                                                                                                                  |
Armin Salimi-Badr Mohammad Mehdi Ebadzadeh
A self-organizing fuzzy neural network for sequence learning
In this paper, a new self-organizing fuzzy neural network model is presented
which is able to learn and reproduce different sequences accurately. Sequence
learning is important in performing skillful tasks, such as writing and playing
piano. The structure of the proposed network is composed of two parts:
1-sequence identifier which computes a novel sequence identity value based on
initial samples of a sequence, and detects the sequence identity based on
proper fuzzy rules, and 2-sequence locator, which locates the input sample in
the sequence. Therefore, by integrating outputs of these two parts in fuzzy
rules, the network is able to produce the proper output based on current state
of the sequence. To learn the proposed structure, a gradual learning procedure
is proposed. First, learning is performed by adding new fuzzy rules, based on
coverage measure, using available correct data. Next, the initialized
parameters are fine-tuned, by gradient descent algorithm, based on fed back
approximated network output as the next input. The proposed method has a
dynamic structure which is able to learn new sequences online. The proposed
method is used to learn and reproduce different sequences simultaneously which
is the novelty of this method.