# A Novel Hybrid Genetic-Wale Optimization Model for Ontology Learning from Arabic Text
## 4 Proposed Model for Arabic Ontology Learning
### The Proposed Hybrid Genetic-Wale Optimization Algorithm for Arabic Ontology Learning
#### 4.3.1 Initial Population  
The GA is embedded into the WOA algorithm in order to develop a number of whales (search agents) in the form of chromosomes. Every chromosome is a hypothesis for the best solution (preys). Therefore, every search agent contains genes, each of which represents a concept/semantic relation of the ontology. A set of random agents \(c_{p,i}^{t}\) is generated initially. After generating the random solutions, the hybrid G-WOA starts to search for the best solution through a number of iterations (\(t\)).  
```
0: A vector \(R\) assigns the document's mapped features. //The G-WOA algorithm parameters: \(\mathit{PopSize}\leftarrow\) population size, \(\mathit{Cr}\leftarrow\) crossover rate, \(\mathit{MR}\leftarrow\) mutation rate, \(\mathit{E}\leftarrow\) The stopping criterion, \(\mathit{h}\leftarrow\) constant defines the logarithmic spiral shape, \(\mathit{r}\leftarrow\) random variable, where \(\mathit{r}\in[-1,\ 1]\), \(\mathit{K}\rightarrow\) coefficient vector of WOA, and \(\mathit{e}\leftarrow\) is linearly decreased from 2 to 0 along iterations (\(\mathit{t}\)). //Fitness function parameters \(w_{f}\leftarrow\) weight of false alarm rate, \(w_{d}\leftarrow\) weight of detection rate, and \(w_{c}\leftarrow\) selected features weight. Output:\(R^{*}\) the solution with the optimal concept/semantic relation set contributing to the ontology.
1. Represent each document \(d_{1},\ d_{2},\ \ldots,\ d_{O}\) by a single whale \(c\) to obtain a pool \(O\) of whales. \(C=[c_{1},\ c_{2},\ \ldots,\ c_{O}]\).
2. Evaluate the fitness for each whale \(c_{i}\in C\) using Equation (21).
3. Get the best individual \(c_{best}\) and set it as \(c_{G}^{0}\).
4. Initialize the counter of iteration, \(\mathit{t}=1\)
5. While (stopping criterion \(\mathit{E}\) is not met)
6. \(\{\widetilde{C}\leftarrow\varphi\)
7. For each \(\mathit{p}\leftarrow\) 1 to \(\mathit{PopSize}\)
8. Choose a random integer \(u_{\mathit{r}nd}\) from \(\{1,\ 2,\ \ldots\ U\}\).
9. Randomly select two whales \(c_{\mathit{r}nd1,\ j}^{t}\), \(c_{\mathit{r}nd2,\ j}^{t}\in C\ (c_{\mathit{r}nd1}\
eq c_{\mathit{r}nd2})\):
10. Update \(\mathit{K},\mathit{A},\mathit{e},\mathit{h}\), and \(\mathit{r}\).
11. For each gene \(j\) in the solution \(c_{\mathit{p},\ j}\)
12. IF\(\mathit{rnd}\ (0,\ 1)\leq\mathit{Cr}\) or \(j==\mathit{u}_{\mathit{r}nd}\) Then
13. \(\mathit{offspring}_{\mathit{p},j}^{t}=c_{\mathit{r}nd1,\ j}^{t}+M_{\mathit{p},\ j}^{t}\left(c_{\mathit{r}nd2,\ j}^{t}-c_{\mathit{r}nd1,\ j}^{t}\right)\)
14. ELSE IF\(\mathit{m}<0.5\) THEN
16. IF\(|\mathit{K}|\geq\) 1 THEN
17. Choose a random individual \(c_{\mathit{r}nd}^{t}\
eq\ c_{\mathit{p}}^{t}\).
18. \(\mathit{S}_{\mathit{p},\ j}^{t}=\left|\mathit{K}_{\mathit{p}}^{t},\ c_{ \mathit{r}nd,\ j}^{t}-c_{\mathit{p},\ j}^{t}\right|\).
19. \(\mathit{offspring}_{\mathit{p},\ j}^{t}=c_{\mathit{G},\ j}^{t}-A_{\mathit{p} }^{t}\cdot S_{\mathit{p},\ j}^{t}\).
20. ELSE
21. \(\mathit{S}_{\mathit{p},\ j}^{t}=\left|\mathit{K}_{\mathit{p}}^{t},\ c_{ \mathit{G},\ j}^{t}-c_{\mathit{p},\ j}^{t}\right|\)
22. \(\mathit{offspring}_{\mathit{p},\ j}^{t}=c_{\mathit{G},\ j}^{t}-A_{\mathit{p} }^{t}\cdot S_{\mathit{p},\ j}^{t}\)
23. End IF
24. ELSE
25. \(\mathit{offspring}_{\mathit{p},\ j}^{t}=\left|c_{\mathit{G},\ j}^{t}-c_{ \mathit{p},\ j}^{t}\right|\), \(\mathit{exp}\ (\mathit{hr})\cdot\mathit{cos}(2\ \pi\ \mathit{r})+c_{\mathit{G},j}^{t}\)
26. End IF
27. End IF
28. End For
29. End For
30. Evaluate the fitness of the offspring \(\mathit{offspring}_{\mathit{p}}^{t}\).
31. Return to population.
32. For each \(\mathit{p}\leftarrow\) 1 to \(\mathit{PopSize}\)
33. IF\(\mathit{offspring}_{\mathit{p}}^{t}\leq\mathit{MR}\) THEN
34. Replace \(c_{\mathit{p}}^{t}\) with \(\mathit{offspring}_{\mathit{p}}^{t}\).
```  
**Algorithm 2**The proposed hybrid G-WOA Algorithm for ontology learning from Arabic text