31
FRBSIFC: Fuzzy Rule Based System for Iris Flower Classification Labin Kumar Senapati, MCA, 5 th Semester, Department of Information and Communication Technology, Fakir Mohan University, Vyasa Vihar, Balasore-756019, ORISSA. Abstract: Information technology (IT) doubtlessly contributes much to agriculture and rural development. This article investigate the use of FRBSIFC (Fuzzy Rule Based system for Iris Flower Classification) applied to discovery of Logical Rules in order to classify the Iris flower. FRBS is thought to be a useful paradigm for the implementation of human knowledge; this provides a means for sharing, communicating and transferring the human knowledge. FRBSIFC (Fuzzy Rule Based system for Iris Flower Classification) Is described in some detail, then an evaluative study is undertaken involving the subjective evaluation of the results. FRBSIFC is found to discover logical rules for the classification of Iris Flower. Keywords: FRBSIFC (Fuzzy Rule Based system for Iris Flower Classification), FRBS, logical rules 1. Introduction Information technology (IT) doubtlessly contributes much to agriculture and rural development. Firstly, it can facilitate rural activities and provide more comfortable and safe rural life with equivalent services to those in the urban areas, such as provision of distance education, tele- medicine, remote public services, remote entertainment etc. Secondly, IT can initiate new agricultural and rural 21

Fuzzy rule based system for iris flower classification by labin senapati

Embed Size (px)

Citation preview

Page 1: Fuzzy rule based system for iris flower classification by labin senapati

FRBSIFC: Fuzzy Rule Based System for Iris Flower Classification

Labin Kumar Senapati, MCA, 5th Semester,Department of Information and Communication Technology,

Fakir Mohan University, Vyasa Vihar,Balasore-756019, ORISSA.

Abstract: Information technology (IT) doubtlessly contributes much to agriculture and rural development. This article investigate the use of FRBSIFC (Fuzzy Rule Based system for Iris Flower Classification) applied to discovery of Logical Rules in order to classify the Iris flower. FRBS is thought to be a useful paradigm for the implementation of human knowledge; this provides a means for sharing, communicating and transferring the human knowledge. FRBSIFC (Fuzzy Rule Based system for Iris Flower Classification) Is described in some detail, then an evaluative study is undertaken involving the subjective evaluation of the results. FRBSIFC is found to discover logical rules for the classification of Iris Flower.

Keywords: FRBSIFC (Fuzzy Rule Based system for Iris Flower Classification), FRBS, logical rules

1. Introduction

Information technology (IT) doubtlessly contributes much to agriculture and rural development. Firstly, it can facilitate rural activities and provide more comfortable and safe rural life with equivalent services to those in the urban areas, such as provision of distance education, tele-medicine, remote public services, remote entertainment etc. Secondly, IT can initiate new agricultural and rural business such as e-commerce, real estate business for satellite offices, rural tourism, and virtual corporation of small-scale farms. Thirdly, it can support policy-making and evaluation on optimal farm production, disaster management, agro-environmental resource management etc., using tools such as geographic information systems (GIS). Fourthly, it can improve farm management and farming technologies by efficient farm management, risk management, effective information or knowledge transfer etc., realizing competitive and sustainable farming with safe products. For example, farmers must make critical decisions such as what to and when to plant, and how to manage pests, while considering off-farm factors such as environmental impacts, market access, and industry standards. IT-based decision support system (DSS) can surely help their decisions. Fifthly, IT can provide systems and tools to

21

Page 2: Fuzzy rule based system for iris flower classification by labin senapati

secure food traceability and reliability that has been an emerging issue concerning farm products since serious contamination such as BSE and chicken flu was detected.

Finally, IT can take an important and key role for industrialization of farming or farm business enterprises, combining the above roles.

FRBSIFC (Fuzzy Rule Based system for Iris Flower Classification) is applied to discovery of Logical Rules in order to classify the Iris flower. FRBS is thought to be a useful paradigm for the implementation of human knowledge; this provides a means for sharing, communicating and transferring the human knowledge. Here the iris flower are classified into three classes namely:

Iris setosa.

Iris versicolor.

Iris virginica.

All these classes has the common physical characteristic, they are

Sepal length

Sepal width

Petal length

Petal width

where each class refers to a type of iris plant. One class is linearly separable from the other 2; the latter are NOT linearly separable from each other.

