\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}

\usepackage{color}
\usepackage{graphicx}
%%\usepackage{epstopdf} 
\DeclareGraphicsExtensions{.pdf,.eps,.png,.jpg,.mps} 

\textheight 210mm
\topmargin 5mm
\textwidth 160mm
\oddsidemargin -2mm

\pagestyle{myheadings}
\markright{(Contemporary Method of Data Processing)}

\newtheorem{formula}{Rule}
\newtheorem{example}{Example}
\newtheorem{exercise}{Exercise}
\newtheorem{algorithm}{Algorithm}
\newtheorem{definition}{Definition}

\makeatletter
\let\c@figure\c@table
\let\p@figure\p@table
\let\cl@figure\cl@table
\let\thefigure\thetable
\makeatother

\begin{document}
\thispagestyle{empty}

\title{{\bf Fuzzy Logic \& Data Processing}\\
{\hspace{.1in}\\
 \large Practice notes for Modern Method of Data Processing (CCOD)\\ in 2013 \\ 
\author{Akira Imada \\
Brest State Technical University, Belarus \\
\hspace*{1in}\\
\hspace*{1in}\\
(last modified on)}}}
\maketitle


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\clearpage
\begin{center}
{\Huge {\bf PART I}} \\ 
\bigskip 
{\Large {\bf Fuzzy Controller}}
\end{center}

\section{Vertual metro}
Let's create a virtual metro system with 2 cars on a loop line with 1000 pixels in which 4 stations
1, 2, 3 and 4 at pixel number 0, 250, 500 and 750, respectively.\\

\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=5cm]{loop.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}



Standard Initial Situations

\begin{itemize}
\item Car-A starts at the station "1" while Car-B at "3" both with initial speed 5 pixels at one time
          every time steps speed will be changed at random either by +1, -1, or no-change.
\item Car-A starts at "1" with speed 1,2,3,4,5,5,5..., while car-B at "3" with 2,4,6,8,10,10,10,... Keep them move until crash.
   \begin{itemize}
   \item[*] Or, when distance to the front car becomes less than, say, 20, 
            then speed of car behind shouold -2 each time till stop, 
            and then wait 10 steps of time and start again like before 
            1 -> 2 -> ... -> 10 -> 10 -> ... 
   \end{itemize}
\end{itemize}

\color{blue}
Excersize\\
* Speed v \& distan r to the car in front of each car should be shown on the screen.
\color{black}

\clearpage
\section{Membership functions}
Design 3 sets of five membership functions\\

E.g., Speed => Very Slow, Slow, Medium, Fast, Very Fast 

\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=5cm]{membership-five.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}


\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=5cm]{membership-speed.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}


\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=5cm]{membership-distance.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}


\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=5cm]{membership-break.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}

\clearpage
\section{Fuzzy Arithmetics}

Excersize\\
Create system whose output is membership value
             when we give 3 input of speed, distance, break
        Then give me 11 such examples of data, such as
             (speed=13, distance=53, break=7 => membership=0.23)
        Hopefully systematically chose 10 ses of data, i.e.,
                                            speed is 10, distance is 20 then give me membership



\clearpage
\section{Rule set}
Design our set of 10 rules of "IF -- AND -- Then --\\

E.g. IF speed is fast AND distance is medium THEN break is weak.\\


\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=2.5cm]{blackbox.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}



\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=2.5cm]{blackbox-2.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}



Some rules are likely then large membership value, while others lesslikely and small membership value.


\clearpage
\section{defuzification}

\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=2.5cm]{seasaw.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}




\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=3cm]{seasaw-2.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}


\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=3cm]{seasaw-3.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}



\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=5cm]{seasaw-9.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}



\section{speed \& distance vs. break}



\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=2.5cm]{blackbox-3.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}



\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=5cm]{xyz.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}



\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\clearpage
\begin{center}
{\Huge {\bf PART I}} \\ 
\bigskip 
{\Large {\bf Fuzzy Set Arithmetics}}
\end{center}

\section{Fuzzy Set Theory}

\subsection{Fuzzy set vs. Crisp set}
\begin{itemize}
\setlength{\itemsep}{0pt}
\item Examples of crisp set
   \begin{itemize}
   \item[$\star$] $0<x<10$
   \item[$\star$] x=12
   \end{itemize}
\item Examples of fuzzy set
   \begin{itemize}
   \item[$\star$] \{$x$ is much smaller than 10\}
   \item[$\star$] \{x is close to 12\}
   \item[$\star$] Beer is either of \{very-cold, cold, not-so-cold, warm\}
   \end{itemize}
\end{itemize}

\subsubsection{Membership function}
{\it How x is likely to be A} is expressed by a function called {\it membership function}. Usually it is described as $\mu_{A}(x)$.\\

\noindent
For example, a possible membership function for a fuzzy expression \{x is close to 12\} will be
\begin{equation}
\mu (x) = \frac{1}{1 + (x-12)^2}
\end{equation}
See Figure \ref{fig:membership-ex}.

\begin{figure}[hbtp]
\begin{center}
\includegraphics[width=7cm,height=4cm]{membership-1.jpg}
\includegraphics[width=7cm,height=4cm]{membership-2.jpg}
\caption{Examples of membership function \{$x$ is much smaller than 10\} (right) and
\{x is close to 12\} (left).} 
\label{fig:membership-ex}
\end{center}
\end{figure}


\subsubsection{AND and OR in Fuzzy Logic}
In the logic of crisp set  $A$ $and$ $B$ and $A$ $or$ $B$ are defined as in Figure \ref{fig:and-or-crisp}.

\begin{figure}[hbtp]
\begin{center}  
\includegraphics[width=10cm,height=3.5cm]{and-or-crisp.jpg}
\caption{AND and OR in crisp set.}
\label{fig:and-or-crisp}
\end{center}
\end{figure}

\noindent
In Fuzzy Logic, on the other hand, the membership function of $A$ $and$ $B$ and $A$ $or$ $B$ are specified in various way,
but most popular ones are:

\begin{equation}
\mu_{A \cap B}(x) = \min \{\mu_A(x), \mu_B(x)\}
\end{equation}
and
\begin{equation}
\mu_{A \cup B}(x) = \max \{\mu_A(x), \mu_B(x)\},
\end{equation}
respectively.

\begin{figure}[hbtp]
\begin{center}  
\includegraphics[width=10cm,height=3.5cm]{and-or-fuzzy.jpg}
\caption{AND and OR in fuzzy set.}
\label{fig:and-or-crisp}
\end{center}
\end{figure}

\noindent
To be more concrete the membership function of {\it x is closer to 4 AND/OR x is closer to 5} is like a Figure \ref{fig:fuzzy-and-or}.\\

\begin{figure}[hbtp]
 \begin{center}  
\includegraphics[width=5cm,height=2.5cm]{and.jpg}
\includegraphics[width=5cm,height=2.5cm]{or.jpg}
\caption{Membership function of {\it x is closer to 4 OR x is closer to 5}}
\label{fig:fuzzy-and-or}
\end{center}
\end{figure}

%% \noindent
%% Does it look strange? Maybe. Then, many different defenitions have been proposed so far, {\it e.g.} by Lucasiewics:
%% 
%% \begin{equation}
%% \mu_{A \cap B}(x) = \max \{1, \mu_A(x)+\mu_B(x)\}
%% \end{equation}
%% and
%% \begin{equation}
%% \mu_{A \cup B}(x) = \min \{1, \mu_A(x)+ \mu_B(x)\},
%% \end{equation} %% respectively.\\

\noindent
{\bf $\bullet$ Very cold or pretty cold beer.} ($\mu(x)$ is defined on temperature).\\
Assume we like very cold beer or pretty cold beer and now we have a beer the temperature of which is 3 degree. Then how is the beer likely to be our prefered one? 

\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=8cm,height=4cm]{cold-beer.jpg}
 \end{center}
\end{figure}

\noindent
Note that this operation of {\it OR} was possible because both of the two membership function is defined 
on the same domain {\it temperature}. Then what if two membership functions are defined on different domains, such as age and height?\\

%% \noindent
%% Then, how we visualize membership function unless the function is defined more than one 
%% as above two examples?\\

\noindent
{\bf $\bullet$ Young and tall.} \\

\noindent
For example,
\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=5cm]{young-and-tall.jpg}
 \end{center}
\end{figure}

\noindent
We cannot draw the membership function of {\it young and tall} on the 2-dimensional coordinate any more.\\

\noindent
(1) 3-D graphic (z = $\mu$ is defined on x = age and y = height)\\

\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=5cm]{y-and-tall-2d.jpg}
 \end{center}
\end{figure}

\noindent
(2) Matrix representation
koko
\begin{table}[h]
\begin{center}
\begin{tabular}{c | c c c c c c c c c c c} \hline\hline
height $\setminus$ age & 0 & 10 & 20  & 30 & 40 & 50 & 60 & 70 & 80 & 90 & 100 \\ \hline
150 &\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}\\ 
160 &\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}\\
170 &\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}\\
180 &\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}\\
190 &\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}&\hspace{.1in}\\ \hline \hline
\end{tabular} 
\end{center}
\end{table}





\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=5cm]{y-and-tall-2d.jpg}
 \end{center}
\end{figure}








\subsubsection{IF-Then rule in Fuzzy Logic}

In Fuzzy Logic, the membership of {\it IF A Then B} is specified also in many way.
Here, let's take it as


$\star$ Mamdani's proposal
\begin{equation}
\mu_{A \rightarrow B}(x) = \min \{\mu_A(x), \mu_B(x)\}
\end{equation}


$\star$ Larsen's proposal
\begin{equation}
\mu_{A \rightarrow B}(x) = \mu_A(x)\times\mu_B(x)
\end{equation}

\noindent
{\bf $\bullet$ If he is young then my love to him is strong.} \\

\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=5cm]{love-strong.jpg}
 \end{center}
\end{figure}


\noindent
{\bf $\bullet$ If he is young and tall then my love to him is very strong.} \\

\subsection{How to express multidimensional membershipfunction}


\clearpage
\begin{center}
{\Huge {\bf PART II}} \\ 
\bigskip 
{\Large {\bf Fuzzy Controller}}
\end{center}

