# A New Scene Sensing Model Based on Multi-Source Data from Smartphones
## 2 Materials and Methods
### Complex Indoor and Outdoor Scene Classification Algorithm Based on Spatio-Temporal Features
#### 2.6.3 WOA Optimization Algorithm  
The whale optimization algorithm (WOA) is an emerging meta-heuristic algorithm that explores the solution space by simulating the group behavior of humpback whales. It is known for its simplicity in implementation and strong global search capability [36]. The algorithm draws inspiration from the hunting techniques of humpback whales, which create bubble nets around their prey. During this hunting process, the whales swim in a spiral trajectory, gradually tightening their encirclement around the prey.  
WOA models this hunting behavior through two primary mechanisms: encircling the prey and spiral motion.  
In this context, we assume that the optimal solution corresponds to the location of the prey. As such, the whale will progressively approach the optimal solution. The algorithm formulates this behavior with the following equation:  
\[\vec{D}=\mid\vec{C}\cdot\vec{X}^{k}(t)-\vec{X}(t)\rangle\mid \tag{14}\]  
\[\vec{X}(t+1)=\vec{X}^{k}(t)-\vec{A}\cdot\vec{D} \tag{15}\]  
\[\vec{A}=2\vec{\sigma}\cdot\vec{\tau}-\vec{a} \tag{16}\]  
\[\vec{C}=2\cdot\vec{\tau} \tag{17}\]  
In the whale optimization algorithm, the position vector of the whale at the t-th generation is denoted as \(\vec{X}(t)\), while \(\vec{X}*(t)\) represents the current global optimal solution. Two dynamic vector coefficients, \(\vec{A}\) and \(\vec{C}\), are utilized in the algorithm. Coefficient A linearly decreases from 2 to 0 as the number of iterations progresses.  
The value of \(\vec{A}\) plays a crucial role in determining the whale's movement dynamics. Specifically, when \(\mid\) A \(\mid\) < 1, the whale approaches the prey, while \(\mid\) A \(\mid\) > 1 prompts the whale to randomly select a new location, enhancing the diversity of the search process.  
To simulate the spiral hunting behavior of the whale, a spiral motion model is introduced. This model allows the whale's spiral trajectory to converge toward the prey, and the process is expressed as follows:  
\[\vec{X}(t+1)=\vec{D}^{\prime}\cdot e^{bl}\cdot\cos(2\pi l)+\vec{X}*(t) \tag{18}\]  
\[\vec{D}^{\prime}=\left|\vec{X}*(t)-\vec{X}(t)\right| \tag{19}\]  
where b is a constant defining the shape of the spiral and l is a random number between [\(-\)1, 1]. The encircling prey and the updating mode are alternately updated, and the updating mode control can be expressed by the following equation:  
\[\vec{X}(t+1)=\left\{\begin{array}{ll}\vec{X}*(t)-\vec{A}\cdot\left|\vec{C} \cdot\vec{X}*(t)-\vec{X}(t)\right|&\mbox{ if }p<0.5\\ \vec{D}^{\prime}\cdot e^{bl}\cdot\cos(2\pi l)+\vec{X}*(t)&\mbox{ if }p\geq 0.5 \end{array}\right. \tag{20}\]  
To reduce the chances of the algorithm getting stuck in a local optimum, an exploration mechanism is introduced in the early stages of iteration. During this exploration phase, the search will be conducted far from the current optimal solution to enhance global search capabilities. The formula for the exploration stage is as follows:  
\[\vec{X}(t+1)=\vec{X}_{\rm rand}\,-\vec{A}\cdot\left|\vec{C}\cdot\vec{X}_{\rm rand }\,-\vec{X}(t)\right| \tag{21}\]where \(\vec{X}_{\text{rand}}\) is a random solution in the current population. We use the WOA algorithm to train the initial learning rate, the regularization parameter and the number of BiLSTMs to improve the classification accuracy.