# A Mamdani Type Fuzzy Inference System to Calculate Employee Susceptibility to Phishing Attacks
## 4 Generic Fuzzy Inference System
### Stage 3: Defuzzification  
The process of defuzzification is the opposite of the beginning process of fuzzification, by this stage the input will have had its membership degree calculated and be in the form of a fully linguistic statement such as Figure 6 illustrates, in order to get a crisp numerical value as an output it must be reverted back through defuzzification. The Mamdani type FIS allows for alternative methods to find the defuzzification value.  
Below are the described defuzzification methods what can be defined by the user to gain the desired output.  
* Centroid--The centroid method returns its value from the centre of area of the fuzzy set as shown in Figure 7. It uses the formula (1) below where \(\mu(x_{i})\) is the membership value for point \(x_{i}\). \[xCentroid=\frac{\sum_{i}\mu(x_{i})x_{i}}{\sum_{i}\mu(x_{i})x_{i}}\] (1)
* Bisector--This defuzzification method finds the line that bisects the fuzzy set into 2 sub regions of the same equal area, it usually concurrent with the centroid line (Figures 8 and 9).
* Middle, Largest and smallest of maximum (MOM), (LOM), (SOM) These 3 defuzzification methods take the maximum value of the plateau, as shown in Figure 9 SOM takes the smallest value, MOM the middle and lastly LOM takes the largest value.
* Membership Functions (MF) Membership functions are viewed as the graphical representation of a fuzzy set, it is a curve that defines how each plot in the input space is mapped to the degree of membership. The software used MATLAB creates visual representations for the MFs that are used for analysis. MFs for fuzzy sets are defined as \(\mu\)A:X \(\rightarrow\) [0,1], wherein each element of X is shown to be a value between 0 and 1, this value is referred to the \"membership value or the value with a degree of membership\" [Emaths,2020] as it signifies the grade or degree of membership of the element to the fuzzy set.  
Figure 6: Example Rule.  
The most common forms of membership functions are triangular, trapezoidal, Gaussian. In the susceptibility FIS, only the Trapezoidal MF and the Triangular MF were used as this was to allow for an efficient use of the systems output. The triangular membership function takes on the representation of a triangle as observed in Figure 10 whereby the 'trimf' function returns the fuzzy membership values using the following function (2):  
\[f(x;a,b,c)=max\bigg{(}min\bigg{(}\frac{x-a}{b-a},\frac{c-x}{c-b}\bigg{)},0\bigg{)} \tag{2}\]  
This is also defined by a lower limit (a), upper limit (b) and a value (m) wherein a \(\leq\) m \(\leq\) b as portrayed in Figure 11.  
The trapezoidal MF uses the 'trapmf' function to compute wherein the output takes on a trapezoidal shape, Figure 12, and returns the fuzzy membership values using function (3):  
\[f(x;a,b,c,d)=max\bigg{(}min\bigg{(}\frac{x-a}{b-a},1,\frac{d-x}{d-c}\bigg{)},0 \bigg{)} \tag{3}\]  
Figure 13 illustrates the plots in which the lower limit (a) upper limit (d) lower support limit (b) and upper support limit (c) wherein a \(\leq\) b \(\leq\) c \(\leq\) d.  
Figure 7: Centroid Visualisation.  
Figure 8: Visualisation of Bisector Defuzzification.  
Figure 10: Tri MF Representation.  
Figure 9: Visualisation of SOM, MOM and LOM.