\section{Fuzzy Controller}
Let's construct a virtual metro and control trains by fuzzy controller.
\subsubsection*{A goal}
We now assume $x$ is speed of my car, $y$ is distance to the car in front, and
$z$ is how strongly we push brake-pedal. Then let's controll my car with a set of rules, like

\begin{itemize}
\setlength{\itemsep}{0pt}
\item IF $x$ is {\it high} and $y$ is {\it short} THEN $z$ should be {\it strong}
\item IF $x$ is {\it medium} and $y$ is {\it long} THEN $z$ should be {\it medium}
\item IF $x$ is {\it medium low} or $x$ is {\it medium} and $y$ is {\it long} THEN $z$ should be {\it weak}
\item IF $x$ is {\it low} or $x$ is {\it medium low} and $y$ is {\it short} or $y$ is {\it medium hort} THEN $z$ should be {\it medium weak}
\item etc.
\end{itemize}

\noindent
Then the results will be plotted like in the Figure below. %%Fig.~\ref{fig:fuzzy-controller}

\begin{figure}[hbtp]
\begin{center}  
\includegraphics[width=10cm,height=5cm]{objectives.jpg}
\caption{An example of the goal of Fuzzy controller}
\end{center}
\end{figure}

\subsection{Virtual metro system with two trains in a loop line}
We study Fuzzy Controllar via a simulation of virutal metro with one loop line on which two Train A and B run. To simplify we don't assume stations. That is, both trains always run. The speed of these trains
are denoted as $x_A$ and $X_B$. The distance from train A to train B is denoted as $y_A$ and from train B to train A is $y_B$. Note that $x_A+y_B$ is constant (length of the loop line). Speed will be controlled by the distance to the train in front via its break. The shorter the distance, the storonger the break in order to avoid a collision.

\color{red}
\begin{exercise}
Create your own simulation of metro with one loop on which two trains A and B run, using graphics. 6 parameters $x_A$, $x_B$, $y_A$, $y_B$, $z_A$, $z_B$, should also be desplayed on the screen. The simulation might be started with $x_A=x_B$, $y_A=y_B$, $z_A=z_B=0$.
\end{exercise}
\color{black}


\begin{figure}[hbtp]
\begin{center}  
\includegraphics[width=7.5cm,height=4cm]{Scr_1.jpg}
\includegraphics[width=7.5cm,height=4cm]{train1.jpg}
\caption{An example of a metro line. (Left) a standard implementation of a loop-line with two trains by Moroz Andrey.  (Right) Four trains by Dvornichenko Valeriy.}
\end{center}
\end{figure}


\begin{figure}[hbtp]
\begin{center}  
\includegraphics[width=15cm,height=4cm]{mari-metro.jpg}
\caption{An example of a more complicated metro lines by Slusareva Maria (2012).}
\end{center}
\end{figure}



