⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 anfis.m

📁 最新模糊逻辑工具箱
💻 M
字号:
function [t_fismat, t_error, stepsize, c_fismat, c_error] ...
    = anfis(trn_data, in_fismat, t_opt, d_opt, chk_data, method)
%ANFIS   Training routine for Sugeno-type FIS (MEX only).
%   Synopsis
%   [fismat,error1,stepsize] = anfis(trnData)
%   [fismat,error1,stepsize] = anfis(trnData,fismat)
%   [fismat1,error1,stepsize] = ...
%   anfis(trnData,fismat,trnOpt,dispOpt)
%   [fismat1,error1,stepsize,fismat2,error2] = ...
%   anfis(trnData,trnOpt,dispOpt,chkData)
%   [fismat1,error1,stepsize,fismat2,error2] = ...
%   anfis(trnData,trnOpt,dispOpt,chkData,optMethod)
%   
%   Description
%   This is the major training routine for Sugeno-type fuzzy inference systems.
%   anfis uses a hybrid learning algorithm to identify parameters of
%   Sugeno-type fuzzy inference systems. It applies a combination of the
%   least-squares method and the backpropagation gradient descent method for
%   training FIS membership function parameters to emulate a given training
%   data set. anfis can also be invoked using an optional argument for model
%   validation. The type of model validation that takes place with this option
%   is a checking for model overfitting, and the argument is a data set called
%   the checking data set.
%   The arguments in the above description for anfis are as follows:
%   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.
%   fismat: the name of an FIS, (fuzzy inference system) used to provide anfis
%   with an initial set of membership functions for training. Without this
%   option, anfis will use genfis1 to implement a default initial FIS for
%   training. This default FIS will have two membership functions of the
%   Gaussian type, when invoked with only one argument. If fismat is provided
%   as a single number (or a vector), it is taken as the number of membership
%   functions (or the vector whose entries are the respective numbers of
%   membership functions associated with each respective input, when these
%   numbers differ for each input). In this case, both  arguments of anfis are
%   passed to genfis1 to generate a valid FIS matrix before starting the
%   training process.
%   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)
%   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)
%   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.
%   The training process stops whenever the designated epoch number is reached
%   or the training error goal is achieved.
%   Note on anfis arguments:
%   When anfis is invoked with two or more arguments, any optional arguments
%   will take on their default values if they are entered as NaNs or empty
%   matrices. Default values can be changed directly by modifying the file
%   anfis.m. NaNs or empty matrices must be used as place-holders for variables
%   if you don抰 want to specify them, but do want to specify succeeding
%   arguments, for example, when you implement the checking data option of
%   anfis.
%   The range variables in the above description for anfis are as follows:
%   fismat1 is the FIS structure whose parametes are set according to a minimum
%   training error criterion.
%   error1 or error2 is an array of root mean squared errors, representing the
%   training data error signal and the checking data error signal,
%   respectively.
%   stepsize is an array of step sizes. The step size is decreased (by
%   multiplying it with the component of the training option corresponding to
%   the step size decrease rate) if the error measure undergoes two consecutive
%   combinations of an increase followed by a decrease. The step size is
%   increased (by multiplying it with the increase rate) if the error measure
%   undergoes four consecutive decreases.
%   fismat2 is the FIS structure whose parametes are set according to a minimum
%   checking error criterion.
%   Example
%   x = (0:0.1:10)';
%   y = sin(2*x)./exp(x/5);
%   trnData = [x y];
%   numMFs = 5;
%   mfType = 'gbellmf';
%   epoch_n = 20;
%   in_fismat = genfis1(trnData,numMFs,mfType);
%   out_fismat = anfis(trnData,in_fismat,20);
%   plot(x,y,x,evalfis(x,out_fismat));
%   legend('Training Data','ANFIS Output');
%   See Also
%   genfis1, anfis
%   References
%   Jang, J.-S. R., 揊uzzy Modeling Using Generalized Neural Networks and
%   Kalman Filter Algorithm,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -