?? trips.html
字號:
</p> <p>In the plot above the surface viewer shows the output surface for two inputs <tt>population</tt> and <tt>num of dwelling units</tt>. As you can see the number of auto trips increases with increase in population and dwelling units, which sounds very rational. You can change the inputs in the X and Y drop-down boxes to observe the output surface with respect to the inputs you choose. </p><pre class="codeinput">ruleview(myfis)</pre><img vspace="5" hspace="5" src="trips_07.png"> <p><b>Figure 7:</b> Rule viewer that simulates the entire fuzzy inference process </p> <p><tt>ruleview</tt> is the graphical simulator for simulating the FIS response for specific values of the input variables. Now, having built the fuzzy system, if we want to understand how many trips will occur for a particular demographic setup, say an area with a particular population, a certain number of dwelling units and so on, this tool will help you simulate the FIS response for the input of your choice. </p> <p>Another feature of this GUI tool is, it gives you a snapshot of the entire fuzzy inference process, right from how the membership functions are being satisfied in every rule to how the final output is being generated through <a href="#28">defuzzification</a>. </p> <h2>Conclusion<a name="27"></a></h2> <p>This example has attempted to convey how clustering and fuzzy logic can be employed as effective techniques for data modeling and analysis. </p> <p>Fuzzy logic has also found various applications in other areas of technology like non-linear control, automatic control, signal processing, system identification, pattern recognition, time series prediction, data mining, financial applications etc., </p> <p>Explore other demos and the documentation for more insight into fuzzy logic and its applications.</p> <h2>Glossary<a name="28"></a></h2> <p><b>input space</b> - it is a term used to define the range of all possible values in the dataset. When using <tt>subclust</tt> the input space refers to the entire range of values between the maximum and minimum in each dimension (column) of the dataset. </p> <p><b>defuzzification</b> - the process of transforming a fuzzy output of a fuzzy inference system into a crisp output. </p> <p><b>firing strength</b> - The degree to which the antecedent part of a fuzzy rule is satisfied. Also known as degree of fulfillment. </p> <p><b>fuzzy inference system (FIS)</b> - The overall name for a system that uses fuzzy reasoning to map an input space to an output space </p> <p><b>Reference:</b></p> <p>[Chi94] - S. Chiu, "Fuzzy Model Identification Based on Cluster Estimation," J. of Intelligent & Fuzzy Systems, Vol. 2, No. 3, 1994. </p> <p class="footer">Copyright 1994-2005 The MathWorks, Inc.<br> Published with MATLAB® 7.1<br></p> </div> <!--##### SOURCE BEGIN #####%% Modeling Traffic Patterns using Subtractive Clustering% This demo demonstrates the use of subtractive clustering to model traffic% patterns in an area based on the area's demographics.%% Copyright 1994-2005 The MathWorks, Inc.% $Revision: 1.12.2.2.2.1 $Date: 2005/07/17 06:06:22 $%%% The problem: Understanding Traffic Patterns% In this demo we attempt to understand the relationship between the number% of automobile trips generated from an area and the area's demographics.% Demographic and trip data were collected from traffic analysis zones% in New Castle County, Delaware. Five demographic factors are considered:% population, number of dwelling units, vehicle ownership, median household% income and total employment. %% Hereon, the demographic factors will be addressed as inputs and the% trips generated will be addressed as output. Hence our problem has five% input variables (five demographic factors) and one output variable% (num of trips generated).%%% The Data% We will now load the input and output variables used for this demo into% the workspace. % tripdata%%% Two variables are loaded in the workspace, |datin| and |datout|. |datin|% has 5 columns representing the 5 input variables and |datout| has 1% column representing the 1 output variable.%subplot(2,1,1)plot(datin)legend('population', 'num. of dwelling units', 'vehicle ownership',... 'median household income', 'total employment');title('Input Variables')subplot(2,1,2)plot(datout)legend('num of trips');title('Output Variable')%%% *Figure 1:* Input and Output variables %%% The number of rows in |datin| and |datout|, 75, represent the number of% observations or samples or datapoints available. A row in |datin|, say% row 11, constitutes a set of observed values of the 5 input variables% (population, number of dwelling units, vehicle ownership, median% household income and total employment) and the corresponding row, row 11,% in |datout| represents the observed value for the number of trips% generated given the observations made for the input variables.%% We will model the relationship between the input variables (demographics)% and the output variable (trips) by first clustering the data. The cluster% centers will then be used as a basis to define a Fuzzy Inference System% (FIS) which can then be used to explore and understand traffic patterns.%%% Why clustering and fuzzy logic?% Clustering can be a very effective technique to identify natural% groupings in data from a large data set, thereby allowing concise% representation of relationships embedded in the data. In this example,% clustering allows us to group traffic patterns into broad categories% hence allowing for easier understandability.%% Fuzzy logic is an effective paradigm to handle uncertainty. It can be% used to take fuzzy or imprecise observations for inputs and yet arrive at% crisp and precise values for outputs. Also, the% <matlab:helpview([docroot,'/toolbox/fuzzy/fuzzy.map'],'fuzzy_inference_systems') Fuzzy Inference System (FIS)> % is a simple and commonsensical way to build systems without using complex% analytical equations.%% In our example, fuzzy logic will be employed to capture the broad% categories identified during clustering into a Fuzzy Inference System% (FIS). The FIS will then act as a model that will reflect the% relationship between demographics and auto trips. %% Clustering and fuzzy logic together provide a simple yet powerful means% to model the traffic relationship that we want to study.%%% Clustering the data% |subclust| is the function that implements a clustering technique called% subtractive clustering. Subtractive clustering, [Chi94], is a fast,% one-pass algorithm for estimating the number of clusters and the cluster% centers in a dataset.%% In this section, we will see how subtractive clustering is performed on a% dataset and in the next section we will explore independently how% clustering is used to build a Fuzzy Inference System(FIS).[C,S] = subclust([datin datout],0.5);%%% The first argument to the |subclust| function is the data to be% clustered. The second argument to the function is the |radii| which% marks a cluster's radius of influence in the <#28 input space>.%% The variable |C| now holds all the centers of the clusters that have been% identified by |subclust|. Each row of |C| contains the position of a% cluster.C%% % In this case, |C| has 3 rows representing 3 clusters with 6 columns% representing the positions of the clusters in each dimension.%% |subclust| has hence identified 3 natural groupings in the% demographic-trip dataset being considered. The following plot shows how% the clusters have been identified in the 'total employment' and 'trips'% dimensions of the input space.clf;plot(datin(:,5), datout(:,1), '.', C(:,5),C(:,6),'r*')legend('Data points', 'Cluster centers', 'Location', 'SouthEast')xlabel('total employment')ylabel('num of trips')title('Data and Clusters in selected two dimensions of the input space')%%% *Figure 2:* Cluster centers in the 'total employment' and 'trips'% dimensions of the input space%%% The variable |S| contains the sigma values that specify the range of% influence of a cluster center in each of the data dimensions. All cluster% centers share the same set of sigma values.S%%% |S| in this case has 6 columns representing the influence of the cluster% centers on each of the 6 dimensions.%%% Generating the Fuzzy Inference System (FIS)%% |genfis2| is the function that creates a FIS using subtractive% clustering. |genfis2| employs |subclust| behind the scenes to cluster the% data and uses the cluster centers and their range of influences to build% a FIS which will then be used to explore and understand traffic patterns.myfis=genfis2(datin,datout,0.5);%%% The first argument is the input variables matrix |datin|, the second% argument is the output variables matrix |datout| and the third argument% is the |radii| that should be used while using |subclust|.%% |genfis2| assigns default names for inputs, outputs and membership% functions. For our understanding it is beneficial to rename the inputs% and outputs meaningfully.% Assign names to inputs and outputsmyfis = setfis(myfis, 'input',1,'name','population');myfis = setfis(myfis, 'input',2,'name','dwelling units');myfis = setfis(myfis, 'input',3,'name','num vehicles');myfis = setfis(myfis, 'input',4,'name','income');myfis = setfis(myfis, 'input',5,'name','employment');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -