# Optimized Wireless Sensor Network Architecture for AI-Based Wildfire Detection in Remote Areas
## 3 WSN Architecture
### AI-Based Fire Risk Prediction Approach  
To enhance fire hazard prediction and improve system accuracy, artificial intelligence (AI) techniques were integrated into wireless sensor network (WSN) nodes. For predictive modeling, multiclass logistic regression algorithms were used to derive equations that relate temperature and humidity measurements to the three fire risk levels: low, medium, and high [56]. These models were trained on real environmental data, enabling the system to adapt to various conditions. They predict fire risk levels (low, medium, and high) based on environmental conditions that precede ignition, such as elevated temperatures and reduced humidity. This enables proactive intervention before fires start. Once the data packet is received and verified, the receiver computes the fire risk probability using Equation (9):  
\[f=at+bh+c \tag{9}\]  
Here, t is temperature, h is humidity, a and b are coefficients from training that reflect their influence, and c is a bias term to improve accuracy. This equation was developed through several stages. Initially, a large meteorological dataset containing temperature, humidity, and other weather variables (wind speed, pressure, and visibility) from 13 cities in Saudi Arabia was used, including over 249,000 recorded entries [57].  
The multiclass logistic regression model was implemented using the Scikit-learn library with the multinomial option and the lbfgs solver. This approach learns distinct linear functions for each fire risk class (low, medium, and high), defined as Equations (10)-(12):  
\[\textit{Low risk}\ (f_{0}):f_{0}=-10.75t+0.084h+350.05 \tag{10}\]  
\[\textit{Medium risk}\ (f_{1}):f_{1}=1.13t+0.07h-0.22 \tag{11}\]  
\[\textit{High risk}\ (f_{2}):f_{2}=9.62t-0.15h-349.83 \tag{12}\]These equations are automatically fitted during training on the meteorological dataset [57], where humidity is input as a raw numerical value (e.g., 65). The model computes all three scores (\(f_{0}\), \(f_{1}\), and \(f_{2}\)) for incoming sensor data. The class with the highest raw score \(f_{i}\) is predicted, as arg max (\(f_{i}\)) aligns with the highest softmax probability. The coefficients and intercepts reflect the relative influence of temperature and humidity on each risk category, optimized via gradient descent on cross-entropy loss, maximizing the likelihood of correct risk-level predictions on the training data.  
We recognize the Canadian Fire Weather Index (FWI) [58] as a comprehensive and validated model for wildfire risk assessment. Nevertheless, its dependence on various weather inputs and iterative calculations makes it inappropriate for low-power WSNs. The proposed simplified model, based only on temperature and humidity, achieves 99.97% accuracy by learning patterns that approximate key FWI thresholds (e.g., >30 \({}^{\circ}\)C and <30% humidity \(\approx\) high risk) [58]. Logistic regression effectively captures the non-linear relationships involved, balancing accuracy and feasibility.  
The digitized data was divided into training and testing sets to ensure effective evaluation. Temperature and humidity served as inputs, while fire risk levels were the outputs. To handle classification, a multi-class logistic regression model was built using the scikit-learn library. It was configured to classify inputs into the three risk categories. During training, the model adjusted coefficients (\(a\) and \(b\)) and the bias term \(c\) to link inputs with risk levels. It produced three output values (\(f_{0}\), \(f_{1}\), and \(f_{2}\)), each representing a fire risk category. The highest value determined the final risk classification.