## 4 IWO-NN Errors Compensator Technique  
In Equation (6), the position errors \(\Delta P_{extra}\) are still large after applying the algorithm of simultaneous identification of joint compliance and kinematic parameters. This occurred because of some unmodeled sources such as friction, thermal extension, mechanical transmitting errors, which are hardly considered in geometric calibration. To decrease these unmodeled errors, a nongeometric compensator should be carried out for compensating. In this study, an IWO-NN errors compensator is taken to eliminate the residual positional errors. The method is fully described as follows. First, the robot geometry error \(\Delta\phi\) and joint compliance parameter \(C\) are identified together (Equation (7)) using the least squares method. The total positional error vector is denoted by \(\Delta P\) (3\(\times\)1):  
\[\Delta P=P_{m}-P_{c}=\Delta P_{kin}+\Delta P_{c}+\Delta P_{extra} \tag{8}\]where \(P_{m},P_{c}\) indicate the positions of the end effector by measuring and computing. \(\Delta P_{kin},\Delta P_{c}\) are the kinematic error and compliance error that are calculated by applying the method in Ref. [5]. The residual position error after the modeled-based calibration process is \(\Delta P_{r}\). Here, the IWO-NN is hired to compensate the residual error \(\Delta P_{r}\). \[\Delta P_{r}=\Delta P-\Delta P_{kin}-\Delta P_{c} \tag{9}\]  
The IWO-NN containing six inputs representing the joint configurations is \(\theta_{n}=[\theta_{1},\theta_{2},\cdots,\theta_{6}]\). There are five nodes in the hidden layer (Figure 2). The tag-sigmoid is selected as the activate function for the hidden layer as follows [36]:  
\[z=\textit{tansig}(a)=\frac{2}{1+e^{-2a}}. \tag{10}\]  
Three outputs of the NN have the linear activation function. The outputs of the NN are used for compensating the residual errors \(\Delta P_{r}\). The error in the output layer is  
\[e=\Delta P_{r}-P_{m} \tag{11}\]  
where \(P_{m}\) is the output of the neural network. The mean square error is calculated as follows:  
\[E=\frac{1}{m}\sum_{k=1}^{m}e_{k}^{2} \tag{12}\]  
where \(m=3\) represents the three dimensions of the end-effector position. The IWO is a recently proposed population-based heuristic optimization algorithm that mimics the spreading of weeds to find a suitable place for expanding and breeding [46]. IWO has four main stages: (i) initialization, (ii) reproduction, (iii) space distribution, and (iv) ranking and selection. (i) Initialization: The population of solution is generated. The seeds are randomly distributed over all the space problem. The number of seeds is chosen. (ii) Reproduction: In this step, every seed reproduces the next generation. The number of every seed's hair depends on its fitness in the community. If the seed has a good fitness, it will produce more seeds than another seed that has a worst fitness in the society. (iii) Space Distribution: This is the progress by which the offspring are randomly spread over all the searching space. The spreading process is made to distribute the offspring close to their  
Figure 2: The Invasive Weed Optimization Neural Network (IWO-NN) diagram. parents' location. Therefore, the seeds with lower fitness in the population are deleted over time. The distribution function is described as below:  
\[\sigma_{it\sigma}=\frac{\left(iter_{max}-iter\right)^{n}}{\left(iter_{max}\right) ^{n}}\Big{(}\sigma_{initial}-\sigma_{final}\Big{)}+\sigma_{final} \tag{13}\]  
where \(\sigma_{iter}\) is the standard deviation (SD) at the present step, \(iter_{max}\) is the maximum number of iterations before stopping the algorithm, \(\sigma_{initial}\) is the initial value of the SD, \(\sigma_{final}\) is the final value of the SD, and \(n\) is the non-linear modulation index. (iv) Ranking and Selection: When the maximum number of populations in the colony is hit, all the seeds are evaluated, including new seeds and their producers. The unqualified fitness seeds will be eliminated. In this work, the IWO is introduced for optimizing the weights and biases of an NN.