Fuzzy Rule based system can be applied to define a set of rules which can classify the flower by reading its physical characteristics. FRBSIFS is a type of machine learning technique, which will read the previously recorded data about the Iris flower and then generates optimal logical rules and when the unknown samples are introduced to these rules, it will identify the samples accurately.

Iris is a genus of 260 species of flowering plants with showy flowers. It takes its name from the Greek word for a rainbow, referring to the wide variety of flower colors found among the many species. As well as being the scientific name, iris is also very widely used as a common name; for one thing, it refers to all Iris species, though some plants called thus belong to other closely related genera. In North America, a common name for irises is 'flags', while the plants of the subgenus Scorpiris are widely known as 'junos', particularly in horticulture. It is a popular garden flower in the United States.

22

Page 3: Fuzzy rule based system for iris flower classification by labin senapati

The iris flower is of special interest as an example of the relation between flowering plants and pollinating insects. The shape of the flower and the position of the pollen-receiving and stigmatic surfaces on the outer petals form a landing-stage for a flying insect, which in probing the perianth for nectar, will first come in contact of perianth, then with the stigmatic stamens in one whorled surface which is borne on an ovary formed of three carpels. The shelf-like transverse projection on the inner whorled underside of the stamens is beneath the over-arching style arm below the stigma, so that the insect comes in contact with its pollen-covered surface only after passing the stigma; in backing out of the flower it will come in contact only with the non-receptive lower face of the stigma. Thus, an insect bearing pollen from one flower will, in entering a second, deposit the pollen on the stigma; in backing out of a flower, the pollen which it bears will not be rubbed off on the stigma of the same flower.

The iris fruit is a capsule which opens up in three parts to reveal the numerous seeds within. In some species, these bear an aril. In water purification, Yellow Iris (I. pseudacorus) is used. The roots are usually planted in a substrate (e.g. lava-stone) in a reedbed-setup. The roots then improve water quality by consuming nutrient pollutants, such as from agricultural runoff.

Iris setosa are vigorous plants with strong, sword-like foliage about 2 ft. in height. The iris flowers are purple-blue, usually of a very dark shade, but occasionally pale lavender and intermediate shades. Flowers are 3-6 in. wide.

23

Figure 1: IRIS Flower

Page 4: Fuzzy rule based system for iris flower classification by labin senapati

A member of the iris family (family Iridaceae) which consists of herbs growing from rhizomes, bulbs, or corms, with narrow basal leaves and showy clusters at the tips of long stalks. There are about 60 genera and 1,500 species, distributed in temperate and tropical regions. Among them, Iris, Freesia, Gladiolus, Bugle Lily, and Montbretia are popular ornamentals. Saffron dye is obtained from Crocus, and essence of violets, used in perfumes, is extracted from the rhizomes of Iris.

Iris versicolor contain notable amounts of terpenes, and organic acids such as ascorbic acid, myristic acid, tridecylenic acid and undecylenic acid. Iris rhizomes can be toxic. Larger Blue Flag (I. versicolor) and other species often grown in gardens and widely hybridized contain elevated amounts of the toxic glycoside iridin. These rhizomes can cause nausea, vomiting, diarrhea, and/or skin irritation, but poisonings are not normally fatal. Irises should only be used medicinally under professional guidance.

24

Page 5: Fuzzy rule based system for iris flower classification by labin senapati

Iris virginica, Blue Flag Iris is a tall, bold wildflower with pale-green sword-like leaves in strong, flat vertical fans.  The showy flowers are 3.5 inches wide, and deep blue-violet with yellow and white markings growing on stems up to 3 feet tall.  It will grow in ordinary garden soil but prefers moist, rich soil where it forms colonies and can be used in bog or water gardens.  The foliage is strongest when planted in partial shade but the flowers bloom best in full sun and can be used in flower arrangements.  Native blue flag iris is an emergent wildflower.  The root mass of established colonies provides good shoreline protection.  Iris is Greek for "rainbow".  Seeds should be planted in fall/winter or receive 3 months cool, moist stratification.

2. FRBS: (FUZZY RULE BASED SYSTEM)

