JOIV : Int. Inform. Visualization, 8. : IT for Global Goals: Building a Sustainable Tomorrow - November 2024 1686-1692 INTERNATIONAL JOURNAL ON INFORMATICS VISUALIZATION INTERNATIONAL JOURNAL ON INFORMATICS VISUALIZATION journal homepage : w. org/index. php/joiv Energy-Efficient Rainfall Prediction Using Support Vector Machine on Edge AI Platforms Willy Permana Putra a. Robi Robiyanto a. Renol Burjulius a. Alifia Puspaningrum a. Ahmad RifaAoi a. A Sumarudin a,* Department Informatics. Politeknik Negeri Indramayu. Lohbener. Indramayu. Indonesia Corresponding author: *shumaru@polindra. AbstractAiThe integration of AI into various sectors, including agriculture, has been advancing significantly. Implementing AI in the context of IoT and edge AI presents challenges due to resource limitations. Current climate changes affect planting strategies, pest management, and harvest timing. This study explores an SVM-based machine-learning model with multiple kernels to classify weather conditions as rainy or clear. The research includes two phases: model training on a PC-based system and model deployment on an edge AI device. The training phase includes preprocessing with PCA and fine-tuning of parameters, such as kernel types . inear, polynomial, sigmoid, and RBF). C and gamma. The development phase involves deploying the model on an ESP32, where execution time and power consumption are evaluated. The results show that the SVM model with an RBF kernel. C of 0. 1, and gamma of 1 achieves a precision Inference on the ESP32 yields an average execution time of 35. 5 ms and a power consumption of 66 mA, showing a 202-fold reduction in power usage compared to the PC-based system and a 59-fold increase in execution time. This reduced power consumption supports the feasibility of edge AI for climate-based agricultural applications, enabling effective rainfall prediction. The findings contribute to the development of precision agriculture by providing insights into climate prediction, which can inform planting decisions, pest management, and harvest timing, thereby advancing the application of edge AI in response to global climate change. KeywordsAiEdge AI. SVM. Energy-efficient. rainfall prediction. Manuscript received 4 Aug. revised 19 Sep. accepted 24 Oct. Date of publication 30 Nov. International Journal on Informatics Visualization is licensed under a Creative Commons Attribution-Share Alike 4. 0 International License. optimizing AI model architectures, utilizing more efficient inference algorithms, and applying model compression techniques to reduce computational complexity . , . Additionally, specialized hardware . , such as Neural Processing Units (NPU. designed for AI inference, significantly reduces energy consumption . , . As a result, energy-efficient Edge AI solutions enable longer operation times, support sustainability, and reduce the carbon footprint in AI technology deployment . The development of energy-efficient Edge AI . , . has significant potential across various applications, including healthcare. , automotive . , industrial . , . , and agricultural sectors . , . , . , . For example. AI-powered wearable devices in healthcare can continuously monitor patient conditions with low power consumption . In the automotive sector, autonomous vehicles equipped with Edge AI capabilities can make quick and efficient decisions without requiring extensive communication with central servers . Additionally, there is INTRODUCTION In recent years, the rapid advancement of artificial intelligence (AI) technology has led to the widespread adoption of applications running on edge devices . , . Edge AI is deploying AI models directly on edge devices such as smart sensors, mobile devices, and the Internet of Things (IoT) to process data locally . , . without sending it to the cloud . This enables real-time decision-making and reduces latency and bandwidth requirements for data transmission to the cloud. However, implementing AI on edge devices introduces new challenges, particularly concerning resource constraints such as processing power, memory, and, most critically, energy consumption . , . Energy efficiency has become crucial because many edge devices operate on limited power sources, such as batteries, which must support longterm operations. Therefore, there is an urgent need to develop Edge AI solutions that are computationally efficient and energy-efficient . Several approaches have been developed to achieve energy efficiency in Edge AI . These include the issue of energy efficiency related to security . , . , . , which requires higher power consumption. Climate change has become a significant concern for agriculture, particularly due to the shifts in rainfall patterns, which are critical for crop production. The availability of water, heavily dependent on consistent and predictable rainfall, directly influences agricultural output. As climate change continues to disrupt these patterns, it becomes increasingly vital to develop accurate systems for detecting and predicting rainfall. Such advancements are necessary to maintain agricultural productivity and ensure food security in a changing climate. This research explores with machine learning model based on SVM for prediction rainfall with any strategies . that can enhance energy efficiency in Edge AI applications and examines their impact on the overall system performance. Thus, the prediction system can provide weather recommendations that run efficiently on edge AI to address the impact of climate change on agriculture. linear decision boundary into a linear one. Some commonly used kernel functions with SVM, namely Polynomial kernel. Gaussian kernel. RBF or Gaussian radial basis function kernel. Laplace RBF kernel. Hyperbolic tangent kernel. Sigmoid kernel. Bessel function kernel. Linear splines kernel, etc. Support Vector Machine (SVM) is a machine learning technique that utilizes kernels to assist in classifying data into two or more categories, as shown in Figure 2. As the input parameter increases. SVM performs classification comparison between classes using methods such as One-vsOne (OVO). One-vs-All or One-vs-Rest (OVR). The kernel, which serves as the line separating classes, employs approaches such as linear kernel . , polynomial kernel . , sigmoid kernel . , and radial basis function (RBF) kernel . II. MATERIALS AND METHODS Oc%&' " # The methodology in this research consists of two steps: training and development, as shown in Figure 1. The model training was conducted on a PC with an i7 processor to obtain the *. kpi model. Using micromlgen, the model was then converted into a *. h file for edge AI development on an embedded device based on a microcontroller. The model's performance was compared by running inference on both the PC and the edge AI device to measure execution time and power consumption required for SVM inference during the development process for the end user. In this Equation 5, the class x is determined by calculating a weighted sum of the kernel function values for all training Each term in the sum includes a weight ai, the class label yi, and a kernel function value that depends on . and the squared distance between xi . training sampl. and xj . he test sampl. , plus a bias term b. The AosignAo function is then used to convert this sum into a class label. Support Vector Machine Algorithm A Support Vector Machine (SVM) is a supervised learning algorithm designed for analyzing data and identifying patterns for classification purposes. It processes a set of training data, classifies it into different categories, and then predicts if a test document belongs to one of these categories. Fig. 2 Principal component analysis rainfall prediction Fig. 1 Support Vector Machine In SVM, data is represented as points in space, and the classification is determined by a line or hyperplane that separates these points. Additionally. SVM classifiers can use various kernel functions to handle non-linear data samples. By transforming the data into a higher-dimensional space where it becomes linearly separable, these kernels simplify the classification task, effectively turning a previously non- Fig. 3 Plot dataset rainfall based on three classifications . ed = sunny, green=rain, and blue = heavy rai. The input parameters were derived from the BMKG at Majalengka district dataset, covering the period from June 2008 to December 2018. There are 9 attributes collected, namely Min_Temp. Max_Temp. Aver_Temp. Hum, sunny_time, wind_speed, max_wind_speed, wind_direction. After that. Principal Component Analysis (PCA) was conducted to identify the most significant input parameters for the system, as illustrated in Figure 3. The analysis revealed that humidity, minimum temperature, and wind speed were the key factors influencing the classification of rainfall into two categories: clear and rainy, as shown in Figure 4. The preprocessing of the dataset, utilizing PCA, identified minimum temperature (-0. , humidity . , and wind speed (-0. as the parameters most correlated with rainfall . As shown in Figure 4, the visualization of rainfall is primarily determined by humidity, which effectively distinguishes between rainy and non-rainy categories but is insufficient for differentiating types of rain. Therefore, additional parameters such as minimum temperature and wind speed are required. The model will classify these categories using an SVM, and the analysis will employ four different kernels as outlined in Equations 1-4. The processing of the dataset identifies key parameters that influence the desired classification, which then serve as inputs to the SVM algorithm. The outcome of this process is used to generate the model, as shown in Table 1. The SVM input (X) includes three parameters: minimum temperature, daily average humidity, and wind speed in knots, which are used to map the output classes (Y) into two categories: sunny, and rain, labeled . , . Fig. 4 Method development edge AI The key parameters in the SVM model are C and gamma, which are critical for the kernel and classification function. smaller C value provides a larger margin, while a larger C value results in a smaller margin, thereby influencing the separation boundary between output classes. The gamma value determines the influence of each support vector in shaping the classification boundary. A grid search will be conducted to tune the C and gamma parameters, and the performance accuracy will be compared to identifying the best parameter settings. Setting parameter Table 2 lists the parameter settings used in this research. The kernel parameters were compared across four types: linear, sigmoid, polynomial, and RBF. The C value was tested with three different parameters: 0. 01, 0. 1, and 1, while the gamma value was evaluated with 1, 0. 1, 0. 001, 0. 0001, and TABLE II PARAMETER SVM TABLE I PSEUDOCODE SVM FOR RAINFALL PREDICTION Input: Training data: X = . in temp, humidity, wind spee. Label: Y = {AosunnyAo. AorainA. Regularization parameter: C Kernel parameter: gamma Parameter Value Kernel Linear. Sigmoid. Poly. RBF . 01, 0. 1, . , 0. 1, 0. 01, 0. 001, 0. Gamma [] Design edge AI platform The SVM model was trained on a CPU with an i7 processor, and the development was carried out using an ESP32, as shown in Table 3. The device used for the edge AI implementation was an ESP32 WROM, with its specifications detailed in Table 3. The ESP32 Wroom operates with a core frequency of 40 MHz and a bit rate powered by a 3. 3 V supply with a minimum current of 500 mA, and it features 4 MB of flash RAM. These limited resources pose a significant challenge when running AI algorithms on edge computing The parameters obtained from machine learning training are used to generate the model as a library . , which is then loaded into the flash RAM. The size of the machine learning parameters directly influences the amount of flash RAM required. Edge AI enables predictions to be made directly on the device without relying on cloud- Initialize: Lagrange multiplier Bias term: b = 0 SVM compute: Normalization input parameter and label Choose method comparison with one vs all Grid search with best parameter SVM: Compute kernel Metrix using eq. 1/2/3/4 Optimize model SVM with eq. Choose best parameter SVM Compute the decision function for predict with eq. OUTPUT: SVM model with decision function classification based AI, thereby increasing processing speed and reducing communication with the cloud AI. effectively separates the classifications of rainy and non-rainy conditions, which is essential for predicting whether it will rain on agricultural landAicritical for water supply and pest TABLE i DEVICE TRAINING AND DEVELOPMENT EDGE AI Parameters Core Frequency bit width Flash RAM SRAM CPU i7 Training 9 GHz 64 bits SSD 16 GB DDR ESP32 Development 40 MHz 32 bits 4 MB 520 KB TABLE IV PERFORMANCE SVM Kernel Sigmoid Linier Poly RBF Gamma [] Precision [%] The confusion matrix of the performance parameters obtained with the best precision in Table 4 is shown in Table The testing data used consists of 2,543 data points. Figure 5 illustrates the implementation of edge AI on the ESP32. Weather conditions in the edge environment are sensed using a wind sensor to measure wind speed in knots, minimum temperature in Celsius, and average humidity. The sensors communicate via the RS485 protocol. After training, the SVM model is loaded into the flash RAM to perform rainfall predictions on the edge AI. The predicted results are then displayed on an OLED screen. TABLE V CONFUSION MATRIX Data testing = 2543 Actual sunny . Actual Rain . Actual sunny . Actual rain . TABLE VI PERFORMANCE MODEL WITH RBF KERNEL Parameter Accuracy Precision Recall F1 score Value The best parameters obtained from this process were used to generate a library as a . h file using micromlgen. This library was then loaded onto the ESP32 for the inference model during the edge AI development phase to predict rainfall. Fig. 6 Classification using best parameter Fig. 5 Edge SVM implementation process for an edge AI Implementation SVM Development Inference on edge AI The trained model was loaded onto the edge AI, as shown in Figure 7, marking the development phase of the edge AI. The generated library file in `. h` format was 304 KB, comfortably fitting within the edge AI device's 2 MB flash RAM. This `. h` file encapsulates the computations from Equations 1-5 using the parameters obtained from the training The edge AI takes input from weather sensors with meteorological multi-element shutter connected via the RS485 protocol. These sensors have been calibrated beforehand to ensure data validity. The prediction relies on three sensors: a wind sensor, a temperature sensor, and a humidity sensor. RESULTS AND DISCUSSION Results Implementation SVM Training As designed in Table 1, the SVM model was trained on a computer with an i7 CPU and 16 GB of RAM. The training aimed to identify the optimal parameters for the SVM, including the kernel type . inear, sigmoid, polynomial, and RBF) and the values of C and gamma. To achieve the best parameter values, 300 fits were conducted, requiring a computation time of 52 seconds. The best performance for each Kernel is shown in Table 4. The grid search results identified the RBF kernel with a C value of 0. 1 and a gamma value of 1, yielding an accuracy of 79. The classification boundary of the SVM, using the RBF kernel with C set to 0. and gamma to 1, is illustrated in Figure 6. This boundary C. Performance comparison SVM inference on edge AI The performance measurements focused on execution time and power consumption on the edge AI. A comparison was made between the edge AI running on the ESP32 and a PCbased CPU with an i7 processor. Computational time was measured by applying a timestamp in the inference model program: Python-based timing was used for the i7 CPU, while the `millis()` function was employed for the ESP32. The results, shown in Table 7, indicate a computational time difference of approximately 30 ms, meaning the ESP32 is 59 times slower in execution compared to the i7 CPU. However, despite this 30 ms difference in execution time, the edge AI can implement rainfall prediction. TABLE VII TIME EXECUTION Device CPU i7 ESP32 Slower than Average time consumption . Figure 9 shows the computation time on a PC with an i7 processor using a Python-based program. The test was conducted with 727 data points . ata testin. As illustrated in Figure 9, the average execution time is approximately 0. However, there are instances where the execution time 3 ms and 2. 2 ms, which can be attributed to variations influenced by the operating system's processes. Fig. 7 Overview Rainfall Prediction Application with weather sensor and edge AI for this implementation The wind speed using APRS Weather Station is measured using an anemometer-based sensor. Temperature and humidity are measured using a temperature chip sensor, which offers a humidity accuracy of 3% over a 0-99% range and a temperature accuracy of A0. 5AC over a -40 to 125AC Fig. 9 Time execution on PC on CPU i7 Figure 10 illustrates the execution times for each test data point on the edge AI. These times vary due to differences in input data and the process of converting the input into the model format. On average, the edge AI has an execution time of approximately 35. 5 ms. Fig. 8 Edge AI Implementation Prediction Results The prediction results are displayed on an OLED screen, allowing the user to view the predicted weather conditions. Additionally, these predictions can be sent to the cloud for further analysis. This approach enables predictive computations to be performed at the edge, enhancing the speed of AI processes on the edge device. The cloud serves as a storage medium for big data, facilitating more complex analyses such as climate analysis and pest prediction on agricultural lands. Figure 8 illustrates the prediction results on the edge AI, based on input from the sensors. The prediction classifies the weather into two categories: rainy or sunny. Fig. 10 Time execution on ESP32 Figure 11 compares the execution times between the PCbased system and the ESP32-based edge AI, highlighting a difference of about 35 ms between the two platforms. Power consumption was measured on the ESP32 using current and voltage sensors during program execution. on an edge AI device based on the ESP32 in a library format. The implementation showed a power consumption that is 202 times more efficient, with an average SVM inference execution time of approximately 35. 5 ms. These findings show that the model is effective for deployment on edge AI devices with limited resources, making it suitable for agricultural applications related to climate change and rainfall ACKNOWLEDGMENT We thank Politeknik Negeri Indramayu under grant PUKTI JIP. The authors fully acknowledged Politeknik Negeri Indramayu for the approved fund, making this research can effective and can implementation. REFERENCES