\subsection{Let's design a set of rules for driving a train}

\begin{figure}[hbtp]
\begin{center}  
\includegraphics[width=10cm,height=7cm]{speed.jpg}
\caption{Membership function of x.}
\end{center}
\end{figure}


\begin{figure}[hbtp]
\begin{center}  
\includegraphics[width=10cm,height=7cm]{distance.jpg}
\caption{Membership function of y.}
\end{center}
\end{figure}

\begin{figure}[hbtp]
\begin{center}  
\includegraphics[width=10cm,height=7cm]{break.jpg}
\caption{Membership function of z.}
\end{center}
\end{figure}

\subsubsection{An example of set of 9 rules to control break strength}
\begin{center}
IF X=FAST AND Y=SHORT  THEN  Z=STRONG\\
OR\\
IF X=FAST AND Y=MEDIUM THEN  Z=WEAK\\
OR\\
IF X=MEDIUM AND Y=SHORT THEN  Z=MEDIUM\\
OR\\
IF X=MEDIUM AND Y=MEDIUM THEN  Z=STRONG\\
OR\\
IF X=SLOW AND Y=SHORT THEN  Z=STRONG\\
...\\
etc.\\
\end{center}

\subsection{How to construct a membership function of each rule}
%%	    IF X AND Y THEN Z => min{\mu_{X},\mu_{Y}}\times mu_{Z}
%%		EX. x = 20 , y= 10 z = 3 => mu = ( )
%%	In this way every pair of (x,Y) calculate value of mu_Z  => draw graph mu vs z => calculate center of gravitiy of this graph this z = break strenggh for the pair (x,y)
%%	=> repeat this for every pair of (x,y)

\subsection{Membership function of Z under all possible pair of (X and Y)}
%%   Ex. membership function under one rule out of nine rules



Let's assume our rules are
\begin{center}
IF x=MEDIUM AND y=MEDIUM then z=MEDIUM \\
OR \\
IF x=FAST AND y=SHORT then z=STRONG
\end{center}
\noindent
Then the membership function of these two rules is
\begin{displaymath}
\max\{\min\{\mu_{medium}(x)\cdot\mu_{medium}(y),\mu_{medium}(z)\},min\{\mu_{fast}(x)\cdot\mu_{short}(y),\mu_{strong}(z)\}\}
\end{displaymath}

\noindent
For example, let's calculate when $x=45$ and $y=70$

\begin{table}[h]
\begin{center}
\begin{tabular}{c c c c c c c c c c} \hline\hline
z        & 1      & 2      & 3      & 4      & 5      & 6      & 7      & 8      & 9      \\ \hline
$\mu(z)$ & 0.0000 & 0.0000 & 0.5000 & 0.5625 & 0.5000 & 0.5625 & 0.5625 & 0.5625 & 0.5625 \\ \hline \hline
\end{tabular} 
\end{center}
\end{table}

\noindent
Thus if every $\mu(z)$ is calculated for all the possinble combination of $x$ and $y$, we can draw a 3D plot such as

\begin{figure}[hbtp]
\begin{center}  
\includegraphics[width=10cm,height=5cm]{slice.jpg}
\caption{An example of the goal of Fuzzy controller}
\end{center}
\end{figure}




\subsection{Defuzzification}
%% Fig. if this case => but case now is
\begin{figure}[hbtp]
\begin{center}  
\includegraphics[width=10cm,height=2cm]{defuzzify.jpg}
\caption{An example of the goal of Fuzzy controller}
\end{center}
\end{figure}



\clearpage
\begin{center}
{\Huge {\bf PART III}} \\ 
\bigskip 
{\Large {\bf Fuzzy Data Mining}}
\end{center}

\section{What is data mining}

\section{Classify data by a rule set}
Assume we classiy $M$ data to be classified by using $N$ features.
\begin{displaymath}
x_1, x_2, x_3, \cdots, x_N.
\end{displaymath} 
A rule such as 
\begin{displaymath}
\mbox{IF} x_1 = A_1 \mbox{ AND } x_2 = A_2, \mbox{ AND } \cdots, \mbox{ AND } x_N = A_N 
\mbox{ THEN class is } \omega_p.  
\end{displaymath} 
classifies the data to one class $\omega_p$.\\

\noindent
$A_i$ is called attribute. For instance, (i) IF $x_i=30$, (ii) IF $15<x_i<20$, (iii) IF $x_i$ is Large, 
or (iv) IF $x_i$ is Female, etc. The first two are called {\it crisp}, second is {\it fuzzy}, and fourth is called {\it categorical}. Let's take an example.
\begin{displaymath}
\mbox{IF} x_1 = 20g \mbox{ AND } 10cm<x_2<20cm \mbox{ AND } x_3 = Green,  \mbox{ AND } x_4 = Fruits
\mbox{ THEN this is } apple.  
\end{displaymath} 




\section{A benchmark -- Iris database}
\noindent
As an example target here, we classify Iris flowers. Iris flower dataset\footnote{University of California Urvine Machine Learning Repository.\\ ics.uci.edu: pub/machine-learning-databases.} is made up of 150 samples consists of three species of iris flower, that is, {\it setosa, versicolor} and {\it virginica}.  Each of these three families includes 50 samples.  Each sample is a four-dimensional vector representing four attributes of the iris flower, that is, {\it sepal-length, sepal-width, petal-length}, and {\it petal-width}. All data are given as crisp as below.\\

\begin{figure}[hbtp]
\begin{center}  
\includegraphics[height=3cm]{iris-0.jpg}
\end{center}
\end{figure}

\begin{table}[h]
\begin{center}
\begin{tabular}{c c c c l} \hline\hline
 $x_1$& $x_2$& $x_3$& $x_4$& class            \\ \hline
 0.65 & 0.80 & 0.20 & 0.08 &   1 (Setosa)     \\
 0.62 & 0.68 & 0.20 & 0.08 &   1 (Setosa)     \\
 0.59 & 0.73 & 0.19 & 0.08 &   1 (Setosa)     \\
 0.89 & 0.73 & 0.68 & 0.56 &   2 (Versicolor) \\  
 0.81 & 0.73 & 0.65 & 0.60 &   2 (Versicolor) \\
 0.87 & 0.70 & 0.71 & 0.60 &   2 (Versicolor) \\
 0.80 & 0.75 & 0.87 & 1.00 &   3 (Virginica)  \\
 0.73 & 0.61 & 0.74 & 0.76 &   3 (Virginica)  \\
 0.90 & 0.68 & 0.86 & 0.84 &   3 (Virginica)  \\ \hline \hline
\end{tabular} 
\end{center}
\end{table}

\noindent
Our mission is to train our classifiers with known data shown in Appendix as {\it "data for training"} and then evaluate how good is the classifieyrs with {\it "data for checking"} also shown in appendix.\\

\noindent
Evaluation is how the system appropriately classifies 69 data. Ask system which family by giving 69 data one by one. Score is incremented if the result is correct. Hence the maximum score is 69 and minimum is 0. Please note that even random guessing would score one out of three. So score 23 might be the most stupid classifier.\\

\noindent
What you should show me are (1) run the algorithm and result of input x1, x2, x3, and x4 (2) a rule set, and (3) success rate (true-positive, true-negative, false-positive, false-negative).\\

\noindent
For example
\begin{displaymath}
\mbox{IF} 0.81 \le x_1 \le 0.89 \mbox{ AND } 0.70 \le x_1 \le 0.73 \mbox{ AND } 0.68 \le x_1 \le 0.71  \mbox{ AND } 0.56 \le x_1 \le 0.60 x
%% \mbox{ THEN this is } Versicolor
\end{displaymath}
\begin{displaymath}
%% \mbox{IF} 0.81 \le x_1 \le 0.89 \mbox{ AND } 0.70 \le x_1 \le 0.73 \mbox{ AND } 0.68 \le x_1 \le 0.71  \mbox{ AND } 0.56 \le x_1 \le 0.60 \\
 \mbox{ THEN this is } Versicolor
\end{displaymath}

\noindent
classifies $x_1=0.89$, $x_2=0.73$, $x_3=0.68$, $x_4=0.56$ properly to Versicolor while
 $x_1=0.65$, $x_2=0.80$, $x_3=0.20$, $x_4=0.08$ and $x_1=0.80$, $x_2=0.75$, $x_3=0.87$, $x_4=1.00$ are not.\\


\begin{figure}[hbtp]
\begin{center}  
\includegraphics[width=16cm,height=4cm]{mari-rules.jpg}
\caption{An example of a set of the simplest four rules. By Slusareva Maria (2012).}
\end{center}
\end{figure}


\begin{figure}[hbtp]
\begin{center}  
\includegraphics[width=5cm,height=5cm]{mari-class2.jpg}
\includegraphics[width=5cm,height=5cm]{mari-persent2.jpg}
\caption{Example of applying a test data to the rule and its statistics. By Slusareva Maria (2012).}
\end{center}
\end{figure}




\noindent
So far so good, but what if the region overlaps with each other between more than two spieces? Or, what if unknown somewhat irregular data are given?

\subsubsection{Evaluation of how good is a rule}
The rule for class 1 should accept all data of class 1, but at the same time this rule should reject all data of class 2 and class 3. So count (i) how many data from class 1 are successfully accepted, and then (ii) how many data from class 2 are successfully rejected and (iii) how many data from class 2 are successfully rejected.


\subsection{By Genetic Algorithm}
Let's the rule is like
\begin{center}
IF $a_1<x_1<a_1+\delta_1$ AND $a_2<x_2<a_2+\delta_2$ AND $a_3<x_3<a_3+\delta_3$ AND $a_4<x_4<a_4+\delta_4$ THEN class is $p$.
\end{center}
Then our chromosome will be like
\begin{center}
($a_1$ $\delta_1$ $a_2$ $\delta_2$ $a_3$ $\delta_3$ $a_4$ $\delta_4$) 
\end{center}
where if $a_i+\delta_i>1$ then we replace the value with 1. For example,
\begin{center}
(0.23 0.41 0.52 0.81 0.89 1.00 0.11 0.72) 
\end{center}
Create 40 such a chromosome at random which constract a population of the first generation. Then evolve the population with uniform chrossover and mutation under trancate selection with the target being the family 1. Then repeat this with family 2 and 3.\\

\noindent
Probably one rule for one family is not enough. Therefore a Multi Objective Optimization will be necessary.\\  

\clearpage
\begin{algorithm}
\begin{itemize}
\setlength{\itemsep}{0pt}
\item[(1)] For p=1 to 4
\item[(2)] generate a population of 40 chromosomes at random
\item[(3)] select two parents $p_1$ and $p_2$ at random.
\item[(4)] create child $c$ by uniform crossover and mutation
\item[(5)] If distance($c$, $p_1$) $<$ distance($c$, $p_2$) and fitness($c$>fitness($p_1$)\\
      Then replace $p_1$ with $c$
\item[(6)] ElseIf distance($c$, $p_1$) $>$ distance($c$, $p_2$) and fitness($c$>fitness($p_2$)\\
      Then replace $p_2$ with $c$
\item[(7)] Repeat (3)-(6) until all the chromosom is replaced
\item[(8)] Repeat (3)-(7) until all the chromosom never be changed
\item[(9)] End For
\end{itemize}
\end{algorithm}

\subsubsection{Fitness}
Fitness might be evaluated by
\begin{equation}\label{eq:true_positive}
f = \frac{TP}{TP+FN}\times \frac{TN}{FP+TN}
\end{equation}
\noindent
where $TP$ stands for true-positive, $FN$ stands for false-negative, $TN$ stands for true-negative, and $FP$ stands for false-positive, and true-positive is the number of cases covered by the rule that have the class predicted by the rule; false-positives is the number of cases covered by the rule that have a class different from the class predicted by the rule; false-negatives is the number of cases that are not covered by the rule but that have the class predicted by the rule; true-negatives is the number of cases that are not covered by the rule and do not have the class predicted by the rule.

\clearpage
\subsubsection{Result to be shown}
\begin{table}[h]
\begin{center}
\begin{tabular}{c c c c c c c} \hline\hline
\hspace*{0.1in}&
\multicolumn{2}{l}{Setosa}    &\multicolumn{2}{l}{Versicolor}  &\multicolumn{2}{l}{Virginica}\\
\hspace*{0.1in} & yes & no & yes & no  & yes & no             \\ \hline
rule-01 for class 1   & 100 & 0  & 0   & 100 & 0   & 100      \\
rule-02 for class 1   & 100 & 0  & 0   & 100 & 0   & 100      \\
rule-03 for class 1   & 100 & 0  & 0   & 100 & 0   & 100      \\
rule-04 for class 1   & 100 & 0  & 0   & 100 & 0   & 100      \\ \hline
rule-05 for class 2   & 0 & 100  & 100 & 0   & 0   & 100      \\
rule-06 for class 2   & 0 & 100  & 100 & 0   & 0   & 100      \\
rule-07 for class 2   & 0 & 100  & 100 & 0   & 0   & 100      \\
rule-08 for class 2   & 0 & 100  & 100 & 0   & 0   & 100      \\ \hline
rule-09 for class 3   & 0 & 100  & 0   & 100 & 100 & 0        \\
rule-10 for class 3   & 0 & 100  & 0   & 100 & 100 & 0        \\
rule-11 for class 3   & 0 & 100  & 0   & 100 & 100 & 0        \\ 
rule-12 for class 3   & 0 & 100  & 0   & 100 & 100 & 0        \\ \hline \hline
\end{tabular} 
\end{center}
\end{table}






\clearpage
\subsection{Fuzzy approach}

\begin{figure}[hbtp]
\begin{center}  
\includegraphics[height=5cm]{membership-5.jpg}
\end{center}
\end{figure}


\clearpage
\subsection{Immune approach 1 - exhaustive search}

\begin{algorithm}
\begin{itemize}
\setlength{\itemsep}{0pt}
\item[(1)] For $\omega$ = 1 to 3
\item[(2)] For i = 1 to 40
\item[(3)] generate a rule
\item[(4)] if the rule properly predict the family keep it in the repertoire\\
otherwise discard.
\item[(5)] repeat (2) to (4)
\item[(6)] repeat (1) to (5)
\end{itemize}
\end{algorithm}

\begin{figure}[hbtp]
\begin{center}  
\includegraphics[height=6cm]{exhaustive.jpg}
\end{center}
\end{figure}

\clearpage
\subsection{Immune approace 2 - Clonal Selection}
This algorithm is proposed by ... for the purpose of pattern classification being based on the algorithm called CLONALG proposed by ... for the purpose of pattern recognition.\\

\begin{algorithm}
\noindent
{\bf Artificial Cronal Selection algorithm}\\
%% CLONALG (paraphrased by me)
Assume we have a set of Antigens Ag\footnote{Here we take each of three different iris flowers as antigen, that is, we have three Antigens called Setosa, Versicolor, and Virsinica.}. 
\begin{itemize}
\setlength{\itemsep}{0pt}
\item[1.] Generate an initial population of $N$ antibodies $Ab$ 
\item[2.] Select an antigen $Ag_i$ 
\item[3.] For every member of $Ab$ calculate its affinity to the $Ag_i$
\item[4.] Select the $n$ highest affinity antibodies and generate a number of clones for each antibody in proportion to its affinity and construct a new population $C^i$ (a population specifically for $Ag_i$)
\item[5.] Mutate every member of $C^i$ with a probability being inversely proportional to its affinity. Let's call this population a mature population $C^{i*}$
\item[6.] Measure again affinity of the member $C^{i*}$ to the $Ag_i$. (If its affinity is greater than the current memory cell $Abm_{i}$ it become the new memory cell.
\item[7.] (a) Replace $p$ highest affinity antibodies in $Ab$ with $p$ highest affinity matured antibodies in $C^{i*}$\\
   (b) Replace $(N-p)$ low affinity antibodies in $Ab$ with a new set of $(N-p)$ random antibodies.
\item[8.] Repeat 2-7 for all antigens $Ag_i$ (i=1, 2, ... , M)
\item[9.] Repeat 1-8 for all different antigens\footnote{That is, Setosa, Versicolor, and Virsinica.}.
\end{itemize}
\end{algorithm}

\noindent
Thus we can create $N$ mature antibody population $C^{i*}$ for each of antigen $Ag_i$.
And one memory cell for each antigen.

\clearpage
\subsection{Ant Colony Optimization (ACO) Approach}
This subsection is edited from G. Sarigiannidis\footnote{G. Sarigiannidis ''Discussion on the implementation of the Ant Colony System for the Traveling Salesman Problem.'' Delft University of Technology}.\\

%% The ant who is in the node $i$ chooses the next node to move from a set of possible nodes directly reachable with a probability $p_{ij}$ which are pre-specified in advance a run constant during a run, by considering (i) $\eta_{ij}$ -- how the path to the node $j$ looks good (called heuristic term) and (ii) $\tau_{ij}$ -- how the path accumulate pheromon those previous ants left.

\subsubsection{ACO in general}
%% \subsubsection{TSP by ACO}
%% In order to understand how Ant Colony Optimization works, let's take a brief look at its application to the Traveling Salesperson Problem. We now assume $N$ cities that a salesperson must visit once and only once. Now imagine $N$ ants are assigned to each of those $N$ cities -- one ant at one city. The following parameters are to be used.\\

%% \noindent
%% $\star$ probability for one ant at node $i$ to choose node $j$ \\
%% \begin{displaymath}
%% p_{ij} \propto \eta_{ij} \tau_{ij}^{\beta}
%% \end{displaymath}

%% \noindent
%% where $\beta (>0)$ determines the relative importance of pheromone versus heuristics, and
%% $\eta$ is called {\it heuristic parameter}. The larger value, the more preferable. In the TSP
%% $\eta_{ij}$ simply takes a value  $1/d_{ij}$ where $d_{ij}$ is the distance between city $i$ and city-$j$.
%% $\tau$ is called {\it pheromone density} and updated during a run in the following way.

%% \subsubsection{Data classification}
%% <condition> are all predefiend manually
%% each ant found a fixed format of rule.
%% Rule will  be created from one rule to the next
%% how good is the solution

\begin{figure}[hbtp]
\begin{center}
   \includegraphics[width=2cm,height=1cm]{ant.jpg}
\end{center}
\end{figure}

\begin{figure}[hbtp]
\begin{center}
   \includegraphics[width=10cm,height=6cm]{how-shortest.jpg}
\end{center}
\end{figure}


\noindent
{\bf Which path the ants should choose}\\
Each ant who is at the city $s$ choose the next city $j$ from $J(s)$ -- its not-yet-visited-city from city $s$ -- with a probability:
\begin{displaymath}
p_{sj} \propto \tau_{sj}(t)\{\eta(s,j)\}^{\beta}.
\end{displaymath}
Or, to normalize it:
\begin{displaymath}
p_{sj} = \frac{\tau_{sj}(t)\{\eta(s,j)\}^{\beta}}
             {\sum_{j \in J(s)} \tau_{ij}(t)\{\eta(s,j)\}^{\beta}}
\end{displaymath}
\noindent
where $\tau_{ij}(t)$ is the amount of pheromone on the path from city $s$ to city $j$, $\eta(s,j) = 1/d_{sj}$ while $d_{sj}$ is the distance between city $s$ and city $j$, and $\beta$ is a parameter which determines the importance of balance between pheromone and distance. \\

\noindent
{\bf Local pheromon update}\\
\noindent
When all the ants reach the next city, the amount of pheromon is updated as:
\begin{displaymath}
\tau_{rs} = (1 - \rho) \cdot \tau_{rs} + \rho \cdot \tau_0
\end{displaymath}

\noindent
{\bf Global pheromon update}\\
After all ants have completete their tours, they remain to the position for the next iteration, and the global pheromone updaite is applied to all the path $(r,s)$ one by one as follows:
\begin{displaymath}
\tau_{rs}  = (1-\alpha)\cdot\tau_{rs}+ \alpha \cdot \Delta\tau_{rs} 
\end{displaymath}
\noindent
where $\Delta \tau_{rs} = 1/(L_{\mbox{\tiny BS}})$ if the path $(r,s)$ belongs to the best tour so far, otherwise 0 where $L_{\mbox{\tiny BS}}$ is the minimum total tour length found so far. 
An interpretation of $0<\alpha<1$ can be the pheromone decay parameter, that is,  evaporation rate of pheromone.\\


\noindent
{\bf Parameters}\\
\noindent
Typically, the number of ants is 10, and the other parameters are $\beta = 2$, $\alpha = \rho = 0.1$, $\tau_0 = 1/(n \cdot L_{\mbox{\tiny NN}})$ where $L_{\mbox{\tiny NN}}$ is the total tour length by Nearest Neighbor heuristic and $n$ is a number of cities.\\

\noindent
The ant who is in the node $i$ chooses the next node to move from a set of possible nodes directly reachable with a probability $p_{ij}$ which are pre-specified in advance a run constant during a run, by considering (i) $\eta_{ij}$ -- how the path to the node $j$ looks good (called heuristic term) and (ii) $\tau_{ij}$ -- how the path accumulate pheromon those previous ants left.\\

\subsubsection{Traveling Salesperson Problem by ACO}
In order to understand how Ant Colony Optimization works, let's take a brief look at its application to the Traveling Salesperson Problem. We now assume $N$ cities that a salesperson must visit once and only once. Now imagine $N$ ants are assigned to each of those $N$ cities -- one ant at one city. The following parameters are to be used.\\

\noindent
$\star$ probability for one ant at node $i$ to choose node $j$ \\
\begin{displaymath}
p_{ij} \propto \eta_{ij} \tau_{ij}^{\beta}
\end{displaymath}

\noindent
where $\beta (>0)$ determines the relative importance of pheromone versus heuristics, and
$\eta$ is called {\it heuristic parameter}. The larger value, the more preferable. In the TSP
$\eta_{ij}$ simply takes a value  $1/d_{ij}$ where $d_{ij}$ is the distance between city $i$ and city-$j$.
$\tau$ is called {\it pheromone density} and updated during a run in the following way.\\

\clearpage
\noindent
Try to apply the following 6 cities TSP.
\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=5cm]{tsp-by-ant.jpg}
 \end{center}
\end{figure}


%% \tau_0

%% After each ant has chosen the next node of its path, a local pheromone updating rule is applied

%% <local update> ... each time ant reach the next city
%% \tau_{ij} = (1- \rho)tau_{ij} + \rho tau_0
%% Thus algorithm favors the choice of shorter edges and larger amount of pheromone. 


%% After all ants have completed their tours a global phromone updating rule is applied
%% <global update> ... when all ant completed the tour
%% \tau_{ij} = (1- \alpha) \tau_{ij} + \alpha \Delta\tau{i,j}
%% where
%% \Delta\tau{i,j} = L_{so-far-best} if (i,j) belongs to so-far-best and 0 otherwise
%% 0<\alpha<1 is pheromon 

%% beta = 2, alpha = rho = 0.1 and t_p = n times L_{NN}

%% L_{NN} is estimated shortest tour length by the Nearest Neghbotr heuristic e.g. and n is the total number of cities.

\subsubsection{Data Classification by ACO}
We use Iris-flower data again and the rules to classify iris-flower data are described with fuzzy linguistic term. A general form of such rule is: 
\begin{center}
IF $x_1$ is small \& $x_2$ is large \& $\cdots$ THEN $y_1$ is strong \& $y_2$ is weak \& $\cdots$
\end{center}

\noindent
Here, we assume those linguistic terms such as {\it small}, {\it large}, etc for $x_i$, and 
{\it strong}, {\it weak}, etc. for $y_j$ are all pre-defiend by a membership function.\\

\noindent
Remember here how we define, for example, a membership function of 
\begin{center}
IF A \& B THEN C \& D. 
\end{center}

\noindent
Then we can define a membership function of these rules.

\begin{displaymath}
\mu_{A \cup B \Rightarrow C \cup D}. 
\end{displaymath}

\noindent
Our purpose here is to classify iris-flower data with four features into either of three families. So the form of our rule is specifically like:\\


\begin{figure}[hbtp]
\begin{center}
   \includegraphics[width=8cm,height=5cm]{membership-3.jpg}
\caption{Three membership function of {\it "small"}, {\it "medium"}, {\it "large"} for all $x_1$, $x_2$,$x_3$ and $x_4$ in commone.}
\end{center}
\end{figure}

\begin{center}
IF $x_1$ is $A_1$ \& $x_2$ is $A_2$ \& $x_3$ is $A_3$ \& $x_4$ is $A_4$ THEN $y$ is $B_j$ 
\end{center}

\noindent
where $A_i$ is either of {\it small}, {\it medium}, or {large} and $B_j$ is either of 1, 2, or 3.\\

\noindent
Then the number of all possible such rules is $3^4 \times 3 = 243$. Now let's denote IF-part of the $i$-th roule as $R_i$. Now we assign heuristic term for each of those links from $A_i$ to $B_j$ as

\begin{equation}\label{eq:membership_rule}
\eta_{ij} = \mu_{R_i \Rightarrow B_j} (x_1,x_2,x_3,x_4,y_1) 
\end{equation}
\noindent
For example
\begin{displaymath}
\eta_{ij} = \max \min(\mu_{A_1}(x_1), \mu_{A_2}(x_2),\mu_{A_3}(x_3),\mu_{A_4}(x_4))
\end{displaymath}
See Figure \ref{fig:if-part-then-part}.

\begin{figure}[hbtp]
\begin{center}
   \includegraphics[width=8cm,height=2cm]{ant-classify.jpg}
\caption{A schematic diagram of all possible link between IF-part and THEN-part of rule set. Heuristic
term $\eta_{ij}$ are assingend to those links.}
\label{fig:if-part-then-part}
\end{center}
\end{figure}


\begin{figure}[hbtp]
\begin{center}
   \includegraphics[width=8cm,height=5cm]{ant-classify-2.jpg}
\caption{All possible rules are something like this.}
\label{fig:if-part-then-part}
\end{center}
\end{figure}


\noindent
With initial pheromone being arbitrary $\tau_0$, pheromon on the link from $i$ to $j$ is updated every time when one ant walks this link (local update) as

\begin{equation}
\tau_{ij} = (1-\rho) \cdot \tau_{ij} + \rho \cdot \tau_0.
\end{equation}
\noindent
When one ant finish all the $R_i$ pheromon on all the liks are updated (global update) as

\begin{equation}
\tau_{ij} = (1-\rho) \cdot \tau_{ij} + \rho \cdot \Delta_{ij}
\end{equation}

\noindent
where $\Delta_{ij}$ is fitness of the {\it best rule so far found} if the link from $i$ to $j$ belongs to the link of the best rule so far found, and 0 otherwise. Use Eq. (\ref{eq:true_positive}) for fitness calculation of one rule. The calculation is made by using the {\it data for training}. Note that it is this process that the system learn how to classify well.\\

\noindent
The probability of one ant at the node $i$ to choose the link to the node $k$ is as already described:
\begin{displaymath}
p_{ij} = \frac{\tau_{ij}(t)\{\eta(i,j)\}^{\beta}}
             {\sum_{j \in J(i)} \tau_{ij}(t)\{\eta(i,j)\}^{\beta}}
\end{displaymath}
with $\beta$ being, say, 2.\\

\noindent
Now let's denote input-output data set from our 120 training data of iris-flowers as
\begin{displaymath}
{\bf e}^k =(x_1^k,x_2^k,x_3^k,x_4^k,y^k) \hspace{0.3in} k=1,2,\cdots, 120.
\end{displaymath}
Then our rules are like
\begin{center}
$R^s$: IF $x_1$ is large \& $x_2$ is small \& $x_3$ is medium \& $x_4$ is small THEN 2.
\end{center}
\noindent
To be more general
\begin{center}
$R^s$: IF $x_1$ is $A_1^s$ \& $x_2$ is $A_2^s$ \& $x_3$ is $A_3^s$ \& $x_4$ is $A_4^s$ THEN $B^s$. 
\end{center}
\noindent
Then
\begin{equation}\label{eq:maxmin}
\eta_{ij} = \max_{{\bf}e^k}(\min(\mu_{A^i}({\bf x}^k), \mu_{B^j}(y^k)))
\end{equation}
where
\begin{equation}
\mu_{A^i}({\bf x}^k) =\min(\mu_{A_1^i}(x_1^k), \mu_{A_2^i}(x_2^k), \mu_{A_3^i}(x_3^k), \mu_{A_4^i}(x_4^k))
\end{equation}

\noindent
Let me take an example. Assume $s=1$ and
\begin{center}
$R^1$: IF $x_1$ is small \& $x_2$ is small \& $x_3$ is small \& $x_4$ is small THEN 1.
\end{center}
\noindent
That is,
\begin{center}
$A_1^1$ is small, $A_2^1$ is small, $A_3^1$ is small and $A_4^1$ is small. 
\end{center}

\noindent
Then from the iris-flower data for training for $k=1$ 
\begin{center}
$x_1=0.65$, $x_2=0.80$, $x_3=0.20$, $x_4=0.08$ and $y=1$.
\end{center}
\noindent
That is,
\begin{center}
${\bf e}^1$ = (0.65, 0.80, 0.20, 0.08, 1).
\end{center}

\noindent
Corresponding values of membership function 
\begin{center}
$\mu_{small}(0.65)$, $\mu_{small}(0.80)$, $\mu_{small}(0.20)$, $\mu_{small}(0.08)$
\end{center}
\noindent
are obtained from Fig. \ref{fig:membership-3}.\\

\noindent
By repeating this procedure from $k=1$ to $k=120$, and then take the maximum 
in Eq.(\ref{eq:maxmin}) we can obtain each value of $\eta_{ij}$.\\

\noindent
As for $B^s$, they are generally also a fuzzy linguistic value such as {\it strong} and its membership function is defined in the same way as Fig. \ref{fig:membership-3}, but here $B^s$ is integer value 1, 2, or 3, that is {\it singleton}. 
Therefore, for example $\mu_{setosa}(y)=1$ if and only if y=1 otherwise $\mu_{setosa}(y)=0$. 
Similary, $\mu_{versicolor}(y)=1$ if and only if y=2 otherwise $\mu_{versicolor}(y)=0$, 
and $\mu_{virsinica}(y)=1$ if and only if y=3 otherwise $\mu_{virginica}(y)=0$.\\

\noindent
Now we are ready to run an ACO algorithm for Iris-flower classification
\begin{algorithm}[ACO for iris-flower classification]
Initialize $\tau_0$, calculate all $\eta_{ij}$
\begin{itemize}
\setlength{\itemsep}{0pt}
\item[1.] For $k$ = 1 to K.
\item[2.] For $i$ = 1 to 243.
\item[3.] Put ant $k$ to the node $R_i$.
\item[4.] Choose link according to $p_{ij}$ updating $t_{ij}$ locally.
\item[5.] Set THEN-part of the "$R_i$ as $B_j$.
\item[6.] Repeat 2-5.
\item[7.] Update all of the $\tau_{ij}$ globally according to the fitness of the rule obtained..
\item[8.] Repeat 1-7.
\end{itemize}
\end{algorithm}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\clearpage
\begin{center}
{\Huge {\bf PART III}} \\ 
\bigskip 
{\Large {\bf Fuzzy Neural Network with Takagi-Sugeno Model}}
\end{center}

\subsection{A Fuzzy Neural Network Approach}
\noindent
The goal is to classify the data taken from the $n$-dimensional data-set 
into either of the pre-defined $m$ classes.
For the purpose, 
Castellano et al.~\cite{cast}
used the inference mechanism of the zero-order Takagi-Sugeno fuzzy model;
then realized the idea by a fuzzy neural network model.
To train the fuzzy neuronal network, 
they employed
a combination of (i) {\it a competitive learning} to determine the architecture of 
the fuzzy neural network at first and (ii) {\it a gradient descent learning} to optimize 
the synaptic weights afterwards.
We, on the other hand, employ an evolutionary computation technique to train the network,
since we already know the optimal network structure under our current interest,
and as such, our concern is just to obtain 
the solution of weight configuration of the fuzzy neural network.\\

\noindent
In the following three sub-subsections, Takagi-Sugeno fuzzy model, 
a realization of the model by fuzzy neural network, and 
how we optimize the weight of the fuzzy neural network by an evolutionary computation
are described more in detail.

\subsubsection{Takagi-Sugeno Model.}
\noindent
Though Castellano et al.~\cite{cast} stated the method very clearly in their paper,
let us briefly describe it with an intention of making this paper self-contained.
Takagi-Sugeno fuzzy inference model is made up of a set of $H$ rules, such as 
\begin{center}
$R_k$: IF ($x_1$ is $A_1^k$) and $\cdots$ and ($x_n$ is $A_n^k$) \hspace{3in}
\end{center}
\begin{center}
\hspace*{1in}THEN ($y_1$ is $\nu_{k1}$)  and $\cdots$ and ($y_m$ is $\nu_{km}$)
\end{center}
where $R_k$ is the $k$-th rule $(k = 1, \cdots H)$, 
$x_i$ denotes the $i$-th variable of the input data $(i=1, \cdots, n)$,
$y_j$ denotes the $j$-th output variable $(j=1, \cdots, m)$,
$A_i^k$ denotes a fuzzy set which is usually expressed by a linguistic term
such as {\it ``Medium-Large''} but here expressed by a shape of membership function
defined one by one on the corresponding input variable,
and $\nu_{kj}$ denotes a fuzzy singleton each defined on the output variables 
indicating the likeliness of how the input belongs to
the $j$-th class according to the  $k$-th rule.\\

\noindent
$A_i^k$ is defined by Gaussian membership functions
\begin{displaymath}
\mu_{ik}(x_i) = \exp \{ -(x_i - w_{ik})^2/\sigma_{ik}^2\}.
\end{displaymath}

\noindent
Then defuzzification for an input ${\mbox{\bf x}}^0 = (x_1^0, \cdots, x_n^0)$ 
is via the equation:
\begin{displaymath}
y_j^0 = \{ \sum_{k=1}^H (\mu_k(\mbox{\bf x}^0)\cdot \nu_{kj}) \}/
\sum_{k=1}^H \mu_k(\mbox{\bf x}^0)
\end{displaymath}
where
\begin{displaymath}
\mu_k(\mbox{\bf x}^0) = \prod_{i=1}^n \mu_{ik}(x_i^0)
\end{displaymath}
is the results of application of the Larsen product operator.\\

\noindent
In other words, the procedure of inference is as follows.
When an input $\mbox {\bf x} = (x_1, \cdots x_n)$ is given,
each of the $H$ rules evaluates the {\bf x} and output the likeliness of the class, 
from one class to the next, to which $\mbox {\bf x}$ belongs to.
The evaluation by $k$-th rule of $x_i$ 
is by the corresponding membership function $\mu_{ik}(x_i)$
which is specified by giving two parameters $w_{ik}$ and $\sigma_{ik}$
so that it returns a value ranging from 0 to 1. 
See, e.g., Fig.~1 where
the $i$-th coordinate of the input {\bf x} is evaluated by $A_i^k$,
the $i$-th antecedent of the {\it IF} part of the ${\mbox{Rule}_k}$, which is 
represented by a membership function not by a usual linguistic term like {\it ``Small''}.
The returned membership value in this example in the figure is 0.71, suggesting, say,
``The likeliness of if the variable is ``Medium Large'' is 0.71.''\\

\begin{figure}[h]
 \begin{center}
 %%\epsfig{file=mu-2.eps,width=6cm,height=3cm}
\caption{A fictitious sketch of an evaluation of $x_i$, the $i$-th entry of the input {\bf x}, 
by the $i$-th antecedent part of the $k$-th rule $A_i^k$.}
 \end{center}
\end{figure}
\noindent

Using those $n$ values of $\mu_{ik}(x_i)$,  
each of the $H$ rules calculates $\mu_k(\mbox{\bf x})$,
and finally these $H$ values are combined 
to calculate $m$ values of $y_j$, the resultant defuzzified value 
for each of the $m$ classes.\\

\subsubsection{Fuzzy Neural Network Implementation.}
\noindent
The procedure described in the previous sub-subsection
can be realized  when we assume a neural network architecture
such as depicted in Fig.~2.
The 1st layer is made up of  $n$ input neurons. 
The 2nd layer is made up of $H$ groups of a neuronal structure 
each contains $n$ neurons where
the $i$-th neuron of the $k$-th group has a connection to the $i$-th neuron 
in the 1st layer with a synaptic connection 
which has a pair of weights $(w_{ik},\sigma_{ik})$.
Then $k$-th group in the second layer calculates the value
$\mu_k(\mbox{\bf x})$ 
from the values which are received from each of the $n$ neurons in the first layer. 
The 3rd layer is made up of $m$ neurons each of which collects
the $H$ values from the output of the second layer, that is
$j$-th neuron of the 3rd layer receives the value from $k$-th output in the second layer
with the synapse which has the weight $\nu_{kj}$


\begin{figure}[hbtp]
\begin{center}
   \includegraphics[width=8cm,height=6cm]{fuzzy-nn.jpg}
\caption{Architecture of the proposed fuzzy neural network which infers how 
an input $\mbox {\bf x} = (x_1, \cdots x_n)$ is likely to belong to the $j$-th class 
by generating outputs $y_j$ each of which reflect the degree of the likeliness. 
In this example, a 20-dimension data input will be inferred 
to which of the 3 classes the input belongs  by using 2 rules.}
\end{center}
\end{figure}



\subsubsection{How it learns?}
\noindent
Castellano et al.~\cite{cast} used 
(i) a competitive learning to determine how many rules are needed 
under initial weights created at random.
Then, in order to optimize the initial random weight configuration, 
they use (ii) a gradient method performing the steepest descent on a surface
in the weight space employing the same training data, that is, supervised learning.\\

\noindent
Here, on the other hand, we use a simple genetic algorithm,
since our target space is specific enough to know the network structure in advance, 
i.e., only unique rule is necessary.
Our concern, therefore, is just  obtaining the solution of weight configuration of the network.
That is to say, all we want to know is a set of parameters
$w_{ik}$, $\sigma_{ik}$ and $\nu_{kj}$ 
$(i= 1, \cdots n)$, $(k= 1, \cdots H)$, $(j= 1, \cdots m)$ 
where $n$ is the dimension of data, $H$ is the number of rules, and 
$m$ is the number of outputs. 
Hence our chromosome has those $n \times H \times m$ genes.
Starting with a population of chromosomes whose genes are randomly created,
they evolve under {\it simple truncate selection} where higher fitness chromosome are chosen,
with {\it uniform crossover} and occasional {\it mutation} by 
replacing some of a few genes with randomly created other parameters,
expecting higher fitness chromosomes will be emerged. 
These settings are determined by trials and errors experimentally.




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\clearpage
\begin{center}
{\Huge {\bf PART IV}} \\ 
\bigskip 
{\Large {\bf Fuzzy Relation}}
\end{center}

\section{Fuzzy Relation}
In this section we study fuzzy expressions such as  "at least middle-aged," “brighter than average," “more or less expensive" and  "younger than about 20." 

%% “tall or taller than tall” can be called “at least tall”.

First, let's recall Cartesian product $X \times Y$ in which both $X$ and $Y$ is a set.
Let me take an example. Assume now 
$X=\{1,2\}$ and $Y=\{a,b,c\}$
then $X \times Y = \{(1,a),(1,b),(1,c),(2,a),(2,b),(2,c)\}$.
Then relation is defiened over Cartesian product $X \times Y$, that is, a subset of $X \times Y$. In other words relation is a set of ordered pair in which order is important.\\

\noindent
Generally it is defined over multipel set, like $X_1 \times X_2 \times \cdots \times X_n$, but here we think of only product of two set, and call it {\it binary relation}.\\

\noindent
To visualize we can plot $\mu_R(X,Y)$ 3-D Cartesian space.\\

\noindent
$\star$ Example 1 ... $X=\{1,2\}$, $Y=\{2,3,4\}$, $R: X<Y$\\

\noindent
Let's think of it as a {\it crisp} logic, that is, the value is 1 (yes) or 0 (no). 
Then membership function of this relation will be:

\begin{table}[h]
\begin{center}
\begin{tabular}{c | c c c}      \hline \hline
$X \setminus Y$  & 2 & 3 & 4 \\ \hline
 1               & 1 & 0 & 0 \\
 2               & 1 & 1 & 0 \\
 3               & 0 & 0 & 1 \\ \hline \hline
\end{tabular} 
\end{center}
\end{table}

\noindent
Then what about the relation $R:x \approx y$. Let's think of this example with {\it fuzzy} logic. \\

\noindent
$\star$ Example 2 ... $X=\{1,2\}$, $Y=\{2,3,4\}$, $R: X \approx Y$\\

\begin{table}[h]
\begin{center}
\begin{tabular}{c | c c c}           \hline \hline
$X \setminus Y$  & 2 & 3 & 4      \\ \hline
 1               & 2/3 & 1/3 & 0   \\
 2               & 1   & 2/3 & 1/3 \\
 3               & 2/3 & 1   & 2/3 \\ \hline \hline
\end{tabular} 
\end{center}
\end{table}

\noindent
The values are just examples. Further more we think of $X$ and $Y$ as a continuous values instead of integer. Then membership function is a surface instead of just 9 points, over $X-Y$ coordinate. \\

\noindent
We now proceed to examples where we use fuzzy linguistic expression instead of numbers.\\

\noindent
$\star$ Example 3 ... X = \{green, yellow, red\}, Y = \{unripe, semiripe, ripe\}.\\

\noindent
Imagine an apple. First, with a {\it crisp} logic. A red apple is usually ripe but a green apple is unripe. Thus:

\begin{table}[h]
\begin{center}
\begin{tabular}{c | c c c}           \hline \hline
$X \setminus Y$  & unripe & semiripe & ripe \\ \hline
 green           & 1      & 0        & 0    \\
 yellow          & 0      & 1        & 0    \\
 red             & 0      & 0        & 1    \\ \hline \hline
\end{tabular} 
\end{center}
\end{table}

\noindent
Now, secondly, with a {\it fuzzy} logic. A red apple is {\it provably} ripe, but a green apple is {\it most likely}, and so on. Thus, for example:

\begin{table}[h]
\begin{center}
\begin{tabular}{c | c c c}                     \hline \hline
$X \setminus Y$  & unripe & semiripe & ripe \\ \hline
 green           & 1      & 0.5      & 0    \\
 yellow          & 0.3    & 1        & 0.4  \\
 red             & 0      & 0.2      & 1    \\ \hline \hline
\end{tabular} 
\end{center}
\end{table}

\noindent
These matrices are not necessarily rectangular. For example:\\

\noindent
$\star$ Example 4 ... X = \{Brest, London, BuenosAires\} Y={Tokyo, NewYork, Minsk, Johanesburg} R: very far.\\


\begin{table}[h]
\begin{center}
\begin{tabular}{c | c c c c}                                                           \hline \hline
$X \setminus Y$  & Tokio         & New York      & Minsk         & Johanesburg    \\ \hline
 Brest           & \hspace{.1in} & \hspace{.1in} & \hspace{.1in} & \hspace{.1in}  \\
 London          & \hspace{.1in} & \hspace{.1in} & \hspace{.1in} & \hspace{.1in}  \\
 Buenos Aires    & \hspace{.1in} & \hspace{.1in} & \hspace{.1in} & \hspace{.1in}  \\  \hline \hline
\end{tabular} 
\end{center}
\end{table}

\noindent
Try to fill those blancs by yourself.


%% R1=(x,y)
%% R2=(y,z)

%% R1*R2(x,y) ... 

%% (X,Z) max{min{mu_R1(x,Y), mu_R2(Y.Z)} ... MAXMIN
%%       y 

%% (X,Z) max{max{mu_R1 x mu_R2(Y,Z)}     ... MAXPROD
%%       y

%% (X,Z) max{(mu_R1(x,y) + mu_R2(y,z))/2} ... MAXAVG
%%       y

%% R1       unripe  semiripe, ripe 
%% green
%% yellow
%% red

%% R2         sour   sour-sweet  sweet
%% unripe
%% semiripe
%% ripe


%% IF tomato is green THEN sour, less likely sour-sweet, unlikely sweet

%% IF tomato is yellow THEN sour-sweet , possibly sour, possibly sweet

%% IF tomato is red THEN sweet , possibly sour, unlikely sour



%% Now tomato is more or less red  mu_red = 0.8 => whaT is taste?


%% In this way
%% “at least middle-aged”, “brighter than average”, “more or less expensive” and “very tall.” “younger than about 20”,

%% “tall or taller than tall” can be called “at least tall”.



\clearpage
\begin{center}
{\Huge {\bf APPENDIX}} \\ 
\end{center}

\section*{Iris Flower Database}
\subsection*{Data for training - 3$\times$40 = 120 data}
\begin{figure}[hbtp]
\begin{center}  
\includegraphics[height=2cm]{iris-10.jpg}
\includegraphics[height=2cm]{iris-14.jpg}
\includegraphics[height=2cm]{iris-17.jpg}
\end{center}
\end{figure}

\begin{footnotesize}
\begin{table}[h]
\begin{center}
\begin{tabular}{c c c c c c c c c c c c} \hline \hline
\multicolumn{4}{c}{Setosa}    &\multicolumn{4}{c}{Versicolor}  &\multicolumn{4}{c}{Virginica}\\
\hline
$x_1$& $x_2$& $x_3$& $x_4$& $x_1$& $x_2$& $x_3$& $x_4$& $x_1$& $x_2$& $x_3$& $x_4$\\ \hline
0.65 & 0.80 & 0.20 & 0.08 & 0.89 & 0.73 & 0.68 & 0.56 & 0.80 & 0.75 & 0.87 & 1.00 \\
0.62 & 0.68 & 0.20 & 0.08 & 0.81 & 0.73 & 0.65 & 0.60 & 0.73 & 0.61 & 0.74 & 0.76 \\
0.59 & 0.73 & 0.19 & 0.08 & 0.87 & 0.70 & 0.71 & 0.60 & 0.90 & 0.68 & 0.86 & 0.84 \\
0.58 & 0.70 & 0.22 & 0.08 & 0.70 & 0.52 & 0.58 & 0.52 & 0.80 & 0.66 & 0.81 & 0.72 \\
0.63 & 0.82 & 0.20 & 0.08 & 0.82 & 0.64 & 0.67 & 0.60 & 0.82 & 0.68 & 0.84 & 0.88 \\
0.68 & 0.89 & 0.25 & 0.16 & 0.72 & 0.64 & 0.65 & 0.52 & 0.96 & 0.68 & 0.96 & 0.84 \\
0.58 & 0.77 & 0.20 & 0.12 & 0.80 & 0.75 & 0.68 & 0.64 & 0.62 & 0.57 & 0.65 & 0.68 \\
0.63 & 0.77 & 0.22 & 0.08 & 0.62 & 0.55 & 0.48 & 0.40 & 0.92 & 0.66 & 0.91 & 0.72 \\
0.56 & 0.66 & 0.20 & 0.08 & 0.84 & 0.66 & 0.67 & 0.52 & 0.85 & 0.57 & 0.84 & 0.72 \\
0.62 & 0.70 & 0.22 & 0.04 & 0.66 & 0.61 & 0.57 & 0.56 & 0.91 & 0.82 & 0.88 & 1.00 \\
0.68 & 0.84 & 0.22 & 0.08 & 0.63 & 0.45 & 0.51 & 0.40 & 0.82 & 0.73 & 0.74 & 0.80 \\
0.61 & 0.77 & 0.23 & 0.08 & 0.75 & 0.68 & 0.61 & 0.60 & 0.81 & 0.61 & 0.77 & 0.76 \\
0.61 & 0.68 & 0.20 & 0.04 & 0.76 & 0.50 & 0.58 & 0.40 & 0.86 & 0.68 & 0.80 & 0.84 \\
0.54 & 0.68 & 0.16 & 0.04 & 0.77 & 0.66 & 0.68 & 0.56 & 0.72 & 0.57 & 0.72 & 0.80 \\
0.73 & 0.91 & 0.17 & 0.08 & 0.71 & 0.66 & 0.52 & 0.52 & 0.73 & 0.64 & 0.74 & 0.96 \\
0.72 & 1.00 & 0.22 & 0.16 & 0.85 & 0.70 & 0.64 & 0.56 & 0.81 & 0.73 & 0.77 & 0.92 \\
0.68 & 0.89 & 0.19 & 0.16 & 0.71 & 0.68 & 0.65 & 0.60 & 0.82 & 0.68 & 0.80 & 0.72 \\
0.65 & 0.80 & 0.20 & 0.12 & 0.73 & 0.61 & 0.59 & 0.40 & 0.97 & 0.86 & 0.97 & 0.88 \\
0.72 & 0.86 & 0.25 & 0.12 & 0.78 & 0.50 & 0.65 & 0.60 & 0.97 & 0.59 & 1.00 & 0.92 \\
0.65 & 0.86 & 0.22 & 0.12 & 0.71 & 0.57 & 0.57 & 0.44 & 0.76 & 0.50 & 0.72 & 0.60 \\
0.68 & 0.77 & 0.25 & 0.08 & 0.75 & 0.73 & 0.70 & 0.72 & 0.87 & 0.73 & 0.83 & 0.92 \\
0.65 & 0.84 & 0.22 & 0.16 & 0.77 & 0.64 & 0.58 & 0.52 & 0.71 & 0.64 & 0.71 & 0.80 \\
0.58 & 0.82 & 0.14 & 0.08 & 0.80 & 0.57 & 0.71 & 0.60 & 0.97 & 0.64 & 0.97 & 0.80 \\
0.65 & 0.75 & 0.25 & 0.20 & 0.77 & 0.64 & 0.68 & 0.48 & 0.80 & 0.61 & 0.71 & 0.72 \\
\hline
\end{tabular} 
\end{center}
\hfill{(to be cont'd to the next page)}
\end{table}
\end{footnotesize}

\clearpage
\hfill{\Large (cont'd)}
\begin{footnotesize}
\begin{table}[h]
\begin{center}
\begin{tabular}{c c c c c c c c c c c c}\hline
\multicolumn{4}{c}{Setosa}    &\multicolumn{4}{c}{Versicolor}  &\multicolumn{4}{c}{Virginica}\\
\hline
 $x_1$& $x_2$& $x_3$& $x_4$& $x_1$& $x_2$& $x_3$& $x_4$& $x_1$& $x_2$& $x_3$& $x_4$\\ \hline
0.61 & 0.77 & 0.28 & 0.08 & 0.81 & 0.66 & 0.62 & 0.52 & 0.85 & 0.75 & 0.83 & 0.84 \\
0.63 & 0.68 & 0.23 & 0.08 & 0.84 & 0.68 & 0.64 & 0.56 & 0.91 & 0.73 & 0.87 & 0.72 \\
0.63 & 0.77 & 0.23 & 0.16 & 0.86 & 0.64 & 0.70 & 0.56 & 0.78 & 0.64 & 0.70 & 0.72 \\
0.66 & 0.80 & 0.22 & 0.08 & 0.85 & 0.68 & 0.72 & 0.68 & 0.77 & 0.68 & 0.71 & 0.72 \\
0.66 & 0.77 & 0.20 & 0.08 & 0.76 & 0.66 & 0.65 & 0.60 & 0.81 & 0.64 & 0.81 & 0.84 \\
0.59 & 0.73 & 0.23 & 0.08 & 0.72 & 0.59 & 0.51 & 0.40 & 0.91 & 0.68 & 0.84 & 0.64 \\
0.61 & 0.70 & 0.23 & 0.08 & 0.70 & 0.55 & 0.55 & 0.44 & 0.94 & 0.64 & 0.88 & 0.76 \\
0.68 & 0.77 & 0.22 & 0.16 & 0.70 & 0.55 & 0.54 & 0.40 & 1.00 & 0.86 & 0.93 & 0.80 \\
0.66 & 0.93 & 0.22 & 0.04 & 0.73 & 0.61 & 0.57 & 0.48 & 0.81 & 0.64 & 0.81 & 0.88 \\
0.70 & 0.95 & 0.20 & 0.08 & 0.76 & 0.61 & 0.74 & 0.64 & 0.80 & 0.64 & 0.74 & 0.60 \\
0.62 & 0.70 & 0.22 & 0.04 & 0.68 & 0.68 & 0.65 & 0.60 & 0.77 & 0.59 & 0.81 & 0.56 \\
0.63 & 0.73 & 0.17 & 0.08 & 0.76 & 0.77 & 0.65 & 0.64 & 0.97 & 0.68 & 0.88 & 0.92 \\
0.70 & 0.80 & 0.19 & 0.08 & 0.85 & 0.70 & 0.68 & 0.60 & 0.80 & 0.77 & 0.81 & 0.96 \\
0.62 & 0.70 & 0.22 & 0.04 & 0.80 & 0.52 & 0.64 & 0.52 & 0.81 & 0.70 & 0.80 & 0.72 \\
0.56 & 0.68 & 0.19 & 0.08 & 0.71 & 0.68 & 0.59 & 0.52 & 0.76 & 0.68 & 0.70 & 0.72 \\
0.65 & 0.77 & 0.22 & 0.08 & 0.70 & 0.57 & 0.58 & 0.52 & 0.87 & 0.70 & 0.78 & 0.84 \\
\hline
\end{tabular} 
\end{center}
\end{table}
\end{footnotesize}

 
\clearpage
\subsection*{Data for evaluating the system after training - 3$\times$23 = 69 data}

\begin{figure}[hbtp]
\begin{center}  
\includegraphics[height=2cm]{iris-20.jpg}
\end{center}
\end{figure}


\begin{footnotesize}
\begin{table}[h]
\begin{center}
\begin{tabular}{c c c c c c c c c c c c}\hline
\multicolumn{4}{c}{Setosa}    &\multicolumn{4}{c}{Versicolor}  &\multicolumn{4}{c}{Virginica}\\
\hline
 $x_1$& $x_2$& $x_3$& $x_4$& $x_1$& $x_2$& $x_3$& $x_4$& $x_1$& $x_2$& $x_3$& $x_4$\\ \hline
0.63 & 0.80 & 0.19 & 0.12 & 0.70 & 0.59 & 0.64 & 0.48 & 0.85 & 0.70 & 0.81 & 0.96 \\
0.57 & 0.52 & 0.19 & 0.12 & 0.77 & 0.68 & 0.67 & 0.56 & 0.87 & 0.70 & 0.74 & 0.92 \\
0.56 & 0.73 & 0.19 & 0.08 & 0.73 & 0.59 & 0.58 & 0.48 & 0.73 & 0.61 & 0.74 & 0.76 \\
0.63 & 0.80 & 0.23 & 0.24 & 0.63 & 0.52 & 0.48 & 0.40 & 0.86 & 0.73 & 0.86 & 0.92 \\
0.65 & 0.86 & 0.28 & 0.16 & 0.71 & 0.61 & 0.61 & 0.52 & 0.85 & 0.75 & 0.83 & 1.00 \\
0.61 & 0.68 & 0.20 & 0.12 & 0.72 & 0.68 & 0.61 & 0.48 & 0.85 & 0.68 & 0.75 & 0.92 \\
0.65 & 0.86 & 0.23 & 0.08 & 0.72 & 0.66 & 0.61 & 0.52 & 0.80 & 0.57 & 0.72 & 0.76 \\
0.58 & 0.73 & 0.20 & 0.08 & 0.78 & 0.66 & 0.62 & 0.52 & 0.82 & 0.68 & 0.75 & 0.80 \\
0.67 & 0.84 & 0.22 & 0.08 & 0.65 & 0.57 & 0.43 & 0.44 & 0.78 & 0.77 & 0.78 & 0.92 \\
0.63 & 0.75 & 0.20 & 0.08 & 0.72 & 0.64 & 0.59 & 0.52 & 0.75 & 0.68 & 0.74 & 0.72 \\
0.62 & 0.70 & 0.22 & 0.04 & 0.80 & 0.52 & 0.64 & 0.52 & 0.81 & 0.70 & 0.80 & 0.72 \\
0.56 & 0.68 & 0.19 & 0.08 & 0.71 & 0.68 & 0.59 & 0.52 & 0.76 & 0.68 & 0.70 & 0.72 \\
0.65 & 0.77 & 0.22 & 0.08 & 0.70 & 0.57 & 0.58 & 0.52 & 0.87 & 0.70 & 0.78 & 0.84 \\
0.63 & 0.80 & 0.19 & 0.12 & 0.70 & 0.59 & 0.64 & 0.48 & 0.85 & 0.70 & 0.81 & 0.96 \\
0.57 & 0.52 & 0.19 & 0.12 & 0.77 & 0.68 & 0.67 & 0.56 & 0.87 & 0.70 & 0.74 & 0.92 \\
0.56 & 0.73 & 0.19 & 0.08 & 0.73 & 0.59 & 0.58 & 0.48 & 0.73 & 0.61 & 0.74 & 0.76 \\
0.63 & 0.80 & 0.23 & 0.24 & 0.63 & 0.52 & 0.48 & 0.40 & 0.86 & 0.73 & 0.86 & 0.92 \\
0.65 & 0.86 & 0.28 & 0.16 & 0.71 & 0.61 & 0.61 & 0.52 & 0.85 & 0.75 & 0.83 & 1.00 \\
0.61 & 0.68 & 0.20 & 0.12 & 0.72 & 0.68 & 0.61 & 0.48 & 0.85 & 0.68 & 0.75 & 0.92 \\
0.65 & 0.86 & 0.23 & 0.08 & 0.72 & 0.66 & 0.61 & 0.52 & 0.80 & 0.57 & 0.72 & 0.76 \\
0.58 & 0.73 & 0.20 & 0.08 & 0.78 & 0.66 & 0.62 & 0.52 & 0.82 & 0.68 & 0.75 & 0.80 \\
0.67 & 0.84 & 0.22 & 0.08 & 0.65 & 0.57 & 0.43 & 0.44 & 0.78 & 0.77 & 0.78 & 0.92 \\
0.63 & 0.75 & 0.20 & 0.08 & 0.72 & 0.64 & 0.59 & 0.52 & 0.75 & 0.68 & 0.74 & 0.72 \\
\hline \hline
\end{tabular} 
\end{center}
\end{table}
\end{footnotesize}

\end{document}

target is iris normalized

x1  x2  x3  x4  class

rule is IF x1 = large ... THEN class is 2

crisp extrime rule
IF 0<x1<1 & 0<x2<1 & 0<x3<1  0<x4<1 cover all sample

The same idea as controling metro is possible, i.e., input is continuous value of x1-x4 output is membershipfunction of class which tells likelifood of current combination. But here we will take a different approach, i.e., ......

1) each gene of chromosome 1/0+attribute such as ((1 Long)(1 short)... (1 medium) class) => uniform X'over
GA
fitness
chromosome (1/0 rule-1, 1/0 rule-2, ...)

Immune
chromosome (1/0 x1 = large, 

(i) exhustive -> negative selection (Ayara et al.)

             sample from i
                |
candidate ->                ->mutation -> store
                |
		      reject

1) define self data; (2) generate a candidate detector randomly; and (3) match each candidate detector with self data, if it matches, perform guided mutation on detector away from self. The guided mutation is performed on the candidate detector, which matches the self data. Mutation is then performed on the parts of the candidate detector that match with the self element. The mutation is adaptive, based on the affinity of the closely matching self element to a candidate detector. This means that the probability of mutation is directly proportional to affinity. Thus, the greater the affinity, the higher is the mutation probability. This idea was taken from the affinity maturation process of B-cells to antigenic patterns in the immune system. this algorithm, however, the reference is the self-set, instead of non-self set. Hence, the mutation is performed proportionally to affinity to self-set, such that the candidate detector is changed so as not to match self-set. Also,
			  
repeat (converge -> put the best in repertoir (library)

Ant

===============
Kim and Bentley
===============
The main idea of these models is distinguishing self, which is normal, from non-self, which is abnormal.

[gene library evolution]
If a new detector, which is generated from initial genes and transferred to a local host, detects anomalous network traffic activity, the genes comprising this detector will be added to the gene library. But, if the
genes are already stored in the gene library, the fitness values of these genes are increased.

if the size of the gene library is limited, whenever the size is above a fixed length, the genes that have lowest fitness values will be removed from the gene library.

The secondary IDS's perform the last evolutionary process: clonal selection. Its main tasks are detecting various intrusions with a limited number of detector sets and cloning the identical detectors that are performing well, producing memory detectors and driving the gene library evolution in the primary IDS.

three evolutionary stages. Gene library evolution (which learns knowledge of currently existing antigens.) => Gene expression and negative selection => Clonal selection is the third stage of evolution.

===========
Ayara et al
===========
The first line of defense is known as innate immunity:

If the innate immune system cannot remove the pathogen, then the adaptive (or acquired) immune system takes over.

depending on the closeness of that match, T-cells stimulate B-cells into rapid proliferation and undergo >>affinity maturation.<<

Affinity maturation is a process by which stimulated B-cells are driven to become better tuned to the antigen responsible for initiating the immune response, which enhances the quality of the response.

During affinity maturation, stimulated antibodies undergo a >>somatic mutation<< with high rates, termed hypermutation.

The amount of mutation that a B-cell will undergo is inversely proportional to how well it matches the antigenic pattern: the higher the affinity (match) the lower the mutation, and vice versa.

The maturation of the T-cells
T-cells are exposed to self-proteins. If this binding activates the T-cell, then the T-cell is killed, otherwise it is allowed into the repertoire.


EXHAUSTIVE DETECTOR GENERATING ALGORITHM
generate a random candidate detector; and match each candidate detector generated with self data. If it matches with any self data, it is discarded, otherwise it is added to the collection of competent detectors.

=======================
My summary of all above
=======================
antibody vs. antigen (pathogen); self vs non-self, gene creates detector

(1) gene livrary (repertoire) evolution:
when detector detects non-self its gene is added in the gene library. if already exist the fitness of the gene is increased. if the library is full the lowest fitness gene is removed.

(2) negative selection (self non-self discrimination)

(3) clonal selection: 





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%% 2. fuzzy controler
%%   2.1 Virtual metro with two trains in a loop line
%%       Fig example of a loop-line with two trains
%%   2.2 Goal
%%      Fig xyz space
%%   2.3 Let's desing a set of rules of driving
%%      Fig membership function of x, y, z   ...  add table to each Fig
%%	  2.3.2 a set of 9 rules to control break strength
%%	     IF X=FAST AND Y=SHORT  THEN  Z=STRONG
%%	        	            OR
%%		 IF X=FAST AND Y=MEDIUM THEN  Z=WEAK
%%		         	        OR
%%		 IF X=MEDIUM AND Y=SHORT THEN  Z=MEDIUM
%%		                    OR
%%		 IF X=MEDIUM AND Y=MEDIUM THEN  Z=STRONG
%%		                    OR
%%		 IF X=SLOW AND Y=SHORT THEN  Z=STRONG
%%                         ...
%%			   ETC
		
	 
2.3.3 membership function of Z under a pair of specific value of X & Y
   Ex. membership function under one rule out of nine rules

2.3.4 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\noindent
For example, what should we react when x = 80km/h and y = 40m?

\begin{figure}[hbtp]
 \begin{center}  
   \includegraphics[width=10cm,height=5cm]{slice.eps}
\caption{To de-fuzzify strength of break}
 \end{center}
\end{figure}



\clearpage
\section{Fuzzy Relation}
\section{Fuzzy Data Processing}

\end{document}

\subsubsection{Towards controlling a machine}
\noindent
{\bf $\bullet$ Example 1} \\

\noindent
{\it IF x = SLOW THEN y = STRONG}\\

%% draw the graph x vs. y -> slice the 3D membership graph at some value of x 
%% then calculate the center of gravity this is the value y for x

\noindent
Hereafter we assume Larsen's proposal. That is,
\begin{displaymath}
\mu_{A \rightarrow B}(x) = \mu_A(x)\times\mu_B(x).
\end{displaymath}
Then we contemplate how likely is the statement ``{\it IF x = SLOW THEN y = STRONG}'' when $x$ takes a specific value. For example, How likely is the statement when $x = 30$? In other words, what is membership function of ``{\it IF x = SLOW THEN y = STRONG}'' when $x = 30$? The following Figure is two such cases for $x=30$ and $x=45$.

\begin{figure}[hbtp]
\begin{center}
   \includegraphics[width=15cm,height=4cm]{if-then-1.eps}
   \caption{Examples of membership function \{$x$ is HIGH\} (right) and
\{y is STRONG\} (left).} 
\end{center}
\end{figure}

\begin{figure}[hbtp]
\begin{center}
   \includegraphics[width=15cm,height=4cm]{if-then-1-2.eps}
   \caption{Examples of membership function \{$x$ is HIGH\} (right) and
\{y is STRONG\} (left).} 
\end{center}
\end{figure}

\begin{figure}[hbtp]
\begin{center}
   \includegraphics[width=15cm,height=4cm]{if-then-2.eps}
   \caption{Examples of membership function \{$x$ is HIGH\} (right) and
\{y is STRONG\} (left).} 
\end{center}
\end{figure}

\begin{figure}[hbtp]
\begin{center}
   \includegraphics[width=15cm,height=4cm]{if-then-2-2.eps}
   \caption{Examples of membership function \{$x$ is HIGH\} (right) and
\{y is STRONG\} (left).} 
\end{center}
\end{figure}

\noindent
Result of the membership function is expressed in 3 dimensional space. That is, the membership functin is defiened on $x$-$y$ plane, like in the following Figure.

\begin{figure}[hbtp]
\begin{center}
%%   \includegraphics[width=15cm,height=4cm]{one-if-then-0.eps}
%%   \caption{Examples of membership function \{$x$ is HIGH\} (right) and \{y is STRONG\} (left).}
\end{center}
\end{figure}

\noindent
Then if we repeat this, varying, say, $x$ like $x = 25, 30, 35, 40, \cdots, 60$, we obtain the whole membership function of ``{\it IF x = SLOW THEN y = STRONG}'' 






%% \begin{figure}[hbtp]
%% \begin{center}
%%    \includegraphics[width=15cm,height=4cm]{membership-3.eps}
%%    \caption{Examples of membership function \{$x$ is HIGH\} (right) and
%% \{y is STRONG\} (left).} 
%% \end{center}
%% \end{figure}

\begin{figure}[hbtp]
\begin{center}
\includegraphics[width=16cm,height=8cm]{if-then-1.eps}
\caption{Matrix expression of the above membership functions,}
\end{center}
 \end{figure}

\begin{figure}[hbtp]
\begin{center}
\includegraphics[width=16cm,height=8cm]{if-then-1-2.eps}
\caption{Matrix expression of the above membership functions,}
\end{center}
 \end{figure}


\noindent
$\bullet$ Example 2 ... two rules of 1 element\\
$R_1$: IF x = slow then z = high \\ 
$R_2$: IF x = midium then z = midium \\ 


\noindent
Example 2 ... agaain 1 rule but 2 elements\\
$R_1$: IF x = slow   AND y = medium THEN z = high \\ 

\noindent
no more possible graphical or matrics but...

\noindent
output fuzzy set when x = 40 is like ...

It's not normal

\noindent
Example 3 ... Four rules each contains two variables $x_1$ and $x_2$ as {\it IF-part}.

%%de-fuzzification
%%center of gravity

\subsection{Fuzzy and GA}

\subsubsection*{evalving membership function}

$\bullet$ Triangle membership functions \\

\noindent
$\bullet$ Gaussian \\

\subsubsection*{chromosome corresponding to rule}