Fuzzy logic has emerged as a more general form of logic that can handle the concept of partial truth. Truth here takes intermediate values between "completely true" and "completely false". Since the pioneering work of Zadeh (1965), fuzzy logic has been used as a modeling methodology that allows easier transition between humans and computers for decision making and a better way to handle imprecise and uncertain information. This methodology has undergone several developments and is currently widely used in machine control.

One area where fuzzy systems have been applied is multi-objective decision making with imprecise objectives, such as multi-objective reservoir operation. Fontane et al. (1997) posed this problem using linguistically described operational goals and constraints with fuzzy membership functions. Their study included conducting interviews of both decision makers and representatives of decision-influence groups to develop measures of multiple fuzzy objectives as membership functions in terms of reservoir release or storage. Multiple objectives were treated as constraints, and the end-of-the-year storage as a goal.

25

Page 6: Fuzzy rule based system for iris flower classification by labin senapati

In the area of replicating complex mathematical models, Bârdossy et al. (1995) modeled the movement of water in the unsaturated zone using a fuzzy rule-based approach. Data generated by numerical solution of Richard's equation were used as examples to train (i.e. formulate the rules of) a fuzzy rule-based model. Bârdossy & Duckstein (1995) also used adaptive fuzzy systems to model daily water demand time series in the Ruhr basin, Germany, and used fuzzy rules to predict future water demand based on three input variables: the day of the week, the daily maximum temperature, and the general weather conditions of the previous days. In the area of classification, the study by Carpa et al. (1994) showed that the theory of fuzzy sets can be applied to drought classification. They used fuzzy clustering techniques to identify areas with similar and homogenous meteorological characteristics.

The major problem in using fuzzy rule-based modeling is the formulation of rules. In cases of simpler systems, the fuzzy rules could be obtained from expert knowledge. In more complex systems, however, all the rules cannot be manually formulated (since such rules lack numerical precision) and it is vital to use intelligent systems that can configure their own working rules. A computer-based tool with such capabilities is developed herein, tested with data generated using hypothetical models of varying nonlinearity in which promising results were obtained, and applied to the problem in this research.

2.1 HOW A FUZZY RULE-BASED SYSTEM (FRBS) WORKSA fuzzy rule-based model contains membership functions of fuzzy sets constructed on the range of all the inputs to the model. The membership functions could be represented by linguistic terms like "low", "medium" and "high". The output also contains membership functions. The model matches the input and output with fuzzy rules such as:

If Input 1 is LOW and Input 2 is HIGH then Output is MEDIUMSince membership functions overlap each other, so do the rules constructed from them.

Figure 1 illustrates a glimpse of what goes on in a fuzzy model, in a situation where there are two inputs and one output. When a vector of input data is fed into the model, membership values to the corresponding input fuzzy sets are determined.

For instance, x1 belongs to HIGH and MEDIUM while x2 belongs to LOW and MEDIUM.

This activates four of the nine overlapping rules, which are indicated by darker shading (Fig. 1). The inputs belong to the corresponding fuzzy sets to varying degrees. Using this

26

Page 7: Fuzzy rule based system for iris flower classification by labin senapati

information, the inference engine determines the degree to which the premise to each rule is satisfied.

The rules that involve non-zero degree of fulfilment (DOF) are activated (as shown with the darker "tiles" in Fig. 1) and their consecutive consequences are combined and defuzzified to a numerical output y (for details see Bârdossy & Duckstein.

27

Page 8: Fuzzy rule based system for iris flower classification by labin senapati

2.2 TRAINING ALGORITHM FOR THE FRBM

The generation of fuzzy rules is based on the least square training algorithm proposed by Bârdossy & Duckstein (1995). This works with a known rule structure and is oriented towards construction of output membership functions corresponding to the fuzzy associative memory (FAM) matrix entries. It is directed to the minimization of the sum of the square error between the modeled and true values. The least square algorithm works on the basis of the so-called training set (T),

which is a set of S vectors, each of which is composed of K components of observed input vector ‘a’ and observed output value ‘b’:

T={( a1 (s),..., ak (s),b(s)},s=l,...,S} (1)

The method works as follows:

The sum of the squared error resulting from the use of the rule system R can be written as:

∑ [ R(a1 (s ) , . . . ak (s) ) -b (s));]2 (2)

As the left-hand side of the rules is supposed to be known, the degree of fulfilment

(DOF), V.(J) corresponding to a1 (s),….. ak (s) can be calculated from each rule ‘i’ of thetotal ‘I’ rules. Then the rule response can be written as:

where M(Bi) is the centre of mass of the area under output membership function Bi.The objective function to be minimized will be as follows:

Differentiating with respect to the unknown M(Bj), for every index j gives:

28

Page 9: Fuzzy rule based system for iris flower classification by labin senapati

Rearrangement of the terms gives a system of I linear equations with I unknowns (M(B1),..., (M(Bi));

After the initial training is completed, according to the method suggested by Bârdossy & Duckstein (1995), a local search is launched to select the best shape of input membership functions from four predefined ones. Four membership functions, viz. triangular, bell-shaped, dome-shaped and inverted-cycloid, were used (Fig. 2). The local search is vital as it allows the fuzzy model to fine tune depending on the nonlinearity existing in the relationships among the quantities in the physical system to be represented.

29

Input the Data set

Page 10: Fuzzy rule based system for iris flower classification by labin senapati

30

Normalize the Data set

Generate a Rule

Find out the compatibility factor corresponding toEach pattern.

µ(xi ) = µ(xi1 )* µ(xi2 )*….* µ(xid )

For each class ‘h’.

µh = ∑ µ(xi ) 1 ≤ h ≤m

Find out the Maximum Compatibility factor and assign the class to the rule.

RULEi = Max { µh }

1 ≤ h ≤m

All the combination of

rules are finished.

Sort the RULES according to their compatibility factor and class.

TESTINGUse greedy approach to select the optimum rules and test with the Data set.

Return the optimum rules.

Page 11: Fuzzy rule based system for iris flower classification by labin senapati

3. DATA SET INFORMATION

This is perhaps the best known database to be found in the pattern recognition literature. The data set contains 3 classes of 50 instances each, where each class refers to a type of iris plant. One class is linearly separable from the other 2; the latter are NOT linearly separable from each other.

Iris Plants Databasesepal length in cm

sepal width in cm

petal length in cm

petal width in cm

Class

5.1 3.5 1.4 0.2 Iris-setosa4.9 3.0 1.4 0.2 Iris-setosa4.7 3.2 1.3 0.2 Iris-setosa4.6 3.1 1.5 0.2 Iris-setosa5.0 3.6 1.4 0.2 Iris-setosa5.4 3.9 1.7 0.4 Iris-setosa4.6 3.4 1.4 0.3 Iris-setosa5.0 3.4 1.5 0.2 Iris-setosa4.4 2.9 1.4 0.2 Iris-setosa4.9 3.1 1.5 0.1 Iris-setosa5.4 3.7 1.5 0.2 Iris-setosa4.8 3.4 1.6 0.2 Iris-setosa4.8 3.0 1.4 0.1 Iris-setosa4.3 3.0 1.1 0.1 Iris-setosa5.8 4.0 1.2 0.2 Iris-setosa5.7 4.4 1.5 0.4 Iris-setosa5.4 3.9 1.3 0.4 Iris-setosa5.1 3.5 1.4 0.3 Iris-setosa5.7 3.8 1.7 0.3 Iris-setosa5.1 3.8 1.5 0.3 Iris-setosa5.4 3.4 1.7 0.2 Iris-setosa5.1 3.7 1.5 0.4 Iris-setosa4.6 3.6 1.0 0.2 Iris-setosa5.1 3.3 1.7 0.5 Iris-setosa4.8 3.4 1.9 0.2 Iris-setosa5.0 3.0 1.6 0.2 Iris-setosa5.0 3.4 1.6 0.4 Iris-setosa5.2 3.5 1.5 0.2 Iris-setosa5.2 3.4 1.4 0.2 Iris-setosa4.7 3.2 1.6 0.2 Iris-setosa4.8 3.1 1.6 0.2 Iris-setosa5.4 3.4 1.5 0.4 Iris-setosa5.2 4.1 1.5 0.1 Iris-setosa5.5 4.2 1.4 0.2 Iris-setosa4.9 3.1 1.5 0.1 Iris-setosa5.0 3.2 1.2 0.2 Iris-setosa5.5 3.5 1.3 0.2 Iris-setosa4.9 3.1 1.5 0.1 Iris-setosa4.4 3.0 1.3 0.2 Iris-setosa5.1 3.4 1.5 0.2 Iris-setosa5.0 3.5 1.3 0.3 Iris-setosa

31

Page 12: Fuzzy rule based system for iris flower classification by labin senapati

4.5 2.3 1.3 0.3 Iris-setosa4.4 3.2 1.3 0.2 Iris-setosa5.0 3.5 1.6 0.6 Iris-setosa5.1 3.8 1.9 0.4 Iris-setosa4.8 3.0 1.4 0.3 Iris-setosa5.1 3.8 1.6 0.2 Iris-setosa4.6 3.2 1.4 0.2 Iris-setosa5.3 3.7 1.5 0.2 Iris-setosa5.0 3.3 1.4 0.2 Iris-setosa7.0 3.2 4.7 1.4 Iris-versicolor6.4 3.2 4.5 1.5 Iris-versicolor6.9 3.1 4.9 1.5 Iris-versicolor5.5 2.3 4.0 1.3 Iris-versicolor6.5 2.8 4.6 1.5 Iris-versicolor5.7 2.8 4.5 1.3 Iris-versicolor6.3 3.3 4.7 1.6 Iris-versicolor4.9 2.4 3.3 1.0 Iris-versicolor6.6 2.9 4.6 1.3 Iris-versicolor5.2 2.7 3.9 1.4 Iris-versicolor5.0 2.0 3.5 1.0 Iris-versicolor5.9 3.0 4.2 1.5 Iris-versicolor6.0 2.2 4.0 1.0 Iris-versicolor6.1 2.9 4.7 1.4 Iris-versicolor5.6 2.9 3.6 1.3 Iris-versicolor6.7 3.1 4.4 1.4 Iris-versicolor5.6 3.0 4.5 1.5 Iris-versicolor5.8 2.7 4.1 1.0 Iris-versicolor6.2 2.2 4.5 1.5 Iris-versicolor5.6 2.5 3.9 1.1 Iris-versicolor5.9 3.2 4.8 1.8 Iris-versicolor6.1 2.8 4.0 1.3 Iris-versicolor6.3 2.5 4.9 1.5 Iris-versicolor6.1 2.8 4.7 1.2 Iris-versicolor6.4 2.9 4.3 1.3 Iris-versicolor6.6 3.0 4.4 1.4 Iris-versicolor6.8 2.8 4.8 1.4 Iris-versicolor6.7 3.0 5.0 1.7 Iris-versicolor6.0 2.9 4.5 1.5 Iris-versicolor5.7 2.6 3.5 1.0 Iris-versicolor5.5 2.4 3.8 1.1 Iris-versicolor5.5 2.4 3.7 1.0 Iris-versicolor5.8 2.7 3.9 1.2 Iris-versicolor6.0 2.7 5.1 1.6 Iris-versicolor5.4 3.0 4.5 1.5 Iris-versicolor6.0 3.4 4.5 1.6 Iris-versicolor6.7 3.1 4.7 1.5 Iris-versicolor6.3 2.3 4.4 1.3 Iris-versicolor5.6 3.0 4.1 1.3 Iris-versicolor5.5 2.5 4.0 1.3 Iris-versicolor5.5 2.6 4.4 1.2 Iris-versicolor6.1 3.0 4.6 1.4 Iris-versicolor5.8 2.6 4.0 1.2 Iris-versicolor5.0 2.3 3.3 1.0 Iris-versicolor5.6 2.7 4.2 1.3 Iris-versicolor

32

Page 13: Fuzzy rule based system for iris flower classification by labin senapati

5.7 3.0 4.2 1.2 Iris-versicolor5.7 2.9 4.2 1.3 Iris-versicolor6.2 2.9 4.3 1.3 Iris-versicolor5.1 2.5 3.0 1.1 Iris-versicolor5.7 2.8 4.1 1.3 Iris-versicolor6.3 3.3 6.0 2.5 Iris-virginica5.8 2.7 5.1 1.9 Iris-virginica7.1 3.0 5.9 2.1 Iris-virginica6.3 2.9 5.6 1.8 Iris-virginica6.5 3.0 5.8 2.2 Iris-virginica7.6 3.0 6.6 2.1 Iris-virginica4.9 2.5 4.5 1.7 Iris-virginica7.3 2.9 6.3 1.8 Iris-virginica6.7 2.5 5.8 1.8 Iris-virginica7.2 3.6 6.1 2.5 Iris-virginica6.5 3.2 5.1 2.0 Iris-virginica6.4 2.7 5.3 1.9 Iris-virginica6.8 3.0 5.5 2.1 Iris-virginica5.7 2.5 5.0 2.0 Iris-virginica5.8 2.8 5.1 2.4 Iris-virginica6.4 3.2 5.3 2.3 Iris-virginica6.5 3.0 5.5 1.8 Iris-virginica7.7 3.8 6.7 2.2 Iris-virginica7.7 2.6 6.9 2.3 Iris-virginica6.0 2.2 5.0 1.5 Iris-virginica6.9 3.2 5.7 2.3 Iris-virginica5.6 2.8 4.9 2.0 Iris-virginica7.7 2.8 6.7 2.0 Iris-virginica6.3 2.7 4.9 1.8 Iris-virginica6.7 3.3 5.7 2.1 Iris-virginica7.2 3.2 6.0 1.8 Iris-virginica6.2 2.8 4.8 1.8 Iris-virginica6.1 3.0 4.9 1.8 Iris-virginica6.4 2.8 5.6 2.1 Iris-virginica7.2 3.0 5.8 1.6 Iris-virginica7.4 2.8 6.1 1.9 Iris-virginica7.9 3.8 6.4 2.0 Iris-virginica6.4 2.8 5.6 2.2 Iris-virginica6.3 2.8 5.1 1.5 Iris-virginica6.1 2.6 5.6 1.4 Iris-virginica7.7 3.0 6.1 2.3 Iris-virginica6.3 3.4 5.6 2.4 Iris-virginica6.4 3.1 5.5 1.8 Iris-virginica6.0 3.0 4.8 1.8 Iris-virginica6.9 3.1 5.4 2.1 Iris-virginica6.7 3.1 5.6 2.4 Iris-virginica6.9 3.1 5.1 2.3 Iris-virginica5.8 2.7 5.1 1.9 Iris-virginica6.8 3.2 5.9 2.3 Iris-virginica6.7 3.3 5.7 2.5 Iris-virginica6.7 3.0 5.2 2.3 Iris-virginica6.3 2.5 5.0 1.9 Iris-virginica6.5 3.0 5.2 2.0 Iris-virginica6.2 3.4 5.4 2.3 Iris-virginica

33

Page 14: Fuzzy rule based system for iris flower classification by labin senapati

5.9 3.0 5.1 1.8 Iris-virginica

Algorithm Description

This section follows representation, description , algorithms and processes.

Attribute Information:

Attribute 1is the sepal length in cm.Attribute 2 is the sepal width in cm .Attribute 3 Is the petal length in cm .Attribute 4 is the petal width in cm .

Attribute 5 is the class label:

Class Information:

-- Iris Setosa is denoted as class 1.-- Iris Versicolour is denoted as class 2.-- Iris Virginica is denoted as class 3.

Notation

Pseudo code is presented in this section in which array a[150][6] will be referred as a database holding 150 samples and each samples includes four attributes and class label.

rol[90][6] holds the rules including the class label and compatibility factor.

class1[90][6] holds the rules that are labeled as class 1 including the compatibility factor.

class2[90][6] holds the rules that are labeled as class 2 including the compatibility factor.

class3[90][6] holds the rules that are labeled as class 3 including the compatibility factor.

34

Page 15: Fuzzy rule based system for iris flower classification by labin senapati

Function’s

Normalization

float normalize(float val,float max,float min)

{

return ((val-min)/(max-min));

}

This function is used to Normalize the data set . After normalization the values are mapped to a number between [0-1].

Membership function:

float membfun(float a,float b,float c,float x){if(x<=a)return 0;

if(x>a && x<=b){return ((x-a)/(b-a));}

if(x>b && x<=c){return ((c-x)/(c-b));}

if(x>c){return 0;}

}

35

Page 16: Fuzzy rule based system for iris flower classification by labin senapati

This function is used to return the Membership value of an attribute. In this we used triangular membership function.

µx

LOW HIGH

a b c

while calculating the membership function for LOW.We assign,b=0; c=0.5; and a<b;while calculating the membership function for MIDIUM.We assign,a=0; b=0.5; and c=1;while calculating the membership function for LOW.We assign,a=0.5; b=1; and c>b;

Rule Generation:

This function finds the compatibility factor of all the 81 combination of rules and then assign the corresponding class to it .

For a given rule, the compatibility factors of all the classes are calculated and then the class having the highest compatibility factor is assigned to that rule.

rule(int i,int j,int k,int l,float a[150][6],int c,float rol[90][6]){ struct d h;

36

MIDIUM

Page 17: Fuzzy rule based system for iris flower classification by labin senapati

float x1,x2,x3,x4,c1=0,c2=0,c3=0; int m; for(m=0;m<150;m++) { h= ins(i); x1=membfun(h.x[0],h.x[1],h.x[2],a[m][0]);

h= ins(j); x2=membfun(h.x[0],h.x[1],h.x[2],a[m][1]);

h= ins(k); x3=membfun(h.x[0],h.x[1],h.x[2],a[m][2]);

h= ins(l); x4=membfun(h.x[0],h.x[1],h.x[2],a[m][3]);

a[m][5]= (x1*x2*x3*x4);

}

for(m=0;m<50;m++) c1=c1+a[m][5];

for(m=50;m<100;m++) c2=c2+a[m][5];

for(m=100;m<150;m++) c3=c3+a[m][5];

if(c1==c2 && c2==c3){rol[c][0]=i; rol[c][1]=j; rol[c][2]=k; rol[c][3]=l; rol[c][4]=0;

} else { rol[c][0]=i; rol[c][1]=j; rol[c][2]=k; rol[c][3]=l;

rol[c][4]=max(c1,c2,c3);

if(rol[c][4]==1) rol[c][5]=c1;

37

Page 18: Fuzzy rule based system for iris flower classification by labin senapati

if(rol[c][4]==2) rol[c][5]=c2;

if(rol[c][4]==3) rol[c][5]=c3; }

}

Assign:

struct d ins(int i) { struct d h;

if(i==0) { h.x[0]=-0.1;h.x[1]=0.0;h.x[2]=0.5; } if(i==1) { h.x[0]=0.0;h.x[1]=0.5;h.x[2]=1.0; }

if(i==2) { h.x[0]=0.5;h.x[1]=1.0;h.x[2]=2.0; } return h; }

This function assign’s the a,b,c value in order to calculate the membership function.

MAXIMUM: int max(float c1,float c2,float c3)

{ if(c1>c2 && c1> c3) return 1;

if(c2>c1 && c2> c3) return 2;

if(c3>c1 && c3> c2)

38

Page 19: Fuzzy rule based system for iris flower classification by labin senapati

return 3;

return 0; }

This function returns the maximum of c1 ,c2, c3.

Sorting of Rules:

sorting(float class1[90][6],int n){int i,j,k;float temp;//n=7; for(i=0;i<n-1;i++) { for(j=0;j<n-i-1;j++) {

if(class1[j][5]<class1[j+1][5]) { for(k=0;k<6;k++)

{

temp=class1[j][k]; class1[j][k]=class1[j+1][k]; class1[j+1][k]=temp;

} }

} } }

