[GRASS-SVN] r56750 - grass-addons/grass7/raster/r.fuzzy/r.fuzzy.system
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jun 17 01:01:40 PDT 2013
Author: neteler
Date: 2013-06-17 01:01:39 -0700 (Mon, 17 Jun 2013)
New Revision: 56750
Modified:
grass-addons/grass7/raster/r.fuzzy/r.fuzzy.system/r.fuzzy.system.html
Log:
r.fuzzy.system.html: use nicer code CSS style
Modified: grass-addons/grass7/raster/r.fuzzy/r.fuzzy.system/r.fuzzy.system.html
===================================================================
--- grass-addons/grass7/raster/r.fuzzy/r.fuzzy.system/r.fuzzy.system.html 2013-06-17 07:59:37 UTC (rev 56749)
+++ grass-addons/grass7/raster/r.fuzzy/r.fuzzy.system/r.fuzzy.system.html 2013-06-17 08:01:39 UTC (rev 56750)
@@ -14,7 +14,7 @@
Any whitespaces like spaces, tabs, empty lines are allowed and may used to
visual format of rule file.
-<pre>$ set_name {side; points; boundary_shape; hedge; height }</pre>
+<div class="code"><pre>$ set_name {side; points; boundary_shape; hedge; height }</pre></div>
<ul>
<li><b>set_name</b>: Any name of the fuzzy set. Must not contain symbols: <i>
%,$ and #</i>
@@ -38,24 +38,24 @@
memebrship is equal to height.
</ul>
<p>An example of fuzzy sets definiton:
-<pre>$ moderate {both; 90,100,120,130; sshaped; 0; 1}</pre>
+<div class="code"><pre>$ moderate {both; 90,100,120,130; sshaped; 0; 1}</pre></div>
<b>Special notes about sets definition for output map:</b><br>
These sets shall be created as triangular (both sides) sets with linear
boundaries, without hedge and height modifiers:
-<pre>$ moderate {both; 0,20,20,40; linear; 0; 1}</pre>
+<div class="code"><pre>$ moderate {both; 0,20,20,40; linear; 0; 1}</pre></div>
</dd>
<dt><b>rules</b></dt>
<dd>A text file containing rules for classification.Th typical fuzzy rule
consists of one or more antecedents and one consequent:
-<pre>IF elev IS high AND distance IS low THEN probability IS small
+<div class="code"><pre>IF elev IS high AND distance IS low THEN probability IS small
where:
antecetends: elev IS high; distance IS low
consequent: probability IS small
-</pre>
+</pre></div>
The rule file has his own syntax. Because module creates only one result map,
the map name is ommited. Every rule starts with $ and consist of consequent name
@@ -73,9 +73,9 @@
<p>An example of fuzzy rules definiton:
-<pre>
+<div class="code"><pre>
$ small {distance = high & elev = high}
-</pre>
+</pre></div>
</dd>
</dl>
@@ -122,10 +122,10 @@
definition. It usually creates triangular consequent set definition.
</ul>
</dd>
-<dt><b>defuzz: deffuzyfication method</b></dt>
+<dt><b>defuzz: defuzzyfication method</b></dt>
<dd>Before deffuzification all consequents are agregated into one fuzzy set.
Defuzzification is the process of conversion of aggregated fuzzy set into one
-crisp value. The r.fuzzy.system provides 5 methods of deffuzyfication:
+crisp value. The r.fuzzy.system provides 5 methods of defuzzyfication:
<ul>
<li><b>centroid</b> center of mass of the fuzzy set (in practise weighted mean);
<li><b>bisector</b> a value which divide fuzzy set on two parts of equal area;
@@ -179,16 +179,16 @@
<p>
<b>Linear:</b> the membership is calculated according following equation:<br>
-<pre><code>
+<div class="code"><pre>
value <= A -> x = 0
A< value > B -> x = (value-A)/(B-A)
B <= value >= C -> x = 1
C< value > D -> x = (D-value)/(D-C)
value >= D -> x = 0
-</code></pre>
+</pre></div>
<b>S-shaped, G-shaped and J shaped:</b> use following equation to sommoth
boundary:
-<pre><code>
+<div class="code"><pre>
sin(x * Pi/2)^2 (for S-shaped)
tan(x * Pi/4)^2 (for J-shaped)
tan(x * Pi/4)^0.5 (for G-shaped)
@@ -196,7 +196,7 @@
where:
x current fuzzy value
A,B,C,D inflection point,
-</code></pre>
+</pre></div>
<h2>EXAMPLE</h2>
<p>
@@ -213,20 +213,20 @@
Suppose we want to determine the flood risk on some area (Spearfish dataset)
using two maps: distance to streams and elevation above streams. We can write
some common sense rules:
-<pre>
+<div class="code"><pre>
IF elevation IS low AND distance IS near THEN risk IS very probable
IF elevation IS low OR distance IS near THEN risk IS probable
IF elevation IS high AND distance IS far THEN risk IS unprobable
-</pre>
+</pre></div>
In clasical boolean sense, we would taken some limits of ideas "near" "far" etc,
but what about walues near the limit? The fuzzy set uses partial memberships
which abolish these restrictions. In that sense to set "near" belongs all areas
with distance no more than 100 m with full membership and from 100 to 200 m with
partial membership greater than 0. Over 200 m we can assume that is not near.
This allow to formulate fuzzy rules for distance map:
-<pre>
+<div class="code"><pre>
near: BELOW 100 = 1; FROM 100 TO 200 = {1 TO 0}; ABOVE 200 = 0;
-</pre>
+</pre></div>
To recive final map program calculate partial fuzzy set for all rules and next
agregate it into one fuzzy set. These fuzzy sets are created on value sequence
@@ -236,21 +236,21 @@
<p>
First we need two maps created with r.stream package:
-<pre>
+<div class="code"><pre>
r.stream.extract elevation=elevation.10m threshold=2000 \
stream_rast=streams direction=dirs
r.stream.order stream=streams dir=dirs horton=horton
r.mapcalc "horton3 = if(horton>2,horton,null())"
r.stream.distance stream=streams dir=dirs dem=elevation.10m method=downstream
distance=distance elevation=elevation
-</pre>
+</pre></div>
Next, to perform analysis we need two files: one with definition of map used in
analysis and definition of fuzzy sets for every map, and second with fuzzy
rules. For this example:
<p>MAPS
-<pre>
+<div class="code"><pre>
#flood.map
%elevation
$ low {right; 2,6; sshaped; 0; 1}
@@ -263,20 +263,20 @@
$ unprob {both; 0,20,20,40; linear; 0;1}
$ prob {both; 20,40,40,60; linear; 0;1}
$ veryprob {both; 40,60,60,80; linear; 0;1}
-</pre>
+</pre></div>
<p>RULES:
-<pre>
+<div class="code"><pre>
#flood.rul
$ unprob {elevation = high & distance = far}
$ prob {distance = near | elevation = low}
$ veryprob {distance = near & elevation = low}
-</pre>
+</pre></div>
finally we need run r.fuzzy.system:
-<pre>
+<div class="code"><pre>
r.fuzzy.system maps=flood.map rules=flod.rul output=flood
-</pre>
+</pre></div>
Resulting map should look like this below. Yellow color means no risk, red high
risk, green, blue end so on moderate risk.
More information about the grass-commit
mailing list