Showing posts with label Soft computing. Show all posts
Showing posts with label Soft computing. Show all posts

Friday, November 28, 2014

creating a Fuzzy Inference system using Jfuzzylogic

I followed these steps to create a fuzzy inference system
first download jfuzzylogic jar file from  Jfuzzylogic
create a fcl file to give input to the FIS a sample file can be used from here
The file was created based on an example in the textbook PRINCIPLES OF SOFT COMPUTING by Sivanandham

put the fcl and jar file in same folder.
 Eclipse plugin install instructions 
        - Open Eclipse         - Menu Help -> Install new software         - Click on Add        - Name: jFuzzyLogicUpdateSite         - Location: http://jfuzzylogic.sourceforge.net/eclipse/        - Click OK and follow the instructions.


to run the FIS enter command java -jar jFuzzyLogic.jar -e test1.fcl 8.5 9 in the command prompt i,n folder containing the jFuzzylogic jar file test1.fcl is the input fcl and 8.5 and 9 are the input values.

screenshots of input



Screen shot of output


Thursday, September 11, 2014

Defuzzification

Defuzzification is the process of conversion of fuzzy values into crisp(Non-fuzzy) values. This is required because a number of engineering application cannot use the fuzzy values for processing.It can be considered rounding off .

Methods for Defuzzification

1.      Lambda-cuts

2.      Max-membership principle

3.      Centroid method

4.      Weighted average method

5.      Mean-max membership

6.      Center of sums

7.      Center of largest area

8.      First of maxima , last of maxima

Lambda-cuts

Aλ is the lambda cut of fuzzy set A it is defined as

Weak lambda cut

Aλ ={x| μ A (x) ≥ λ}; λ [0,1]

Strong lambda cut

Aλ ={x| μ A (x) > λ}; λ [0,1]

Max-membership principle

Also known as height method limited to peak output functions.

μ C (x*) ≥ μ C (x) for all x ∈ X

 

Centroid method

Most commonly used method. Also known as center of are or center of gravity method.

x* = image

 

Weighted average method

This method is valid for symmetrical output membership function only. The function is weighted by its maximum membership value.

x*=image

Mean-max membership

Also known as middle of maxima. Related to max-membership method, except that the locations of the maximum membership can be nonunique.

clip_image002[4]

Center of sums

This method employs algebraic sum of individual fuzzy subsets instead of their union. The calculations here are very fast, but the common areas are added twice.

clip_image004[4]

Center of largest area

This method can be used when output consists of at least two convex fuzzy subsets which are not overlapping. The defuzzified value is the center of gravity of the largest area.

clip_image006[4]

Ci  is the largest area.

First of maxima , last of maxima

The first or last value with maximum value is selected

The steps involved are

clip_image008[4]

clip_image010[5]

clip_image012[5]

Wednesday, September 10, 2014

Performing classification using back propagation network in Scilab

The following steps must be followed

Enable ANN Toolbox under Data Analysis and Statistics in ATOMS

Sample code

in1 = csvRead('D:\siva\02-sep-14\sonar-all-data.csv');
in2 =csvRead('D:\siva\02-sep-14\sonar-result.csv');
x=in1';
t=in2';
rand('seed',0);
N = [60,30,30,30,1];
//N is neural network with 60 node input layer 3 hidden layer with 30 node each and 1 node output //layer
//lp is learning parameter with 0.5 learning rate and 0 error threshold
lp = [0.5, 0];
W = ann_FF_init(N);
//T no of epochs
T = 300;
//disp(x);
//disp(t);
W = ann_FF_Std_online(x,t,N,W,lp,T);
p=ann_FF_run(x,N,W);
o=round(p);
plot(t,'.r');
plot(o,'.g')

The file sonar-all-data.csv contain the features and sonar-result.csv contain the expected result.
The data classify material into rock and metal based on the features.
The files can be downloaded from
sonar-all-data.csv
sonar-result.csv
sample output