# Analyzing Data Reduction Techniques: An Experimental Perspective
## 8 Experimental Evaluation
### Lossy Data Reduction Algorithms
#### 8.1.5 K-Means  
For the clustering algorithms, we used the K-Means implementation from the popular Python library scikit-learn [46]. The first steps involved preprocessing the time data,  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline \multirow{2}{*}{**Data Type**} & \multirow{2}{*}{**Name**} & **Original** & **Final** & \multirow{2}{*}{**Percentage**} & \multirow{2}{*}{**Time**} & **Execution** & **Processing** \\  & & **Size** & **Size** & & **Variation** & **(ms)** & **time per** \\  & & **(MB)** & & & & **MB** \\  & & **(MB)** & & & & **(ms/MB)2  \\ \hline \multirow{6}{*}{\begin{tabular}{c} Temporal, \\ Numeric \\ \end{tabular} } & Daily Minimum & \multirow{6}{*}{0.0558} & Daily Minimum & \multirow{6}{*}{0.0680} & \multirow{6}{*}{+21.86\%} & \multirow{6}{*}{0.002} & _0.0358_ \\  & Temperatures & & & & & \\  & Melbourne & & & & & \\  & Electric & & & & & \\  & Production & & & & & \\  & Monthly Beer & & & & & \\  & Production in & & 0.0690 & 0.0890 & +28.99\% & 0.001 & _0.0145_ \\  & Austria & & & & & \\ \hline \multirow{2}{*}{\
\begin{tabular}{c} Numeric \\ \end{tabular} } & Accelerometer & 3.7000 & 2.9300 & \(-\)**20.81\%1** & 0.160 & 0.0432 \\  & Smoke Detection & 5.8000 & 4.7500 & \(-\)18.10\% & 0.160 & **0.0276** \\ \hline \multirow{2}{*}{
\begin{tabular}{c} Temporal, \\ Text \\ \end{tabular} } & IoT & \multirow{2}{*}{6.7000} & \multirow{2}{*}{6.7600} & \multirow{2}{*}{+0.90\%} & \multirow{2}{*}{0.050} & _0.0075_ \\  & Temperatures & & & & & \\ \end{tabular}
\end{table}
Table 9: Principal Component Analysis results.  
converting them to a timestamp format, and then determining the optimal number of clusters using the elbow point technique in the graph. We then constructed our K-Means model and trained it on the dataset. Using the information from the trained model, we created a new dataset that reflected the inherent characteristics of the original dataset. This comprehensive process allowed us to harness the power of K-Means clustering for a nuanced understanding of the underlying patterns in the data. Our solution is a simplified approach to this algorithm. Its implementation depends on the needs of the solution. For all the datasets, the optimal \(k\) was \"2\", which means that all datasets used 2 as the number of clusters for the K-Means algorithm.  
Table 10 provides a comprehensive overview of the results derived from the study of the K-Means algorithm. The algorithm unexpectedly affected the accelerometer dataset because it was the only dataset that incremented the original size. While K-Means may not be the most capable algorithm, its effectiveness strongly correlates its features to the characteristics of the dataset at hand. These results highlight the importance of a tailored algorithmic adaptation to achieve optimal results in different solution data scenarios. The Electric Production dataset, which contains temporal and numeric data, was the dataset where K-Means performed better, reducing \(-41.10\%\) of the original dataset size in 0.160 ms. As for the time taken to process the data, the algorithm had better results with the IoT Temperatures dataset, processing 1 MB in 2.0773 ms.