0% found this document useful (0 votes)
152 views6 pages

A Fuzzy Finite State Machine Implementation Based On A Neural Fu

This document describes implementing a fuzzy finite state machine (FFSM) using a neural fuzzy system called NeuFuz. 1) NeuFuz changes its feedforward neural network structure to recurrent by adding feedback from the output layer to the input layer during recall. This allows it to incorporate memory and implement an FFSM. 2) An FFSM extends a conventional finite state machine by representing inputs, states, and next states as fuzzy sets rather than crisp values. Fuzzy rules and membership functions replace the state transition and output functions. 3) NeuFuz is trained on a state transition table to generate the fuzzy rules and membership functions that define the FFSM. It can then directly implement new FFSMs without

Uploaded by

free5050
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
152 views6 pages

A Fuzzy Finite State Machine Implementation Based On A Neural Fu

This document describes implementing a fuzzy finite state machine (FFSM) using a neural fuzzy system called NeuFuz. 1) NeuFuz changes its feedforward neural network structure to recurrent by adding feedback from the output layer to the input layer during recall. This allows it to incorporate memory and implement an FFSM. 2) An FFSM extends a conventional finite state machine by representing inputs, states, and next states as fuzzy sets rather than crisp values. Fuzzy rules and membership functions replace the state transition and output functions. 3) NeuFuz is trained on a state transition table to generate the fuzzy rules and membership functions that define the FFSM. It can then directly implement new FFSMs without

Uploaded by

free5050
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

A Fuzzy Finite State Machine Implementation

Based on a Neural Fuzzy System

Fatih A. Una1 Emdad Khan

National Semiconductor, Embedded Systems Division


2900 Semiconductor Dr., Santa Clara, CA, 95051

Abstract - The outputs of a feedforward neural and govem the transitions of the FFSM between the
network depend on the present inputs only. Difficulties fuzzy states. The fuzzification of FSM results in data
arise when a solution requires memory in such reduction (less memory to implement the FFSM) as
applications as speech processing, seismic signal well as more robust operation (less susceptible to
processing, language processing, and spatiotemporal system parameter changes or to noise) as stated in [5].
signal processing. For such applications, the outputs
are not only the functions of the present inputs but the Also, with this approach, writing a new program is
present states (or the past inputs and the outputs) as not required since the ANN of NeuFuz is trained with
well. The fuzzy finite state machines can be effectively the state transition table and implementation of a new
used in these applications. The aim of this study is to FFSM is achieved directly with the training data. This
show that a fuzzy finite state machine can be realized increases the reliability. Furthermore, the suggested
using our neural fuzzy system. In a fuzzy finite state approach facilitates the design and implementation of
machine, the output and the next state depend on the a FFSM using a microcontroller.
input and the present state which in turn is a function
of the previous inputs. To accommodate the memory The FFSM concept is introduced in the next
requirement, the feedfonvard structure of the neural section. In Section 3, a brief description of NeuFuz is
fuzzy system is changed to a recurrent architecture by given. An illustrative temporal pattem matching
adding a feedback loop from the output layer to the experiment is carried out in Section 4 to verify the
input layer during the recall mode. The validity of the validity of our approach. Section 5 contains the
approach is verified with a temporal pattern matching conclusions.
experiment.
2. A Fuzzy Finite State Machine
1. Introduction
A FFSM is a synchronous sequential machine and
In our previous works, it has been shown that the it can be defined as a quintuple following the crisp
artificial neural networks (ANN) can be combined FSM definition in [4]:
with fuzzy logic systems to achieve high performance
and low cost solutions [ll-[3]. In this work, the
feedfonvard structure of our neural fuzzy system
(NeuFuz) is changed to a recurrent architecture by where I, 0, and S are finite, nonempty sets of fuzzy
adding a feedback loop from the output layer to the inputs, fuzzy outputs, and fuzzy states respectively,
input layer during the recall mode. With this and f: I X S + S is the state transition function, g is
modification, we demonstrate that NeuFuz can be used the output function such that g: I X S + 0. The
to implement a Fuzzy Finite State Machine (FFSM). Cartesian product I X S contains all pairs of fuzzy
elements (u(t), x(t)). The state transition function f
A FFSM is an extension of a conventional FSM. maps each fuzzy pair (u(t), x(t)) onto a fuzzy next state
The difference is that the inputs, the present states and x(t+l) in S, and the output function g maps each fuzzy
the next states are represented using fuzzy sets in pair (u(t), x(t)) onto a fuzzy output y(t) in 0 in
contrast with the crisp inputs and the states of a accordance with
traditional crisp FSM. The output function and the
state transition function of the FSM are replaced by
the recurrent fuzzy rules which determine the outputs

0-7803-1896-X/94 $4.00 01994 IEEE 1749


and membership function generator (FRMFG), a fuzzy rule
verifier and optimizer (FXVO) and an automatic code
converter (ACC). A supervised learning is employed
to train the ANN. A modified backpropagation
where x(t) is the fuzzy present state, u(t) is the fuzzy algorithm is used to learn the input output relationship
input, and x(t+l) is the fuzzy next state. The FFSM is for a given system. The ANN has four inputs, one
defined only at discrete times t = 0, 1, 2, ... in this output and five hidden layers. The architecture of the
work. ANN explicitly maps to the fuzzy logic structure, and
the connection Structure along with the weights
A Moore type of FFSM is employed in this study directly define the fuzzy rules and the membership
since it is more convenient to use it with our neural functions. The FRMFG extracts the fuzzy rules and
fuzzy system (NeuFuz has one output at this time). the membership functions when the ANN converges to
The output of a Moore machine is a function of a minimum energy state. The validity of the solution
present state only can be verified by the FRVO and the solution can be
optimized by eliminating the fuzzy rules that do not
contribute to the result significantly. This way the
output error can be controlled and kept at tolerable
Note that, in a Mealy machine, the output is a function levels which is not a trivial task when an ANN is not
of both present state and the input. For both machine utilized to obtain the fuzzy system. Finally, the ACC
types, the next state depends on both the input and the generates a program which corresponds to the fuzzy
present state as seen in equation (2). system.

In general, the state transition function f, and the During the training phase, one input of the ANN is
output function g (given in equations (2) and (3) used for the external input U(t), and another input is
respectively) can be represented using fuzzy rules in used for the present state X(t). The output of the ANN
the following format is used for the next state X(t+l) as shown in Figure 1.
There is no need to use separate outputs for the next
If Input = U t ) and Presentstate = x ( t ) state X(t+l) and the external output Y(t) of the FSM,
1
then Next tate = x( t + 1) (5) since a Moore type of FFSM is implemented.

