# Javalanche: An Avalanche Predictor

The model is to be applied when there has been snowfall during the last 24-hour period. There are three input variables:

Slope_Pitch, the average slope angle (degrees) in the region of the suspected avalanche danger

Water_Equiv, the snowfall's water content (centimeters of equivalent water)

Current_Temp, the current temperature (Celsius)

To introduce fuzzy sets, we'll start with the input variable, Slope_Pitch. Wild slopes do not, of course, have constant pitch and even a measurement of average pitch is approximate. Nor is it clear that the distinction between a number like 15.2 degrees and 17.3 degrees is all that useful. Fuzzy sets provide a way to incorporate that inherent fuzziness into a model. We somewhat arbitrarily classify the Slope_Pitch variable into four categories, based loosely on the corresponding skiing ability needed to competently negotiate the terrain. These categories are Novice, Intermediate, Advanced and Expert.

**Figure 1. Fuzzy
Set for Novice Slope_Pitch**

**Figure 2. The
Four Fuzzy Sets for Slope_Pitch**

There is no widely accepted ski industry standard for these terms, but there is an approximate agreement on what they imply. For example, most skiers would consider the pitch range of 0 to 10 degrees as Novice, but there would be less agreement on the angle at which the slope would be considered no longer Novice, but Intermediate. Fuzzy Logic would accommodate this uncertainty by defining a fuzzy set for novice slope pitch as shown in Figure 1, where the vertical axis is called the degree of membership (dom). In Figure 2, the fuzzy sets for Intermediate, Advanced and Expert are incorporated as well. Looking at Figure 2, an input Slope_Pitch of 17.5 degrees would have a degree of membership of 0.25 in the Novice category and of 0.75 in the Intermediate category, reflecting the fuzzy transition from Novice to Intermediate Slope_Pitch. Ascertaining the doms of the various input values is called the fuzzification process.

**Figure 3. The
Three Fuzzy Sets for Water_Equiv**

**Figure 4. The
Three Fuzzy Sets for Current_Temp**

Figures 3 and 4 show fuzzy set choices for the other two input variables, Water_Equiv and Current_Temp. The choices of fuzzy set ranges and shapes are somewhat arbitrary, but should be guided by the knowledge of the expert. From Figures 2, 3, and 4 we see that the model has the following sets:

Four fuzzy sets for Slope_Pitch

Three fuzzy sets for Water_Equiv

Three fuzzy sets for Current_Temp

There is only one output variable, Avalanche_Danger. It is scaled from 0 to 100. It is tempting to interpret this as the probability of avalanche, but at this current stage of development it is an arbitrary scale. If the model were significantly enhanced and then used both extensively and successfully, this parameter could be calibrated and perhaps be rather like a probability. Figure 5 depicts the four fuzzy set categories for Avalanche_Danger.

**Figure 5. The
Four Fuzzy Sets for Avalanche_Danger**

Note that the expert snow scientist must be consulted by the programmer to construct the fuzzy sets. It can be expected that these would be modified and additional inputs incorporated as experience with the model is gained.

Rules come in both conditional and unconditional varieties.
For Javalanche, only conditional rules are currently implemented. A
typical rule might be “If Water_Equiv is Small AND Slope_Pitch is
Novice AND Current_Temp is Below_Freezing, then Avalanche_Danger is
Low.” The **if** clause (antecedent)
of the rule contains input fuzzy sets, while the
**then** clause (consequent) contains
output fuzzy sets. Each of the rules here links three fuzzy sets in
the antecedent with the “AND” conjunction. Each consequent
involves a single output fuzzy set.

**Figure 6. Rules
for Current_Temp = Below_Freezing**

**Figure 7. Rules for Current_Temp = Near_Freezing**

**Figure 8. Rules for Current_Temp = Above_Freezing**

Recall that the multiplicity of fuzzy sets for the three input variables is 4, 3 and 3, so that the total number of rules is the product, 36. Rather than quote each of the 36 rules, we represent them with the three tables shown in Figures 6, 7 and 8. Extracting a rule from a table is straightforward. The table entries show Avalanche_Danger for two inputs, Water_Equiv (row) and Slope_Pitch (column) while the third input is contained in the figure label. For example, in Figure 6, the upper left corner entry is “Low” and the corresponding inputs are:

Water_Equiv = Small (row)

Slope_Pitch = Novice (column)

Current_Temp = Below_Freezing (Figure 6's label)

Hence the related rule is, “If Water_Equiv is Small AND Slope_Pitch is Novice AND Current_Temp is Below_Freezing, then Avalanche_Danger is Low”; the same rule quoted earlier.

Just as for the fuzzy sets, the expert snow scientist must be consulted by the programmer in order to compose adequate rules. As with the fuzzy sets, experience with applying the model in the real world will most likely result in adjustments to the rules.

## Trending Topics

Bruce Nikkel's Practical Forensic Imaging (No Starch Press) | Dec 09, 2016 |

Progress on Privacy | Dec 08, 2016 |

Transitioning to Python 3 | Dec 06, 2016 |

Red Hat OpenStack Platform | Dec 05, 2016 |

Linux Journal December 2016 | Dec 01, 2016 |

CORSAIR's Carbide Air 740 | Dec 01, 2016 |

- Bruce Nikkel's Practical Forensic Imaging (No Starch Press)
- Transitioning to Python 3
- Progress on Privacy
- Stepping into Science
- Linux Journal December 2016
- Radio Free Linux
- The Tiny Internet Project, Part II
- CORSAIR's Carbide Air 740
- FutureVault Inc.'s FutureVault
- A Better Raspberry Pi Streaming Solution