📄 trips.html
字号:
<!--This HTML is auto-generated from an m-file.Your changes will be overwritten.--><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:x-large">Model Identification</p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">This is a demonstration of subtractive clustering and how it can be usedwith multi-dimensional data.</p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">Copyright 1994-2002 The MathWorks, Inc.$Revision: 1.12 $</p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:medium; page-break-before: auto;"><a name=""></a></p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">This is a plot of the input data for a model identificationproblem. We are interested in estimating the numberof auto trips generated from an area based on the area'sdemographics. Five factors were considered: population,number of houses, vehicle ownership, income, and employment.</p><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="position: relative; left:30px">tripdataplot(datin)</pre><img xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" vspace="5" hspace="5" src="trips_img_02_01.gif"><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:medium; page-break-before: auto;"><a name=""></a></p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">Using the GENFIS2 function (which is based on thesubtractive clustering algorithm in the SUBCLUST function),we generate a fuzzy inference system that calculates theoutput based on the five inputs.</p><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="position: relative; left:30px">a=genfis2(datin,datout,0.45);plotfis(a);</pre><img xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" vspace="5" hspace="5" src="trips_img_03_01.gif"><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:medium; page-break-before: auto;"><a name=""></a></p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">The upper plot displays 75 data points for the five inputvariables. The lower plot displays the corresponding outputsand the outputs predicted by the fuzzy model.</p><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="position: relative; left:30px">subplot(1,1,1)fuzout=evalfis(datin,a);subplot(2,1,1)plot(datin)subplot(2,1,2)plot([datout fuzout])</pre><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:gray; font-style:italic;">Warning: Implication method should be "prod" for Sugeno systems.</pre><img xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" vspace="5" hspace="5" src="trips_img_04_01.gif"><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:medium; page-break-before: auto;"><a name=""></a></p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">Here is a plot of the actual output values (X axis) versus thepredicted output values (Y axis). If the prediction were aperfect one, the data points would lie right along the diagonalline X = Y.</p><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="position: relative; left:30px">subplot(1,1,1)plot(datout,fuzout,<span style="color:#B20000">'bx'</span>,[0 10],[0 10],<span style="color:#B20000">'r:'</span>)xlabel(<span style="color:#B20000">'Actual Value'</span>)ylabel(<span style="color:#B20000">'Predicted Value'</span>)axis square</pre><img xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" vspace="5" hspace="5" src="trips_img_05_01.gif"><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:medium; page-break-before: auto;"><a name=""></a></p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">We set aside 25 of the original 100 data points as checkingdata. Since we did not use this data to create our model, itis a useful measure of how good our model is.</p><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="position: relative; left:30px">chkfuzout=evalfis(chkdatin,a);plot(chkdatout,chkfuzout,<span style="color:#B20000">'bx'</span>,[0 10],[0 10],<span style="color:#B20000">'r:'</span>)axis squarexlabel(<span style="color:#B20000">'Actual Value'</span>)ylabel(<span style="color:#B20000">'Predicted Value'</span>)</pre><pre xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:gray; font-style:italic;">Warning: Implication method should be "prod" for Sugeno systems.</pre><img xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" vspace="5" hspace="5" src="trips_img_06_01.gif"><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" style="color:#990000; font-weight:bold; font-size:medium; page-break-before: auto;"><a name=""></a></p><p xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">Clustering can be a very effective technique for dealing withlarge sets of data: the principal idea is to distill naturalgroupings of data from a large data set thereby allowingconcise representation of a model's behavior. This demo hasshown how accurate predictions can be made despite themulti-dimensional nature of the problem. With the results of thisclustering experiment in hand, we could now potentially go onto use other techniques, such as ANFIS.</p><originalCode xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd" code="%% Model Identification
% This is a demonstration of subtractive clustering and how it can be used
% with multi-dimensional data.
%
% Copyright 1994-2002 The MathWorks, Inc. 
% $Revision: 1.12 $

%%
% This is a plot of the input data for a model identification
% problem. We are interested in estimating the number
% of auto trips generated from an area based on the area's
% demographics. Five factors were considered: population,
% number of houses, vehicle ownership, income, and employment.

tripdata
plot(datin)

%%
% Using the GENFIS2 function (which is based on the
% subtractive clustering algorithm in the SUBCLUST function),
% we generate a fuzzy inference system that calculates the
% output based on the five inputs.

a=genfis2(datin,datout,0.45);
plotfis(a);

%%
% The upper plot displays 75 data points for the five input
% variables. The lower plot displays the corresponding outputs
% and the outputs predicted by the fuzzy model.

subplot(1,1,1)
fuzout=evalfis(datin,a);
subplot(2,1,1)
plot(datin)
subplot(2,1,2)
plot([datout fuzout])

%%
% Here is a plot of the actual output values (X axis) versus the
% predicted output values (Y axis). If the prediction were a
% perfect one, the data points would lie right along the diagonal
% line X = Y.

subplot(1,1,1)
plot(datout,fuzout,'bx',[0 10],[0 10],'r:')
xlabel('Actual Value')
ylabel('Predicted Value')
axis square

%%
% We set aside 25 of the original 100 data points as checking
% data. Since we did not use this data to create our model, it
% is a useful measure of how good our model is.

chkfuzout=evalfis(chkdatin,a);
plot(chkdatout,chkfuzout,'bx',[0 10],[0 10],'r:')
axis square
xlabel('Actual Value')
ylabel('Predicted Value')

%%
% Clustering can be a very effective technique for dealing with
% large sets of data: the principal idea is to distill natural
% groupings of data from a large data set thereby allowing
% concise representation of a model's behavior. This demo has
% shown how accurate predictions can be made despite the
% multi-dimensional nature of the problem. With the results of this
% clustering experiment in hand, we could now potentially go on
% to use other techniques, such as ANFIS.
"></originalCode>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -