# Variational Autoencoders for Network Lifetime Enhancement in Wireless Sensors
## 3 Methodology
### Evaluation Metrics  
The experimental work aims to analyze the compression efficiency of the VAE and is also experimented to present its betterment on transmitting data to the destination with minimal energy requirement. Compression ratio, and reconstruction quality are the factors considered in the work, to estimate the performance of VAE over the existing techniques.  
Compression ratio (\(C_{R}\)) defines the amount of original sensor data that has been compressed by the approach. A higher value of compression indicates its efficiency. Compression ratio can be described mathematically as follows.  
\[C_{R}=\frac{Original\ data\ in\ bytes}{Compressed\ data\ in\ bytes} \tag{5}\]  
Reconstruction quality \(\left(R_{Q}\right)\) is used to represent the accuracy of the reconstruction of data from the given compressed data. Mean Square Error (\(MSE\)) is the primary metric used for estimating the reconstruction quality. A higher reconstruction quality gives a minimal loss information of the given input.  
\begin{table}
\begin{tabular}{c c c} \hline
**Parameter** & **Description** & **Value** \\ \hline \multirow{4}{*}{Encoder} & Input layers & 54 \\ \cline{2-3}  & Hidden layer 1 & 128 \\ \cline{2-3}  & Hidden layer 2 & 64 \\ \cline{2-3}  & Latent space & 16 (8 for mean and 8 for log variance) \\ \hline \multirow{4}{*}{Decoder} & Latent input & 8 \\ \cline{2-3}  & Hidden layer 1 & 64 \\ \cline{2-3}  & Hidden layer 2 & 128 \\ \cline{2-3}  & Output layer & 54 \\ \hline Epochs & Training epochs & 100 \\ \hline Batch size & Size of batch training & 32 \\ \hline Learning rate & Optimization rate & 0.01 \\ \hline Activation function & ReLU & \\ \hline Loss function & Reconstruction + KL & \\ \hline Optimization algorithm & Gradient Descent & \\ \hline \end{tabular}
\end{table}
Table 1: Neuron count in each layer of the proposed VAE network.  
\begin{table}
\begin{tabular}{c c} \hline
**Parameters** & **Description** \\ \hline Network size & 275 m \(\times\) 275 m \\ \hline Sensor node count & 54 \\ \hline Given energy to each sensor nodes & 0.75 joules \\ \hline Packet size (data) & 3000 bits \\ \hline Packet size (control) & 200 bits \\ \hline Simulation time & 1500 s \\ \hline Routing & ODV \\ \hline Cluster & LEACH \\ \hline Communication Speed & 250 kbps (IEEE 802.15.4) \\ \hline \end{tabular}
\end{table}
Table 2: Simulation parameters of WSN.  
\[R_{Q}=1-\frac{MSE}{Variance\ of\ original\ data} \tag{6}\]  
Energy consumption, delay and the network lifetime availability are the factors considered in the work for estimating the performance of VAE integrated WSN model. Energy consumption is calculated for the operation of the network in full load operation with respect to time. It represents the amount of energy required for an efficient operation, and that can be represented mathematically as follows.  
\[Energy\ consumption(E_{c})=Power\times Time \tag{7}\]  
Delay is used to analyze the time taken for transmitting a data from the source to the destination, and is denoted in milliseconds. It includes compression and decompression time along with the transmission time, and is represented as follows.  
\[Delay(D)=D_{compression}+D_{decomposition}+D_{transmission} \tag{8}\]  
Network lifetime is the parameter that can present the overall operation time of the WSN. It is directly related to the energy required for compression, transmission and the routing process. The below formula indicates the mathematical representation of the network lifetime.  
\[Network\ lifetime(N_{L})=\frac{No.\ of\ nodes\times Given\ energy}{Avg.\ consumption\ per\ unit\ time\times Active\ nodes\ in\%} \tag{9}\]