# Distributed Global Function Model Finding for Wireless Sensor Network Data
## 4 Distributed Global Function Model Finding for Wireless Sensor Networks Data
### Global Model Generation Algorithm Based on Unconstrained Nonlinear Least Squares  
The traditional distributed data mining algorithm mainly includes two steps: (1) analyzing local data and generating a local function model; (2) global function model is obtained by integrating different local function models. How to get the global function model from the local function model has not been investigated in earlier work. This paper presents a global model generation algorithm based on unconstrained nonlinear least squares (GMG-UNLS). **Definition 3. **_In WSNs, we propose the number of the sensor node and sink node are \(k\) and \(n\), respectively. For each sink node, it contains a sensor data set \(S=[x_{1},...,x_{m}\,y_{m+1}]\), where \(S\in R^{m+\ 1}\) and \(y_{m+1}\) represents target value for each sensor data set. Then, the set of each sink node can be obtained yielding to GEP by employing the approach of function model mining, such that \(y_{i}(x_{m+1})=f_{i}(x_{1},x_{2},...,x_{m}),i\in[1,n]\). Hence, \(y_{i}(x_{m+1})=f_{i}(x_{1},x_{2},...,x_{m})\) is the local function model with \(m\)-dimension of the \(i\)-th sink node._  
**Definition 4. **_Suppose that there exist \(n\) sink nodes and \(f_{i}(X),i\in[1,n]\), where \(X=(x_{1},x_{2},...,x_{m})\). There exists a set of constants \(a_{i}\
eq 0,i\in[1,n]\) such that \(f(x_{1},x_{2},...,x_{m})=\sum\limits_{i=1}^{n}a_{i}f_{i}(X)\). Thus, \(f(x_{1},x_{2},...,x_{m})\) is called global function model._  
_Lemma 1._ Given that there exist \(n\) local function model \(f_{1}(x_{1},x_{2},...,x_{m}),...,f_{n}(x_{1},x_{2},...,x_{m})\) with m-dimension in WSNs, and \((m+1)\times\ p\) sample datasets on each sink node. There exists a set of constants \(a_{i}\
eq 0,i\in[1,n]\) such that value of \(\sum\limits_{i=1}^{k}\left(y_{i}-\sum\limits_{j=1}^{n}a_{j}f_{j}(X_{i})\right) ^{2}\) is minimum, where \(k=np\). **Proof:** Set \(Q(a_{1},a_{2},...,a_{n})=\sum\limits_{i=1}^{k}\left(y_{i}-\sum\limits_{j=1}^{ n}a_{j}f_{j}(X_{i})\right)^{2}\). Then  
\[ \begin{array}{ll}Q(a_{1},a_{2},...,a_{n})&=\sum\limits_{i=1}^{k}\left(a_{1} f_{1}(X_{i})+a_{2}f_{2}(X_{i})+...+a_{n}f_{n}(X_{i})-y_{i}\right)^{2}\\ &=(a_{1}f_{1}(X_{1})+..+a_{n}f_{n}(X_{1})-y_{1})^{2}+...+(a_{1}f_{1}(X_{k})+..+ a_{n}f_{n}(X_{k})-y_{k})^{2}\end{array}  \tag{2}\]  
where \(f_{j}(X_{i}),i\in[1,k]\), \(j\in[1,n]\) and \(y_{1},...,y_{k}\) are constants. Denote  
\[f_{1}(X_{1})=C_{11},f_{2}(X_{1})=C_{21},...,f_{n}(X_{1})=C_{n1},...,f_{1}(X_{ k})=C_{1k},f_{2}(X_{k})=C_{2k},...,f_{n}(X_{k})=C_{nk} \tag{3}\]  
Substituting Equation (3) into Equation (2), we have that  
\[Q(a_{1},a_{2},...,a_{n})=(a_{1}C_{11}+..+a_{n}C_{n1}-y_{1})^{2}+...+(a_{1}C_{ 1k}+..+a_{n}C_{nk}-y_{k})^{2} \tag{4}\]  
Because \(Q(a_{1},a_{2},...,a_{n})\) is a two time polynomial of \((a_{1},a_{2},...,a_{n})\), and composed of basic elementary functions, and differentiable. Hence, the partial derivative of \(Q(a_{1},a_{2},...,a_{n})\) with respect to \(a_{1},a_{2},...,a_{n}\) exists, respectively. The Equations (5)-(7) hold. \[\frac{\partial Q}{\partial a_{1}}=2(a_{1}\sum\limits_{i=1}^{k}C_{1i}^{2}+a_{ 2}\sum\limits_{i=1}^{k}C_{1i}C_{2i}+...+a_{n}\sum\limits_{i=1}^{k}C_{1i}C_{ni} -\sum\limits_{j=1}^{k}y_{j}C_{1j}) \tag{5}\]  
\[\frac{\partial Q}{\partial a_{2}}=2(a_{1}\sum\limits_{i=1}^{k}C_{2i}C_{1i}+a_ {2}\sum\limits_{i=1}^{k}C_{2i}^{2}+...+a_{n}\sum\limits_{i=1}^{k}C_{2i}C_{ni} -\sum\limits_{j=1}^{k}y_{j}C_{2j}) \tag{6}\]  
\[\frac{\partial Q}{\partial a_{n}}=2(a_{1}\sum\limits_{i=1}^{k}C_{ni}C_{1i}+a_ {2}\sum\limits_{i=1}^{k}C_{ni}C_{2i}+...+a_{n}\sum\limits_{i=1}^{k}C_{ni}^{2} -\sum\limits_{j=1}^{k}y_{j}C_{nj}) \tag{7}\]Solving \((a_{1},a_{2},...,a_{n})\) such that value of \(Q(a_{1},a_{2},...,a_{n})\) is minimum. Set \(\dfrac{\partial Q}{\partial a_{i}}=0,i\in[1,n]\). Thus, Equation (8) can be obtained. \[\left[