This function sorts the rules according to their compatibility factor.

Optimum selection of Rules:

Use greedy approach to select the optimum rules.The rules having highest compatibility factor are selected.

39

Page 20: Fuzzy rule based system for iris flower classification by labin senapati

Testing of Rules:

testing(float a[150][6]){ struct d h; float x1,x2,x3,x4,c1=0,c2=0,c3=0; int m,corect=0; int i=0,j=1,k=0,l=2; float s1,s2,s3; for(m=0;m<150;m++) {

i=0,j=1,k=0,l=2; // RULE 1 for class Iris Setosa .

h= ins(i); x1=membfun(h.x[0],h.x[1],h.x[2],a[m][0]); h= ins(j); x2=membfun(h.x[0],h.x[1],h.x[2],a[m][1]); h= ins(k); x3=membfun(h.x[0],h.x[1],h.x[2],a[m][2]); h= ins(l); x4=membfun(h.x[0],h.x[1],h.x[2],a[m][3]); s1= (x1*x2*x3*x4);

i=1,j=1,k=1,l=1; // RULE 2 for class Iris Versicolour. h= ins(i); x1=membfun(h.x[0],h.x[1],h.x[2],a[m][0]); h= ins(j); x2=membfun(h.x[0],h.x[1],h.x[2],a[m][1]); h= ins(k); x3=membfun(h.x[0],h.x[1],h.x[2],a[m][2]); h= ins(l); x4=membfun(h.x[0],h.x[1],h.x[2],a[m][3]); s2= (x1*x2*x3*x4);

i=1,j=1,k=1,l=0; // RULE 3 for class Iris Virginica

h= ins(i); x1=membfun(h.x[0],h.x[1],h.x[2],a[m][0]); h= ins(j); x2=membfun(h.x[0],h.x[1],h.x[2],a[m][1]);

40

Page 21: Fuzzy rule based system for iris flower classification by labin senapati

h= ins(k); x3=membfun(h.x[0],h.x[1],h.x[2],a[m][2]); h= ins(l); x4=membfun(h.x[0],h.x[1],h.x[2],a[m][3]); s3= (x1*x2*x3*x4); a[m][5]= max(s1,s2,s3); }

for(i=0;i<150;i++) { if(a[i][4]==a[i][5])

{corect++;}else{ printf(" %d",i);getch();}

} printf(" correct= %d",corect); }

