Optimizing Predictive Accuracy: A Study of K-Medoids and Backpropagation for MPX2 Oil Sales Forecasting

. This study evaluates the use of K-Medoids and Backpropagation methods for predicting MPX2 Oil sales in the automotive workshop industry, which is crucial for meeting customer demands and refining sales strategies. Utilizing transaction data from 2022 to 2023, the study involves normalizing and processing this data with these algorithms to forecast stock levels, focusing on accuracy measures such as Mean Absolute Deviation (MAD) and Mean Squared Error (MSE). K-Medoids assist in identifying customer purchase patterns through clustering, while Backpropagation effectively predicts sales trends, enhancing accuracy through training. Implementing K-Medoids and Backpropagation algorithms in the research resulted in MSE value of 0.01969 and MAD value of 0.12200. These values indicate a high level of accuracy in the MPX2 Oil sales predictive model, as lower MSE and MAD values suggest greater accuracy and precision in forecasting. These findings provide valuable insights into the dynamics of MPX2 Oil sales, enabling companies to improve marketing strategies, transaction management, and inventory strategies.


Introduction
In the business world, sales forecasting methods are a crucial component of planning and decisionmaking in the corporate sector.This is especially true in the automotive care sector, where oil sales are a key variable that must be accurately anticipated.The implementation of effective and accurate prediction methods is vital in enhancing sales tactics and meeting client demands.In this article, we analyze the implementation of two popular forecasting methods, K-Medoids and Backpropagation, in predicting the sales of Mpx2 oil brand [1].The K-Medoids method is a clustering algorithm used to group data into several clusters based on similarities.This method aids in identifying different purchasing patterns among customer groups, allowing companies to tailor their sales strategies to meet the needs of each group.Additionally, we examine the implementation of the Backpropagation method, a technique commonly used in neural networks.This method enables neural networks to learn from historical sales data and generate future sales predictions.Using training and testing data, neural networks can be trained to recognize complex purchasing patterns and make more accurate sales predictions.The K-Medoids and Backpropagation methods are often used in oil sales prediction research for specific reasons that make them suitable for data analysis in this context.K-Medoids is primarily used for its data clustering capabilities [2]- [4].As an effective clustering technique, K-Medoids helps group similar objects into clusters.In oil sales, this is useful for identifying different patterns or market segments based on sales characteristics.Another advantage of K-Medoids is its real cluster representation.Unlike other clustering methods such as K-Means, K-Medoids uses actual data points (medoids) as cluster centers, making clustering results more interpretable and relevant for real-world applications, like in oil sales [5], [6].On the other hand, Backpropagation is used in neural networks (Artificial Neural Networks, ANN) for its ability to model experience and knowledge [7]- [9].This is invaluable in forecasting oil sales trends, providing flexibility in altering forecasting rules based on historical data and market trends.This method is also particularly suited to adjustments in time-series data, crucial in oil sales predictions as sales changes often relate to time factors like seasons, economic trends, and industry policies.Moreover, Backpropagation allows for high optimization and accuracy in predictions, essential in a business context where decisions must be based on accurate and reliable forecasts [10], [11].When both methods are used together, they can provide deep insights into oil sales patterns, aiding in better market segmentation and enabling more accurate predictions based on historical data and current trends.This analysis aims to assist the automotive repair sector enhance their MPX2 Oil sales forecasts and marketing approaches.Unlike previous studies, it fills a research gap by specifically comparing the K-Medoids and Backpropagation methods for MPX2 Oil sales forecasting.Raeisi & Kabir (2022) focused on general sales forecasting using Artificial Neural Networks (ANN), emphasizing time series data [12].Safar et al. (2019) explored Backpropagation for electric sales forecasting, addressing non-linear and non-stationary data challenges [13].Berahmana et al. (2020) investigated customer segmentation using RFM models and algorithms like K-Means, K-Medoids, and DBSCAN [14].The novelty of this study lies in its direct comparison of K-Medoids and backpropagation for MPX2 oil sales and its exploration of K-Medoids for customer categorization based on purchasing habits.Thus, the research question is to evaluate the effectiveness of implementing the K-Medoids and Backpropagation methods in predicting the sales of Mpx2 brand oil.Specifically, this study addresses the sales prediction challenges in the automotive workshop industry using transaction data from 2022 to 2023.The K-Medoids method is employed to identify customer purchase patterns through clustering, while Backpropagation is used to predict sales trends by enhancing accuracy through training.The results of this research are expected to provide valuable insights into the dynamics of MPX2 oil sales, enabling companies to improve marketing strategies, transaction management, and inventory strategies.

System Analysis
The data input for this study was obtained through observations and interviews related to the sales of MPX2 Oil in stores.The data used to determine stock predictions are derived from transaction information spanning from 2022 to 2023.It is essential to note that the research context is specifically centered around MPX2 Oil Sales Forecasting, aligning with the adjusted research title for a more accurate depiction.The table contains information about the date, item code, item name, type, brand, quantity, unit, and total price.From this table, data will be processed to obtain predictions for stock levels of the items.

Process Overview
Based on the sales data of MPX2 Oil, the prediction process in this research is carried out by processing normalized sales data using the K-Medoids and Backpropagation algorithms.Subsequently, the data resulting from the Backpropagation process will be denormalized to obtain the Mean Absolute Deviation (MAD) value.Based on this MAD value, the system will provide information to the owner regarding the sales prediction of MPX2 Oil stock.

Output Data
a. Determining the number of clusters: The first step involves performing k-medoids clustering by calculating the cluster data for the quantity of sales stock as follows: Non-functional requirements analysis involves these aspects to ensure the smooth development and operation of the application.Specific hardware and software specifications were chosen for this system based on several important considerations: a.The Intel® Core™ i3-7020 CPU 2.30GHz processor balances performance and power efficiency, suitable for applications that do not overly burden the processor.b.The DDR4 SODimm 8 GB PC19200/2400 Mhz RAM provides sufficient memory to run modern applications smoothly, enabling seamless multitasking.c.The Toshiba 1 TB Version MQ04ABF100 SATA HDD offers ample storage capacity for storing application data and the operating system, while the LOGITECH M187 (Wireless) mouse adds convenience with its wireless design.In terms of software, Visual Studio Code Version 1.61.2 was selected as it is a lightweight and versatile code editor that supports multiple programming languages and extensions.The Windows 10 Home Single Language (64-bit) Version 21H1 operating system is stable and widely used, ensuring compatibility with various software.Google Chrome Version 94.0.4606.81provides fast and efficient browsing performance, which is essential for research and development.Git Version 2.32.0.2 supports effective code version management, which is crucial in software development.Finally, Xampp Version 3.3 provides an easy-to-use local web development environment, allowing efficient testing of web applications.These specifications were chosen to ensure that the system has stable, reliable, and efficient performance for application development, considering both functional and non-functional aspects of the system.

System Design (Architecture)
This process involves steps such as ordering training data, data preprocessing, clustering using the K-Medoids method, generating Backpropagation values, denormalizing results, and calculating Mean Absolute Deviation (MAD) to produce prediction results.If the data has not been trained, then preprocessing with the K-Medoids method will be chosen.This entire process helps in designing an efficient stock prediction system.

02401010-05
Furthermore, there is a database design explained in Figure 2 with the Class Diagram as follows: the process of predicting goods involves entities such as user, incoming goods, unit, supplier, and type.

K-Medoids
K-Medoids, also known as Partitioning Around Medoids (PAM) or K-Medians, is a clustering algorithm that serves as a modification of the K-Means technique.It is believed to overcome a significant limitation of K-Means, which is its sensitivity to outliers.In situations where an object with an extreme value might deviate significantly from the dataset's distribution, the average of each cluster does not lead to the use of a medoid.Due to severe values in the dataset, the goal is to reduce the sensitivity of the partitioning.Medoid objects are resistant to outliers because they are positioned at the center of clusters.The proximity of medoid and non-medoid objects is considered when forming clusters.The K-Medoids algorithm performs better with very large datasets, similar to the K-Means algorithm.Data normalization is advised before determining distances for data with various parameters to ensure balance.
The workings of K-Medoids are as follows: a. Determine the number of cluster centers, k (clusters).b.Randomly create k initial medoids using n data points.
Use Euclidean Distance to calculate the distance of objects from each selected medoid, as given by Equation (2): c.After randomly selecting a new medoid, determine the distance of objects from each chosen medoid using Euclidean Distance.Determine the shortest distance across all the new medoids.d.Apply Equation (3) to determine the total deviation (S) using the following equation: where a: the sum of the nearest distances between objects to the original medoid, and b: the sum of the nearest distances between objects to the new medoid.
If S < 0, then swap the object with data to produce a new set of k medoids.Repeat steps 3-5 until no more changes in medoids occur, resulting in a number of clusters and their members.

Backpropagation
Multi-layer perceptrons typically use backpropagation, a supervised learning technique, to adjust weights connecting neurons in the hidden layers.Before the backpropagation method can utilize output errors, an initial step must be completed.