If Input = u(t) and Presentstate = x ( t ) The output X(t+l) is fed back to the present state
then Output = y ( t ) (6) input X(t) through a unit delay D, once the training is
completed. Thus, the architecture of the neural fuzzy
and the membership functions , px(t), pgt+l)are system is changed from a feedforward structure to a
defined for the fuzzy input u(t), fuzzy present and the recurrent architecture during the recall mode as
next states x(t) and x(t+l) respectively as usual. depicted in Figure 2. There is a comparator at the
output to determine whether the system is at the final
Note that the derivation of the fuzzy rules (given in
equation (5) and (6)) and the associated membership
functions is not trivial. The task is to transform the
crisp FSM into the corresponding FFSM. This requires
the partitioning of the crisp states and the crisp inputs
into the clusters (fuzzy sets) and generate the
associated membership functions using the state
transition table that corresponds to the crisp FSM.
This is achieved by means of the ANN in NeuFuz.

3. N d u z Neural Fuzzy System


Legend
A detailed description of our neural fuzzy system U(t): Input, X(t): Present State, X(t+l): Next State
can be found in [l] - [3]. Here, a brief description will
be given. The neural fuzzy system consists of four Figure 1: NeuFuz in training mode
components: A feedforward ANN, a fuzzy rules and

1750

I I7
Legend:
D: Unit Delay

Figure 2: NeuFuz in recall mode


0 1 2 3 4 5
t
state. Note that the output y(t) is zero in all states Figure 3: A temporal pattem
except the final state.

The defuzzification in NeuFuz can be summarized


as
INPUTS PRESENT NEXT
STATE STATE
U(t> X(t) X(t+l)
WO) so s1
Else 1 so I so
where M is the total number of fuzzy rules, pu , pX([) , s1
px([+1)are the membership functions for the fuzzy
input u(t), fuzzy present state x(t) and the fuzzy next Else I so
state x(t+l) respectively. The capital U, X(t) and U(0) I s2 I SI
X(t+l) represent the crisp values. In this work, U(2)
. , I s2 I s3
singletons are used for the next state. The addition and Else s2 so
multiplication are used for the disjunction and U(0) s3 s1
conjunction operations as shown in equation (7). U(3) s3 s4
Else s3 so
4. Experimental Results U(0) s4 SI
U(4) s4 s5
To show the validity of the proposed approach, a Else s4 so
Moore type of FFSM is implemented to recognize a U(0) s5 s1
temporal pattern shown in Figure 3. First, a state U(5) s5 S6
transition diagram (depicted in Figure 4), and a Else s5 so
corresponding state transition table (tabulated in Table All S6 S6
1) are derived to recognize the given temporal pattern.
The FFSM changes from a fuzzy state to another fuzzy
state depending on the temporal pattern sample values Table 2: A Procedure to Generate the Training Data
arriving at discrete instances. There is an initial state
1. Devise the state diagram
SO at which the system waits for the specified temporal
2. Generate the state transition table from the state
pattern. The initial state is resumed each time the
diagram
correct temporal sequence is broken. The final state S6
3. Assign numerical values to the states
is reached when the entire temporal pattern is
4. Generate the “Else” inputs within the input range
received. The FFSM stays in S6 indefinetely until it is
along with the corresponding states
reset.

1751
Figure 4: State transition diagram to recognize the temporal pattern in Figure 3.

The next step is the training of the ANN in X(t+l) corresponding to the consecutive next states
NeuFuz. Table 2 contains the procedure to generate and inputs as can be seen in Table 4.
the training data set. Following the procedure, the
numerical values are assigned to the states as listed in The parameters shown in Table 5 are used for the
Table 3. The numerical assignments can be arbitrary. training. It takes 109,286 iterations for the ANN to
However, to facilitate the convergence of the ANN in converge with these parameters. The generated
NeuFuz, the assignment in Table 3 is chosen to membership functions for the input u(t) and the
minimize the variations between the next state values present state x(t), and the fuzzy rules are given in
matrix format in Figure 5a, 5b and Table 6
Table 3: Numerical state assignments respectively. The NeuFuz generates an assembler
program code automatically. The required amount of
memofy to implement this FFSM is 894 bytes (in
National’s COP8 Microcontroller ).

The recognition rate of FFSM is 100 % when the


input sample values are within the specified error
range (E = 0.01). A detailed analysis of recognition
performance is not carried out as the major focus is to
S6 show the feasibility of implementing the FFSM using
NeuFuz.

1752
Table 5: Training Mode Parameters
Legend:
E: Tolerated error, LR: Learning rate, I>F:Learning factor, MF:
input, x(t): Fuzzy present state

# MFu
MF x(t)
# Rules 49

Table 6: Fuzzy Rules


Legend:
U: Fuzzy input, x(t): Fuzzy present state, singleton values are for next state
x(t+l), VLM: Very Low Match, LM: Low Match, MLM: Medium Low
Match, MM: Medium Match, MHM: Medium High Match, HM: High
Match, VHM: Very High Match. The numerical values are truncated to
two digits after the decimal point.

1753
signal detection subsystem. Furthermore, the
suggested approach facilitates the design and
implementation of a FFSM using a microcontroller
and provides more robust response (less susceptible to
system parameter changes or to noise) as stated in [5].
The results obtained encourage us to apply our method
to the automotive problems such as airbag deployment
and antilock braking system as well as other
spatiotemporal signal processing applications. Further
studies are underway to determine the applicability of
this approach to speech processing.
Figure 5a: Membership Functions pu(U(t)) for the References
Fuzzy Input u(t)
E. Khan and P. Venkatapuram, "NeuFuz: Neural
1.o
Network Based Fuzzy Logic Design Algorithms,"
0.8 FUZZ-IEE93 Proceedings, vol. 1, pp. 647-654,
San Francisco, California, March 28 - April 1,
0.6 1993.

0.4 E. Khan, "Neural Network Based Algorithms For


Rule Evaluation & Defuzzification in Fuzzy Logic
0.2 Design," WCNN93 Proceedings, vol. 2, pp. 31-
38, July 11-15, 1993.
0.0
1.o 4.0 7.0
E. Khan, "NeuFuz: An Intelligent Combination of
Figure 5b: Membership Functions pqt)(X(t)) for the Fuzzy Logic with Neural Nets," IJCN"93
fuzzy present state x(t) Proceedings, vol. 3, pp. 2945-2950, Nagoya,
Japan, October 25-29,1993.
5. Conclusions
2. Kohavi, Switching and Finite Automata
The main objective of this work is to show that a Theory. New York, NY:McGraw-Hill Publishing
FFSM can be implemented using a neural fuzzy Company, 1978.
system, namely, NeuFuz. The experimental results
show that the proposed approach can be effectively E. H. Mamdani, "Twenty years of Fuzzy Control:
used especially when the cost is a primary concem. Experiences Gained and Lessons Learnt," FUZZ-
The main advantage of this approach is that the IEEE93 Proceedings, vol. 1, pp. 339-344, San
fuzzification of the states and the input result in the Francisco, California, March 28 - April 1,1993.
reduction of memory size that is required to implement
the FFSM in a microcontroller. Besides, there is no
need to write a program (or design hardware) to
implement the FFSM.The training data corresponding
to the state transition table can be used to implement
the FFSM directly. This ensures the reliability of the
operation. Also, additional flexibility (to control the
transitions between the states) can be achieved by
modifying the training set (adding, deleting and
changing training data). For instance, changing noise
characteristics can be considered to update the training
data set when a FFSM is employed as an adaptive

1754

11-1

You might also like