This function tests the optimum rules in the given data set to find the percentage of accuracy. If the percentage of accuracy is maximum, then these rules should be treated as benchmark results.

4. EXPERIMENTAL ENVERONMENT

System:

Processor: Intel®core™2 Duo CPU T6400 @ 2.00GHz 2.0 GHz

Memory (RAM): 2 GB.

System type : 32 bit operating system.

Hard disk: 160 GB.

Windows edition:

41

Page 22: Fuzzy rule based system for iris flower classification by labin senapati

Windows vista™ Ultimate

Software Used:

Turbo C++ .

Version 3.0

5. EXPERIMENTAL RESULT

NUMBER OF SAMPLES TESTED :- 150.

RULE 1:

IF LOW AND MID AND LOW AND HIGH THEN CLASS IRIS SETOSA.

RULE 2:

IF MID AND MID AND MID AND MID THEN CLASS IRIS VERSICOLOUR .

RULE 3:

IF MID AND MID AND HIGH AND LOW THEN CLASS IRIS VIRGINICA.

Rule 1 has the membership value = 17.62 approximately.Rule 2 has the membership value = 17.74 approximately.Rule 3 has the membership value = 7.64 approximately.

Out of 150 samples tested, 127 samples are classified correctly by these rules. 84.66% accuracy.