Data Normalization in K-Medoids and Backpropagation
Data normalization is a crucial step in data processing before applying machine learning algorithms such as K-Medoids and Backpropagation.This process involves adjusting the scale of data values to a specific range, such as 0 to 1, or having a mean of 0 and variance of 1.The main goal is to transform data into a more easily processed format by algorithms, avoiding biases towards features with larger scales and enhancing algorithm convergence.Using K-Medoids and Backpropagation with normalized data effectively provides profound insights into customer purchasing behavior and sales trends, which are crucial for sales strategies and inventory management in the automotive industry.The contribution of data normalization to the effectiveness of K-Medoids and Backpropagation algorithms is significant.
For K-Medoids, the normalization process enhances clustering accuracy by ensuring that all features contribute equally to cluster formation.This prevents features with larger ranges from dominating the clustering process, resulting in a more balanced and accurate representation of each cluster.Additionally, normalization reduces the impact of outliers, allowing medoids to represent each cluster, thus improving overall clustering quality more accurately.Meanwhile, in Backpropagation, data normalization plays a crucial role in speeding up the convergence process during training.Normalizing data prevents issues with vanishing gradients, often occurring when inputs have highly varied ranges.This enables the neural network to adjust its weights more efficiently, leading to faster and more effective learning.Moreover, normalization enhances the generalization ability of the neural network by providing data in a similar range, allowing the model to handle new inputs more effectively.Overall, data normalization significantly contributes to the effectiveness of both methods in predicting MPX2 Oil sales in the automotive workshop industry.

Feedforward, Backpropagation, and MSE Calculation
The implementation of the backpropagation algorithm in predicting sales includes a step-by-step explanation of the model training process, starting from output calculation, error measurement, adjustment of weights (w1, w2), and bias (b), to the calculation of Mean Squared Error (MSE).These steps aim to train the model using the backpropagation algorithm to forecast oil sales.a. Feedforward: 1) Formula ( 9) illustrates the feedforward step where the output is calculated based on input (x1, x2), weights (w1, w2), and bias (b).
2) Formula (9.1) measures the error between the generated output and the target value (y).
2) Formulas ( 10) and (10.1) show the changes in weights w1 and w2 based on the gradient of error with respect to the corresponding weights and input.
3) Formula (11) describes the change in bias value (b) based on the gradient of error with respect to bias.
4) Formula (12) shows the calculation of the new output after updating weights and bias. ) 2  (13) 1) MSE is calculated after the iterations are complete, providing an indication of how well the model can predict the target compared to actual values.2) MSE is calculated by summing the squared errors and dividing by the number of data points.By following these steps, the research can systematically train the model using the backpropagation algorithm to enhance accuracy in forecasting oil sales.This overall process can assist in achieving the study's goal of improving the accuracy of oil sales predictions by combining K-Medoids and Backpropagation.

Results and Discussion
After analyzing the system requirements, the next step is the system design, which includes the design of a Flowchart, ERD, DFD, table relationships, Context Diagram, and application interface using case tools such as Draw.io,Visio, and Balsamiq Wireframes.The next process is the writing of the program code, broken down into small modules that will be integrated.The author utilizes Visual Studio as the code-writing platform, taking into consideration the previous system design.Subsequently, the modules are integrated and tested to ensure compatibility with the design.The final stage is system maintenance, where errors are corrected, and additional features may be added after the system is implemented.

Implementation of the Program (Development)
The implementation of the user interface views of the application created by the researcher will be presented below: The page is used to add transactions when there is a purchase of goods.Once the transaction form is filled out, you can press the "Add" button, and the data will appear on the right side of the page, which is the list of sales transactions.To continue the transaction, press the "Pay" button.Then, the payment form shown in figure 4 will appear.

Transaction List Management Page
In figure 5, there is a transaction list page that has been previously executed.On this page, the admin can view the details of each transaction that has been conducted by clicking the eye icon button in the "Action" column.

Figure 7. Prediction results
Figure 7 shows the prediction results, which are a crucial part of the system evaluation.On this page, there is highly relevant information regarding the performance of the implemented predictive model.The Mean Squared Error (MSE) value of 0.01969 and Mean Absolute Deviation (MAD) value of 0.12200 provide an insight into how well the model can predict the sales of Mpx2 oil.MSE and MAD are commonly used evaluation metrics in forecasting contexts, where lower values indicate higher accuracy.In this case, the low MSE value (0.01969) indicates that the difference between predicted and actual values tends to be small.This implies that the model tends to provide accurate estimates regarding the sales of Mpx2 oil.Meanwhile, the MAD of 0.12200 also indicates that the model has a low deviation level in predicting data, indicating high precision in performance assessment.Based on these results, it can be concluded that the implementation of the Backpropagation and K-Medoids algorithms in the store procurement system effectively produces a reliable predictive model for sales forecasting.With low MSE and MAD values, the system can provide accurate and valuable predictive information for decision-making at operational and managerial levels.

