0% found this document useful (0 votes)
139 views4 pages

Expert System Lab Work: Genfis1 and Anfis Function

This document provides information and examples for using the genfis1 and anfis functions in MATLAB's Fuzzy Logic Toolbox. Genfis1 generates an initial fuzzy inference system (FIS) structure from input data without clustering. Anfis then takes the initial FIS and training data to optimize the membership function parameters using either a hybrid method or backpropagation method. Examples are given to generate an initial FIS from sample data using genfis1, then train it over 50 epochs using anfis.

Uploaded by

Prabhu Ram
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
139 views4 pages

Expert System Lab Work: Genfis1 and Anfis Function

This document provides information and examples for using the genfis1 and anfis functions in MATLAB's Fuzzy Logic Toolbox. Genfis1 generates an initial fuzzy inference system (FIS) structure from input data without clustering. Anfis then takes the initial FIS and training data to optimize the membership function parameters using either a hybrid method or backpropagation method. Examples are given to generate an initial FIS from sample data using genfis1, then train it over 50 epochs using anfis.

Uploaded by

Prabhu Ram
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

12/29/2011

EXPERT SYSTEM LAB WORK

genfis1 and anfis function

Chapter #13

genfis1
Generate an FIS structure from data without data clustering. genfis1 generates a Sugeno-type FIS structure used as initial conditions for anfis Example: myfis = genfis1(data,numMFs,inmftype, outmftype)

myfis = genfis1(data,numMFs,inmftype, outmftype) data is the training data matrix, which must be entered with all but the last column representing the single output. numMFs is a vector whose coordinates specify the number of membership functions associated with each input. If you want the same number of membership functions to be associated with each input, then it suffices to make numMFs a single number.

12/29/2011

myfis = genfis1(data,numMFs,inmftype, outmftype) inmftype is a string array in which each row specifies the membership function type associated with each input. Again, this can be a one-dimensional single string if the type of membership functions associated with each input is the same. outmftype is a string that specifies the membership function type associated with the output. There can only be one output, since this is a Sugeno-type system. linear constant.

genfis1 example
mfnya=[3 3 3 3 3]; fmnya=str2mat('gaussmf','gaussmf','gaussmf','gaussmf','gaussmf'); myfis = genfis1(mydata,mfnya,fmnya,'linear');

anfis
Used for Training data for creating fis model

Example: [fismat1,error1,stepsize] = anfis(trnData,myfis,trnOpt,dispOpt)

12/29/2011

Explanations
trnData: the name of a training data set. This is a matrix with all but the last column containing input data, while the last column contains a single vector of output data. myfis: the name of an FIS, (fuzzy inference system) used to provide anfis with an initial set of membership functions for training. This FIS should have been buitl by the genfis1 function

Explanations
trnOpt: vector of training options.When any training option is entered as NaN the default options will be in force. These options are as follows: - trnOpt(1): training epoch number (default: 10) trnOpt(2): training error goal (default: 0) trnOpt(3): initial step size (default: 0.01) trnOpt(4): step size decrease rate (default: 0.9) trnOpt(5): step size increase rate (default: 1.1)

Explanations
dispOpt: vector of display options that specify what message to display in the MATLAB command window during training. The default value for any display option is 1, which means the corresponding information is displayed. A 0 means the corresponding information is not displayed on the screen. When any display option is entered as NaN, the default options will be in force. These options are as follows: dispOpt(1):ANFIS information, such as numbers of input and output membership functions, and so on (default: 1) dispOpt(2): error (default: 1) dispOpt(3): step size at each parameter update (default: 1) dispOpt(4): final results (default: 1)

12/29/2011

Explanations
chkData: the name of an optional checking data set for overfitting model validation.This data set is a matrix in the same format as the training data set.

optMethod: optional optimization method used in membership function parameter training: either 1 for the hybrid method or 0 for the backpropagation method.The default method is the hybrid method, which is a combination of least squares estimation with backpropagation.The default method is invoked whenever the entry for this argument is anything but 0.

anfis example
myfis = genfis1(mydata,mfnya,fmnya,'linear'); result = anfis(mydata,myfis,10); - epoch = 10

Complete Source Code


Data = dataAnfisIris.dat; numMFs=[3 3 3 3] inmftype=char('trapmf','gaussmf','trimf','gaussmf'); fisku = genfis1(data,numMFs,inmftype,'constant'); ruleview(fisku) [fismat1,error1,stepsize] = anfis(data,fisku,50); ruleview(fismat1) y1 = evalfis(x,fisku) y2 = evalfis(x,fismat1)

You might also like