Out of 150 samples tested, 3 samples are classified as undefined by these rules. Sample 15, 60 and 131 are founded as undefined class. 2% undefined. Out of 150 samples tested, 20 samples are classified incorrectly by these rules.

42

Page 23: Fuzzy rule based system for iris flower classification by labin senapati

Samples 101, 103, 106, 110, 111, 113, 116, 119, 121, 123, 126, 127 ,129, 133 ,137, 138, 142, 146, 149 are founded as incorrect. 13.33 % incorrect.

6. CONCLUSIONLogical rules given above are seem to be the simplest possible for the Iris flower dataset and therefore should be treated as benchmark results.

This paper is rather topic-introductory rather than a systematized presentation. It is mainly because the field of IT in the agricultural domain is quite new to be introduced systematically. We believe that, particularly in the case of agriculture, there is a great potential to benefit from IT. In fact, many people dream of agriculture empowered by IT. However, when they are asked what practical measures would empower agriculture in this way, most are at a loss for explanation. It is mainly because there is no general answer to the question. Agriculture is typically site-specific, depending on climatic and soil conditions, cropping style, market requirements, and so on.

References

[1] Fisher,R.A. "The use of multiple measurements in taxonomic problems" Annual Eugenics, 7, Part II, 179-188 (1936); also in "Contributions to Mathematical Statistics" (John Wiley, NY, 1950).

[2] Duda,R.O., & Hart,P.E. (1973) Pattern Classification and Scene Analysis. (Q327.D83) John Wiley & Sons. ISBN 0-471-22361-1. See page 218.

[3] Dasarathy, B.V. (1980) "Nosing Around the Neighborhood: A New System Structure and Classification Rule for Recognition in Partially Exposed Environments". IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. PAMI-2, No. 1, 67-71.

[4] Gates, G.W. (1972) "The Reduced Nearest Neighbor Rule". IEEE Transactions on Information Theory, May 1972, 431-433.

43