Results of Feedforward, Backpropagation, and MSE Calculation
This process utilizes the artificial neural network (ANN) learning method, consisting of several main steps, including feedforward, error calculation, backpropagation, and Mean Squared Error (MSE) calculation.In the feedforward phase, the network's output is calculated based on the current input and parameters, including weights (w1, w2) and bias (b).This process is evident in the 'Output' column of the table, calculated using the formula Output = (x1 × w1) + (x2 × w2) + b.Subsequently, error calculation is performed by subtracting the generated output from the expected value (y), reflected in the 'Error' column.After that, the backpropagation step is taken.Weights and bias are adjusted based on the obtained error, as reflected in the changing values of weights and bias from epoch to epoch in the table.In the first epoch, the Mean Squared Error (MSE) value is 9.22273, indicating a high level of error in the initial predictions.However, as the learning process progresses, there is a decrease in the MSE value to 2.53864 in the second epoch and further decrease to 0.88127 in the third epoch.This decline indicates an improvement in the model's accuracy in predicting Mpx2 oil sales.The process involves continuous adjustments of weights and biases based on the error gradient, calculated through the backpropagation process.These adjustments aim to minimize MSE, thus enhancing the model's prediction accuracy.The overall process demonstrates how the Backpropagation method, along with K-Medoids, can be effective in predicting sales, as reflected in the gradual decrease in MSE values during the training process.

Evaluation Results
The evaluation results obtained from various tests of system implementation and program implementation in this study indicate the successful implementation of the K-Medoids and Backpropagation algorithms in the Goods Procurement System at the store.The system has been successfully developed to provide quick information or data reports.The testing results for the goods procurement system show the following scores: The evaluation results of the implementation of the procurement system in the store indicate success in implementing the K-Medoids and Backpropagation algorithms.Table 3 provides an overview of the testing scores for various features within the system, indicating that each feature, such as the Login Page, Add Transaction Page, Edit Transaction Page, List Transaction Page, Manage Item Data Page, and Edit Item Data Page, all successfully achieved the maximum scores.These scores reflect excellent performance in building a responsive and functional system.Thus, the testing results confirm that the implementation of this program provides an effective and reliable solution in supporting transaction management and procurement of goods in the store, delivering information and data reports with the expected speed and accuracy.The results of the evaluation of the procurement system implementation indicate excellent achievement, with all features successfully tested and achieving maximum scores.The evaluation table includes several key features in the system, such as the supplier data management page, add supplier data page, edit supplier page, manage unit data page, edit unit data page, manage incoming stock data page, edit incoming stock data page, outgoing stock data page, and algorithm implementation page.Each feature successfully obtained a maximum score, demonstrating the success of implementing the K-Medoids and Backpropagation algorithms in the store's procurement system.This success reflects the system's ability to provide information and data reports quickly and effectively, providing crucial support for operational-level management processes and decision-making.

Discussion
The results of this study indicate that the approach taken to design, implement, and test the procurement system in the store, including the integration of K-Medoids and Backpropagation algorithms, has successfully achieved excellent outcomes.The system development process began with a comprehensive design phase, involving the creation of flowcharts, Entity-Relationship Diagrams (ERD), Data Flow Diagrams (DFD), table relationships, Context Diagrams, and application interfaces.Subsequently, the program implementation phase was carried out by breaking down the program code into small modules using Visual Studio, adhering to the previously designed system.The integration and testing of these modules were conducted to ensure compliance with the designed framework.In terms of user interface (UI), the implementation results were demonstrated through key pages, such as the Transaction Form Addition Page, Payment Form Page, Transaction List Management Page, and Algorithm Implementation Page.The interface design created using case tools such as Draw.io,Visio, and Balsamiq Wireframes provided a clear and efficient visual overview for system users, covering transaction processes and algorithm visualization results.The implementation process of the K-Medoids and Backpropagation algorithms, as depicted in the calculation results, showed that the model could learn patterns from data and improve the accuracy of Mpx2 oil sales predictions.Despite initially high error rates, the backpropagation steps resulted in a gradual decrease in Mean Squared Error (MSE) values during the training process.This reduction reflects an enhancement in the model's accuracy in predicting Mpx2 oil sales, providing strong support for the effectiveness of the Backpropagation and K-Medoids methods in the sales forecasting context.In the evaluation phase, test result scores affirmed the success of the system implementation, with each feature, including the Login Page, Transaction Addition Page, Transaction Edit Page, Transaction List Page, Product Data Management Page, and Product Data Edit Page, successfully achieving maximum scores.This indicates that the system is reliable and responsive in supporting the operational functions related to transactions and procurement.Further evaluation of features such as Supplier Data Management Page, Unit Data Management Page, Stock In Data Management Page, and Algorithm Implementation Page also demonstrated success in implementing the K-Medoids and Backpropagation algorithms.The findings of this study are relevant to previous research indicating the effectiveness of artificial neural network learning methods in sales prediction [15]- [17].In contrast to research emphasizing Backpropagation methods on non-linear and non-stationary data [18], this study applies

02401010-013
Backpropagation to forecast Mpx2 oil sales, contributing additional insights into understanding historical purchasing patterns and predicting sales trends in the future, particularly in the automotive industry context.References to previous studies, such as by Berahmana et al. (2020), discussing customer segmentation with RFM models and K-Means, K-Medoids, and DBSCAN algorithms, provide a framework for understanding customer purchasing behavior.The strengths of this research lie in choosing the K-Medoids and Backpropagation methods over other methods for the context of inventory procurement in a store.K-medoids is selected for their superior ability to handle outliers compared to other clustering methods like K-means.This is crucial in retail sales, where purchasing patterns can be highly variable and often contain outliers.By using K-Medoids, the system can identify customer purchasing patterns more accurately, grouping them based on similar buying characteristics and enhancing the effectiveness of sales and inventory procurement strategies.
On the other hand, Backpropagation, as a technique in artificial neural network learning, is chosen for its superior capability in handling complex and non-linear data commonly encountered in sales data.This method allows the model to learn patterns from historical data of Mpx2 oil sales and predict future sales trends with higher accuracy.Backpropagation also enables the system to dynamically adapt to changes in data, which is crucial in the rapidly changing retail sales environment.The combination of these two methods reflects a profound understanding of the characteristics of sales data in the automotive industry and the need for predictive tools that can handle the variability and complexity of such data.By integrating K-Medoids for customer cluster analysis and Backpropagation for sales prediction, this research successfully achieves an efficient, accurate inventory procurement system that is highly relevant to the dynamics of the current market.Thus, the results of this study have significant implications in the context of developing transaction management systems and predicting stock in the retail industry, especially for Mpx2 oil products.The integration of K-Medoids and Backpropagation algorithms in the store's procurement system has proven successful in improving sales prediction accuracy.These implications reflect the potential application of artificial neural network learning methods, such as Backpropagation, in addressing sales forecasting challenges in non-linear and nonstationary environments.The system's success in achieving maximum scores across various features, including transaction management and procurement, instills confidence that this solution can be relied upon to support store operations with high efficiency and responsiveness.These implications may also serve as inspiration for the automotive industry and other sectors to adopt similar approaches in enhancing inventory management efficiency and predicting customer needs.

Conclusion
The results of this study indicate that the integration of K-Medoids and Backpropagation algorithms in the store's procurement system has successfully improved the accuracy of Mpx2 oil sales predictions.The designed, implemented, and evaluated system achieved excellent outcomes, with all features obtaining maximum scores in testing.Nevertheless, the limitations of this research include a restricted evaluation of data and a comparison with other potentially relevant methods in a similar context.For future research, it is recommended to conduct further experiments with a broader dataset and compare the results with alternative methods.Additionally, the study could be expanded by considering external factors that may influence sales predictions, such as changes in market trends or economic factors.

Figure 2 .
Figure 2. Database Server Design a. Initialize the weights by assigning random values (small random values from 0 to 1). b.As long as the stop condition is false, perform steps 3-9.c.For each training data pair (x_setb, tb) where b=1,…,l, perform steps 4-8.d.Starting the forward process, each input unit (Xi, I = 1,…, n) receives an input signal xi and forwards it to the hidden layer.Each hidden unit (Zj, j= 1,…,p) sums the weighted input signals:∑      =1 c. Iterative Training:An iterative process where the backpropagation step is repeated for each training data.d.Mean Squared Error (MSE) Calculation:

Figure 3 .
Figure 3. Add Transaction Form Page

Figure 4 .
Figure 4. Payment Form Page

Table 2 . Early literacy Literacy 1 with Early Center C
1)And proceed to the backward process Each output unit (yk, k=1,..., m) receives a target pattern related to the learning input pattern, calculate error information   ,   = (  −   ) 1 (_  )

Table 4 .
Test Results Score

Table 5 .
Advanced Testing Results Score