Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
calc_reciprocal_similarity_map [2015/10/11 21:22] admin |
calc_reciprocal_similarity_map [2026/08/28 03:11] (current) hermann Sync from local documentation review |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Calc Reciprocal Similarity Map ====== | + | ====== Calc Reciprocal Similarity Map ====== |
| ===== Description ===== | ===== Description ===== | ||
| - | This functor calculates fuzzy similarity indices between maps. | + | Calculates fuzzy similarity indices between two categorical maps. Instead of comparing cells one-to-one, each cell is compared against a neighborhood of cells around the corresponding location in the other map, following the method described by Hagen (2003), "Fuzzy set approach to assessing similarity of categorical maps." This produces two directional similarity maps: how well the first map matches the neighborhood of the second, and how well the second matches the neighborhood of the first. |
| ===== Inputs ===== | ===== Inputs ===== | ||
| - | ^ Name ^ Type ^ Description ^ | + | ^ Name ^ Type ^ Description ^ |
| - | | First Map | [[Categorical Map Type|Categorical Map ]] | A map consisting of classes or categories. | | + | | First Map | [[Categorical Map Type]] | A map consisting of classes or categories. Its format is used to determine the format of the resulting similarity maps. | |
| - | | Second Map | [[Categorical Map Type|Categorical Map ]] | A map consisting of classes or categories. | | + | | Second Map | [[Categorical Map Type]] | A map consisting of classes or categories. | |
| ===== Optional Inputs ===== | ===== Optional Inputs ===== | ||
| ^ Name ^ Type ^ Description ^ Default Value ^ | ^ Name ^ Type ^ Description ^ Default Value ^ | ||
| - | | Window Size | [[Positive Int Type|Positive Int]] | Window size with equal number of lines and columns. Only odd numbers are acceptable. | 5 | | + | | Window Size | [[Positive Integer Value Type]] | Window size, with equal number of lines and columns, used to compute the similarities. Only odd numbers are acceptable. | 5 | |
| - | | Use Exponential Decay | [[Bool Type|Bool]] | If true, the similarity is calculated using an exponential decay function truncated by the window size. Otherwise, a constant function is used within the specified window. | True | | + | | Use Exponential Decay | [[Boolean Value Type]] | If true, the similarity is calculated using an exponential decay function truncated by the window size. Otherwise, a constant function is used, in which the similarity is 1 if a matching cell is found within the search window, and zero if not. | Yes | |
| - | | Cell Type | [[Cell Type Type|Cell Type]] | Data cell type. | Signed 8 Bit Integer | | + | | Cell Type | [[Cell Type Type]] | Cell type of the similarity maps. The calculated similarities, originally in the [0, 1] range, are converted to this type. If Cell Type is a floating point type, no conversion is performed and the values are kept in the original [0, 1] range. | Signed 8 Bit Integer | |
| - | | Null Value | [[Null Value Type|Null Value]] | Null value. | -128 | | + | | Null Value | [[Null Value Type]] | Null value of the similarity maps. | Provided automatically | |
| - | | Exponential Decay Divisor | [[Real Value Type|Real Value]] | Value used to attenuate the distance in the exponential decay function. This value must be increased when the "Use Exponential Decay" is greater the 11.((See the [[calc_reciprocal_similarity_map#exponential_decay_function|exponential decay function documentation]] for more details.)) | 2 | | + | | Exponential Decay Divisor | [[Real Value Type]] | Value used to attenuate the distance in the exponential decay function. This value must be greater than zero, and should be increased when Use Exponential Decay is set to a wider window. This is an advanced port. | 2 | |
| - | ===== Output ===== | + | |
| - | ^ Name ^ Type ^ Description ^ | + | ===== Outputs ===== |
| - | | First Similarity | [[Map Type|Map ]] | Map showing the degree of spatial match from the first to the second input map. Similarity varies from zero (no match) to 1 (perfect match) within the specified window size. | | + | |
| - | | Second Similarity | [[Map Type|Map ]] | Map showing the degree of spatial match from the second to the first input map. Similarity varies from zero (no match) to 1 (perfect match) within the specified window size. | | + | ^ Name ^ Type ^ Description ^ |
| - | | First Mean | [[Real Value Type|Real Value ]] | The mean similarity index for the given window size comparing the first map to the second. | | + | | First Similarity | [[Map Type]] | Map showing the degree of spatial match from the first to the second input map. Similarity varies from zero (no match) to 1 (perfect match) within the specified window size. | |
| - | | Second Mean | [[Real Value Type|Real Value ]] | The mean similarity index for the given window size comparing the second map to the first. | | + | | First Mean | [[Real Value Type]] | The mean similarity index, for the given window size, comparing the first map to the second. | |
| + | | Second Similarity | [[Map Type]] | Map showing the degree of spatial match from the second to the first input map. Similarity varies from zero (no match) to 1 (perfect match) within the specified window size. | | ||
| + | | Second Mean | [[Real Value Type]] | The mean similarity index, for the given window size, comparing the second map to the first. | | ||
| ===== Group ===== | ===== Group ===== | ||
| Line 33: | Line 34: | ||
| ===== Notes ===== | ===== Notes ===== | ||
| - | Spatial models require a comparison within a neighborhood context, because even maps that do not match exactly pixel-by-pixel could still present similar spatial patterns and likewise spatial agreement within a certain pixel vicinity. To address this issue several vicinity-based comparison methods have been developed. For example, Costanza (1989) introduced the multiple resolution fitting procedure that compares a map fit within increasing window sizes. Pontius (2002) presented a method similar to Costanza (1989), but differentiates errors due to location and quantity. Power et al. (2001) provided a comparison method based on hierarchical fuzzy pattern matching. In turn, Hagen (2003) developed new metrics, including the //Kfuzzy//, considered to be equivalent to the Kappa statistic, and the fuzzy similarity which takes into account the fuzziness of location and category within a cell neighborhood. The method we introduce here is a modification of this latter. | + | Comparing two maps cell by cell tends to underestimate their spatial agreement, since two maps can show a similar spatial pattern without their cells lining up exactly. This functor addresses that by comparing each cell against a neighborhood of cells in the other map rather than against a single corresponding cell. |
| - | The //fuzzy similarity// test is based on the concept of fuzziness of location, in which a representation of a cell is influenced by the cell itself and, to a lesser extent, by the cells in its neighborhood (Hagen, 2003). Not considering fuzziness of category, the fuzzy neighborhood vector can represent the fuzziness of location. First a crisp vector is associated to each cell in the map. This vector has as many positions as map categories, assuming 1 for a category = //i// and 0 for categories other than //i//. Thus the fuzzy neighborhood vector (V<sub>nbhood</sub>) for each cell is determined as follows: | + | Because the comparison is directional, the similarity from the first map to the second is generally not the same as the similarity from the second map to the first. It is recommended to compare both directions and consider the lower of the two, since random maps tend to score higher than expected. |
| - | <m>V_{nbhood}=(matrix{4}{1}{mu_{nbhood}_{1} mu_{nbhood}_{2} vdots mu_{nbhood}_{C}})</m> (11) @@@@@@@@@@@@ <m>V_{mbhood}=(matrix{4}{1}{mu_{mbhood}_{1} mu_{mbhood}_{2} vdots mu_{mbhood}_{C}})</m> (12) | + | When Use Exponential Decay is enabled, the contribution of a neighboring cell to the similarity score decays exponentially with its distance from the window center, following S = 1/2^(d/A), where d is the distance from the center and A is the Exponential Decay Divisor. A smaller Exponential Decay Divisor makes the similarity value fall off more sharply with distance, while a larger divisor spreads the decay out so that farther cells within the window still contribute meaningfully to the score. When Use Exponential Decay is false, a constant function is used instead: any matching cell found within the window contributes fully to the similarity, regardless of its distance from the center. |
| - | where //mnbhood<sub>i</sub>// represents the membership for category //i// within a neighborhood of //N// cells (usually //N = n<sup>2</sup>//); //mcrisp<sub>i,j</sub>// is the membership of category //i// for neighboring cell //j//, assuming, as in a crisp vector, 1 for //i// and 0 for categories other than //i// (<m>i in C</m>) and //m<sub>j</sub>// is the distance based membership of neighboring cell //j//. //m// represents a distance decay function, for instance, an exponential decay (//m=2<sup>-d/A</sup>// where //d// is the distance and //A// is the distance attenuation). Although spatially continuous, to facilitate computation this decay function most often becomes truncated outside of the neighborhood window //n x n//. Which function is most appropriate and the size of the window depends on the vagueness of the data and the allowed tolerance for spatial error (Hagen, 2003). As we want to assess the model’s spatial fit at various resolutions, in addition to an exponential decay, a constant function equal to 1 inside the neighborhood window and 0 outside of it is also applied. Equation (14) sets the category membership for the central cell, assuming the highest contribution found within a neighborhood window //n x n//. Next, a similarity measure for a pair of maps can be obtained through a cell-by-cell fuzzy set intersection between their fuzzy and crisp vectors using the following equations: | + | This method should not be applied directly to simulation maps. Compute the maps of changes first and compare those instead, since simulation maps typically contain a large proportion of unchanged background cells that would inflate the similarity score without reflecting the simulation's actual accuracy. |
| - | <m>S(V_A,V_B)=delim{[}{delim{|}{mu_{A,1},mu_{B,1}}{|}_{Min}, delim{|}{mu_{A,2},mu_{B,2}}{|}_{Min}, cdots, delim{|}{mu_{A,i},mu_{B,i}}{|}_{Min}}{]}_{Max}</m> (13) | + | If the map used to control the similarity calculation contains only null cells, the resulting mean similarity is defined as 1. |
| - | where //V<sub>A</sub>// and //V<sub>B</sub>// represent the fuzzy neighborhood vectors for maps //A// and //B// and //m<sub>A,j</sub>// and //m<sub>B,j</sub>// are their neighborhood memberships for categories <m>i in C</m> in maps //A// and //B//, as in equation (13). According to Hagen (2003), since the similarity measure //S(V<sub>A</sub>,V<sub>B</sub>)// tends to overestimate the spatial fit, the two-way similarity is instead applied, so that: | + | Reports an error if Window Size is not an odd number. |
| - | <m>S_{TwoWay}(A,B)=delim{|}{S(V_{nbhood}_A,V_{crisp}_B),S(V_{crisp}_A,V_{nbhood}_B)}{|}_{Min}</m> (14) | + | Reports an error if Exponential Decay Divisor is not greater than zero. |
| - | The overall similarity of a pair of maps can be calculated by averaging the two-way similarity values for all map cells. As random maps tend to score higher, it is recommended picking up the minimum fit value from the two-way comparison. | + | Reports an error if Null Value is not compatible with Cell Type. |
| - | ==== Exponential Decay Function ==== | + | Reports a warning if Cell Type could degrade performance. |
| - | The exponential decay function used to calculate similarity can be seen below: | + | **References** |
| - | <m>S=1/2^(d/A)</m> | + | Costanza, R., 1989. Model goodness of fit: a multiple resolution procedure. Ecological Modelling, 47, 199-215. |
| - | where //d// is the distance from the window center and //A// is the attenuation factor [Exponential Decay Divisor]. | + | |
| - | The attenuation parameter can be used to control how fast the exponential function value decreases. The graphs below illustrates: | + | Goodacre, C. M., Bonham-Carter, G. F., Agterberg, F. P., Wright, D. F., 1993. A statistical analysis of spatial association of seismicity with drainage patterns and magnetic anomalies in western Quebec. Tectonophysics, 217, 205-305. |
| - | [{{:exponential_decay_function_x_1.png?direct&450|Exponential Decay Function with A=1}}] | + | Hagen, A., 2003. Fuzzy set approach to assessing similarity of categorical maps. International Journal of Geographical Information Science, 17(3), 235-249. |
| - | + | ||
| - | [{{:exponential_decay_function_x_2.png?direct&450|Exponential Decay Function with A=2}}] | + | |
| - | + | ||
| - | [{{:exponential_decay_function_x_4.png?direct&450|Exponential Decay Function with A=4}}] | + | |
| - | + | ||
| - | [{{:exponential_decay_function_x_10.png?direct&450|Exponential Decay Function with A=10}}] | + | |
| - | + | ||
| - | ==== References ==== | + | |
| - | + | ||
| - | Costanza, R., 1989. Model goodness of fit: a multiple resolution procedure. Ecological Modelling, 47, 199-215. | + | |
| - | + | ||
| - | Goodacre C. M., Bonham-Carter G. F., Agterberg, F. P., Wright D. F., 1993. A statistical analysis of spatial association of seismicity with drainage patterns and magnetic anomalies in western Quebec. Tectonophysics, 217, 205-305. | + | |
| - | + | ||
| - | Hagen, A., 2003. Fuzzy set approach to assessing similarity of categorical maps. International Journal of Geographical Information Science, 17(3), 235–249 | + | |
| Pontius, R.G. Jr., 2002. Statistical Methods to Partition Effects of Quantity and Location During Comparison of Categorical Maps at Multiple Resolutions. Photogrammetric Engineering & Remote Sensing 68(10), 1041-1049. | Pontius, R.G. Jr., 2002. Statistical Methods to Partition Effects of Quantity and Location During Comparison of Categorical Maps at Multiple Resolutions. Photogrammetric Engineering & Remote Sensing 68(10), 1041-1049. | ||
| - | Power, C., Simms, A., White, R., 2001. Hierarchical fuzzy pattern matching for the regional comparison of Land Use Maps International Journal of Geographical Information Science 15(1), 77-100. | + | Power, C., Simms, A., White, R., 2001. Hierarchical fuzzy pattern matching for the regional comparison of Land Use Maps. International Journal of Geographical Information Science 15(1), 77-100. |
| ===== Internal Name ===== | ===== Internal Name ===== | ||
| CalcReciprocalSimilarityMap | CalcReciprocalSimilarityMap | ||
| + | |||
| + | ===== Usage examples ===== | ||
| + | |||
| + | See practical examples of this functor in [[lesson_18|Lesson 18: Building a land-use and land-cover change simulation model]] | ||