scieee AI-readable full text Open interactive document viewer

Utilizing Random Forest with iForest-based outlier detection and SMOTE to detect movement and direction of RFID tags

Alfian, Ganjar

Abstract

In recent years, radio frequency identification (RFID) technology has been utilized to monitor product movements within a supply chain in real time. By utilizing RFID technology, the products can be tracked automatically in real-time. However, the RFID cannot detect the movement and direction of the tag. This study investigates the performance of machine learning (ML) algorithms to detect the movement and direction of passive RFID tags. The dataset utilized in this study was created by considering a variety of conceivable tag motions and directions that may occur in actual warehouse settings, such as going inside and out of the gate, moving close to the gate, turning around, and static tags. The statistical features are derived from the received signal strength (RSS) and the timestamp of tags. Our proposed model combined Isolation Forest (iForest) outlier detection, Synthetic Minority Over Sampling Technique (SMOTE) and Random Forest (RF) has shown the highest accuracy up to 94.251% as compared to other ML models in detecting the movement and direction of RFID tags. In addition, we demonstrated the proposed classification model could be applied to a web-based monitoring system, so that tagged products that move in or out through a gate can be correctly identified. This study is expected to improve the RFID gate on detecting the status of products (being received or delivered) automatically.

Full text

Citation: Alfian, G.; Syafrudin, M.; Fitriyani, N.L.; Alam, S.; Pratomo, D.N.; Subekti, L.; Octava, M.Q.H.; Yulianingsih, N.D.; Atmaji, F.T.D.; Benes, F. Utilizing Random Forest with iForest-Based Outlier Detection and SMOTE to Detect Movement and Direction of RFID Tags. Future Internet 2023,15, 103. https:// doi.org/10.3390/fi15030103 Academic Editors: Leonilde Varela, Goran D. Putnik and Claude Chaudet Received: 17 January 2023 Revised: 5 March 2023 Accepted: 6 March 2023 Published: 8 March 2023 Copyright: © 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/). future internet Article Utilizing Random Forest with iForest-Based Outlier Detection and SMOTE to Detect Movement and Direction of RFID Tags Ganjar Alfian 1,* , Muhammad Syafrudin 2,* , Norma Latif Fitriyani 3, Sahirul Alam 1, Dinar Nugroho Pratomo 1, Lukman Subekti 1, Muhammad Qois Huzyan Octava 1, Ninis Dyah Yulianingsih 1, Fransiskus Tatas Dwi Atmaji 4and Filip Benes 5 1Department of Electrical Engineering and Informatics, Vocational College, Universitas Gadjah Mada, Yogyakarta 55281, Indonesia 2Department of Artificial Intelligence, Sejong University, Seoul 05006, Republic of Korea 3Department of Data Science, Sejong University, Seoul 05006, Republic of Korea 4Industrial and System Engineering School, Telkom University, Bandung 40257, Indonesia 5Department of Economics and Control Systems, Faculty of Mining and Geology, VSB—Technical University of Ostrava, 70800 Ostrava, Czech Republic *Correspondence: ganjar[email protected] (G.A.); [email protected] (M.S.) Abstract: In recent years, radio frequency identification (RFID) technology has been utilized to monitor product movements within a supply chain in real time. By utilizing RFID technology, the products can be tracked automatically in real-time. However, the RFID cannot detect the movement and direction of the tag. This study investigates the performance of machine learning (ML) algorithms to detect the movement and direction of passive RFID tags. The dataset utilized in this study was created by considering a variety of conceivable tag motions and directions that may occur in actual warehouse settings, such as going inside and out of the gate, moving close to the gate, turning around, and static tags. The statistical features are derived from the received signal strength (RSS) and the timestamp of tags. Our proposed model combined Isolation Forest (iForest) outlier detection, Synthetic Minority Over Sampling Technique (SMOTE) and Random Forest (RF) has shown the highest accuracy up to 94.251% as compared to other ML models in detecting the movement and direction of RFID tags. In addition, we demonstrated the proposed classification model could be applied to a web-based monitoring system, so that tagged products that move in or out through a gate can be correctly identified. This study is expected to improve the RFID gate on detecting the status of products (being received or delivered) automatically. Keywords: RFID; IoT; machine learning; tag direction; outlier detection; data balancing 1. Introduction Industry 4.0 allows for the digitalization of industrial machinery, operations, and assets, which offers new understandings and effectively addresses current challenges [ 1 ]. IoT (Internet of Things) is a key technology driving the fourth industrial revolution, also known as Industry 4.0. Industry 4.0 is the incorporation of cutting-edge technologies, such as IoT, Artificial Intelligence, big data, and cloud computing, into the manufacturing and industrial sectors. By connecting and communicating physical objects to the internet using IoT, large amounts of data can be gathered and analyzed, resulting in enhanced automation, efficiency, and decision-making in industrial procedures. For example, IoT-enabled sensors can be used for monitoring the environmental temperature of server rooms [ 2 , 3 ], network monitoring systems [ 4 , 5 ], monitoring automotive manufacturing [ 6 , 7 ], and healthcare monitoring systems [8,9]. RFID, or Radio-Frequency Identification, is a technology that uses radio waves to communicate between a reader and a tag attached to an object. RFID is considered a part of the Internet of Things (IoT) because it allows for the identification and tracking of physical Future Internet 2023,15, 103. https://doi.org/10.3390/fi15030103 https://www.mdpi.com/journal/futureinternet Future Internet 2023,15, 103 2 of 16 objects over the internet, enabling them to connect and communicate with other devices and systems. This enables real-time monitoring, automation, and remote control of the objects. RFID tags can be placed on products and used to monitor their movement in and out of a warehouse by installing RFID readers at the gates. However, the reader cannot determine the direction of the tags, whether they are entering or exiting the warehouse. Previous studies have shown that using the received signal strength (RSS), timestamps, and machine-learning algorithms can be used to determine false positive tags [ 10 – 14 ]. However, these studies have not evaluated different types of tag movement that may occur in realworld scenarios. Therefore, it is important to use machine-learning models to identify the direction of tags by considering different types of tag movement to improve the efficiency of the RFID gate [15–18]. Random Forest is an ensemble machine learning method that combines multiple decision trees to improve classification and regression predictions by reducing overfitting and providing an estimate of feature importance. RF models have been effectively used for classification problems and have improved system performance [ 19 – 24 ]. However, machine learning algorithms often face difficulties such as outliers and imbalanced datasets, which can decrease accuracy. Studies have shown that by removing outliers using the Isolation Forest (iForest) method [ 25 – 28 ] and balancing imbalanced data with Synthetic Minority Over Sampling Technique (SMOTE) [ 29 – 32 ], the performance of the prediction system can be improved. Despite this, there is no study on integrating the iForest-based outlier detection, SMOTE, and RF classifiers to improve the performance of RFID gates. Therefore, this study proposes a prediction model that combines iForest-based outlier detection, SMOTE, and RF to predict the movement and direction of RFID tags based on RSS and timestamps. Furthermore, implementing the proposed predicted model into a web-based monitoring system could detect the direction of the tagged product automatically. The contributions of the present study can be summarized as follows: • We proposed a combined method of iForest outlier detection, SMOTE data balancing and Random Forest to classify movements and directions of RFID tags, which has never been done before. • We evaluated the performance of the proposed prediction model on our dataset by considering more complex movements and directions of RFID tags that can happen in real warehouse environments. • We improved the performance of the proposed model by removing the outlier and balancing the training-set. • We conducted extensive comparative experiments on the proposed model with other prediction models and previous study results. • We provided the impact analysis of outlier detection and data balancing method with or without iForest and SMOTE toward model’s accuracy performance. • Finally, we demonstrated the practicability of our proposed model by designing and developing the web-based RFID monitoring system. • In addition, implementing the proposed predicted model into a web-based RFID monitoring system could be applied in warehouse to detect the direction of the tagged product automatically. The rest of this study is organized as follows: In Section 2, we present machine learning models, including iForest, SMOTE, and RF. In Section 3, we explain the proposed prediction model for tag movement and direction. In Section 4, we report the results of our experiments and the implementation of our model. Lastly, in Section 5, we provide the conclusion, including any limitations of the study and potential areas for future research. 2. Literature Review 2.1. Tag Movement and Direction RFID technology can be applied in a warehouse to identify items with RFID tags within the reader’s range. While RFID readers can be used to track products as they are Future Internet 2023,15, 103 3 of 16 loaded onto trucks for transportation to other supply chain partners, the reader cannot differentiate between tags that are intentionally moving through the gate and those that happen to be in the reading range by chance. Several techniques have been suggested to tackle this problem, including using RSS and timestamps. Previous studies have examined the use of RSS information to detect false positive tags. Keller et al. [ 10 ] looked at the characteristics of both static and moved tags from low-level reader data, including RSS. They explored the optimal threshold for separating static (false positive) and moved (true positive) tags. They developed a classifier based on a single RSS feature and achieved an accuracy of 95.69%. Ma et al. [ 11 ] recently addressed false positive detection based on RSS. They used several machine learning algorithms (DT, support vector machines (SVMs), and LR) to classify RFID readings using features related to RSS and phase shift. The SVM-based approach outperformed all other models, achieving the highest accuracy (up to 95.5%). Zhu et al. [ 12 ] propose an algorithm to address the problem of false positive readings from supply chain radio frequency identification (RFID) systems. They extend the scenario to more complex access control systems, where detecting false-positive and false-negative data is critical to improving security and user satisfaction. The RFID data was divided into 70% training and 30% test data. Four training methods were used: ASOINN, SVM, LR, and DT, and the results show that all methods performed well. To improve prediction accuracy, Alfian et al. [ 13 ] proposed false positive detection based on RF and Inter Quartile Range (IQR) outlier detection. By removing the outlier, the prediction accuracy can be improved. The result shows that the integrated model successfully detects moving tags up to 97.496. Furthermore, Motroni et al. [14] proposed a model to classify the tags that move statically and pass-through portals. Sample data collected from an RFID reader and an array antenna are classified using SVM and LSTM. The results showed that SVM has an accuracy of more than 99%, while LSTM has an accuracy of around 95%. This result can be applied to RFID readers at the entrance of fashion stores as anti-theft systems. Previous studies on false positive detection have not fully evaluated various types of tag movement that may occur in real-world scenarios. To improve the efficiency of RFID gates, it is necessary to use machine-learning models to identify tag direction while taking into account different types of tag movement. Motroni et al. [ 15 ] presented a classification method for monitoring forklifts in Industry 4.0 scenarios. The proposed method uses machine learning techniques to analyze sensor data from forklifts and accurately classify their actions, such as moving, loading, and unloading. The implementation uses a UHFRFID Smart Gate with a single reader antenna and asymmetrical deployment, thus allowing the correct action classification with reduced infrastructure complexity and cost. The results show that the proposed method improves efficiency and safety in warehouse operations by enabling real-time monitoring and intervention when necessary. In addition, movement and direction detection for objects attached with RFID tags using machine learning was also presented in [ 16 ]. The detection of the position and orientation of moving objects was modeled as a classification problem and solved using a Light Gradient Boosting Machine. The proposed method was verified to have high accuracy in detecting the position and orientation of moving target boxes on a conveyor belt. Further experiments were conducted utilizing the robot to grip the moving object with a high success rate as the results. Alfian et al. [ 17 ] utilized XGBoost to classify the movement and direction of tagged products. Several movement types such as move in, move out, move close, static and turn back were considered in this study. The statistical features were extracted from RSS and timestamps of the single reader with two antennas. The result showed that the proposed model outperformed other machine learning models with an accuracy of up to 93.5%. Finally, Mizuno et al. [ 18 ] propose the state detection of multiple RFID tags using a single antenna placed at a certain angle. The states detected are stay still, forward, and backward movement. The purpose of the angled placement of the antenna is to obtain different values of received signal strength indication (RSSI) and phase angle according to the state of RFID tags. Those values are then evaluated using a random forest algorithm Future Internet 2023,15, 103 4 of 16 to define the state. The proposed method was evaluated through the experiment with 70 RFID tags and the better performance was shown by the angled antenna compared to the normal placement (without angle). 2.2. iForest Outlier Detection Previous studies mostly concentrate on enhancing the precision of models, rather than the significance of preparing data. Identifying inconsistencies or outliers in data by using outlier detection techniques during the pre-processing stage can lead to the creation of better classifiers, resulting in better decision-making. Removing outliers from the training data will increase classification accuracy. Isolation Forest (iForest) is an algorithm for detecting outliers or anomalies in a dataset [ 33 ]. The algorithm uses the concept of isolation to separate outliers from normal observations. iForest is efficient and easy to use and can be applied to high-dimensional datasets. Many studies have been conducted and have demonstrated that iForest outlier detection can significantly improve classification accuracy. Heigl et al. [ 25 ] introduce PCB- iForest, a new framework for outlier detection in streaming data. Based on F1 scores and trade-off with average runtime, PCB-iForest clearly outperformed nine competitors on multi-disciplinary ODDS in about 50% of the data set and achieved comparable results in 80%. Chang et al. [ 26 ] proposed three steps for training a classification model: signal segmentation, LOF-based anomaly score, and then isolation forest modeling. Signal sensors in the diffusion process of semiconductor manufacture capture both normal and abnormal data, but it is challenging to classify the anomalies since they only exist in a particular region. According to the experiment results, the proposed method outperforms other algorithms. Hu et al. [ 27 ] proposed a preprocessing method to improve the accuracy of hourly water demand forecasting models. This method reduced the RMSE of the SVR, ANN, and GRU models by 57.5%, 27.8%, and 30.0%, respectively. The local outlier detection and correction method effectively identifies global outliers and corrects them. GRU-based models perform better than ANN and SVR-based models, with the IF-CEEMDAN-GRU model being the most accurate. The proposed method also improves the accuracy of conventional models like SVR with a lower computational load. Finally, Chen et al. [ 28 ] compared five anomaly detection algorithms and found BS-iForest to be the best performing. Its AUCs on the BreastW dataset and campus CRS dataset were 0.9947 and 0.989, respectively, higher than the traditional forest method. The accuracy rates were also higher, at 0.9653 and 0.9896, respectively. BS-iForest screens sub-sampling sets before training and uses sets that are more likely to have outliers. However, compared to the standard iForest algorithm, iForest has a higher AUC index regardless of the proportion of outliers. 2.3. SMOTE Dealing with imbalanced datasets, where one class is significantly more represented than the other, is a challenging task in supervised learning as traditional classification algorithms are designed to work with balanced class distributions. One solution is oversampling, which artificially increases the number of samples in the minority class to balance the class distribution. One popular oversampling technique is SMOTE, which generates new synthetic samples of the minority class by interpolating the feature space between existing minority class samples and their closest neighbors [ 29 ]. This allows for a more balanced dataset and can improve the performance of machine learning models. There have been numerous studies that have proven that using SMOTE can significantly enhance the precision of classification. Sun et al. [ 30 ] proposed a model that utilizes SMOTE to tackle the problem of imbalanced datasets, to be used as a tool by banks to evaluate enterprise credit. When tested using financial data from 552 Chinese listed companies, the proposed model outperformed traditional models. Le et al. [ 31 ] used various oversampling techniques to address imbalance issues in a financial dataset collected from Korean organizations between 2016 and 2017. The results showed that a combination of SMOTE and Edited Nearest Neighbor (SMOTE + ENN), as well as RF, achieved the highest Future Internet 2023,15, 103 5 of 16 accuracy in predicting bankruptcy. In another study, a method that combines SMOTE with SVM was proposed to enhance the prediction accuracy for identifying old banknotes [ 32 ]. The findings revealed that the proposed method could improve performance by as much as 20% compared to the standard SVM algorithm. 2.4. Random Forest The ensemble approach, which combines different classifiers, has been proposed to improve the performance and accuracy of diabetes analysis and prediction. Random Forest is one such ensemble technique that combines the findings of individual decision trees [ 34 ]. It is made up of an ensemble of classifiers, each of which is a decision tree with nodes representing attributes. Random Forest typically works by using the bagging method to generate subsets of training data. Previous studies have shown that Random Forest has been used in many areas and has produced significant results. Mani et al. [ 19 ] utilized machine learning models such as Gaussian Naive Bayes, Logistic Regression, K-nearest neighbor, Classification and Regression Trees (CART), and Random Forest to predict type 2 diabetes for the next six months to one year based on electronic medical records (EMR) data. The results showed that RF outperformed other models in predicting diabetes. Lopez et al. [ 20 ] used Random Forest to identify the most important attributes related to diabetes. The proposed model was compared to other machine learning models such as Support Vector Machines and Logistic Regression (LR) and produced significant results. RF outperformed other models in terms of prediction accuracy and estimated relevance of the attributes. Alam et al. [ 22 ] used a Random Forest classifier for disease classification and tested it on 10 medical benchmark datasets. A feature ranking-based approach was developed and implemented for medical data classification and the proposed RF model produced promising results. Finally, Sun et al. [ 21 ] used a random forest (RF) classifier to model changes in hypertension control in 1294 patients at Vanderbilt University Medical Center. They found that the RF model was able to accurately predict changes in hypertension control status. This research could be used to develop personalized hypertension management plans. Previous studies have shown that using a random forest (RF) model can be applied to prediction models in many areas. However, these studies have also revealed that the presence of outliers and imbalanced data in the training set can negatively impact the performance of the RF model. By removing outliers and balancing the training set, the RF model is expected to have improved classification accuracy. 3. Methodology The proposed model in Figure 1uses RSS and timestamps to predict tag movement and direction. Data pre-processing was done to remove inconsistent data and missing values were replaced with the mean. Outlier detection based on iForest has been applied to the RFID readings dataset so that the outliers can be eliminated. Statistical features were extracted from RSS and timestamps and the SMOTE technique was applied to generate new instances of the minority class. The RF algorithm was used for prediction and performance was evaluated by comparing the proposed model to other machine-learning models. The trained model was then integrated into a web-based application for easy use by end users. The evaluation of the model was done using stratified 10-fold cross-validation, a variation of k-fold cross-validation where each subset contains the same proportion of class labels as the original dataset. 3.1. Dataset We proposed a prediction model based on RF to improve the prediction performance for tag movement and direction. We used a dataset from a previous study [ 17 , 35 ] which consists of five (5) types of tag movements, they are moving in, moving out, moving close, static, and turning back. There are 180 unique data generated for each move in, move out, Future Internet 2023,15, 103 6 of 16 move close and turn back, while for static tag 310 unique data were collected. In total, our study uses 1030 unique RFID movement data. Future Internet 2023, 15, x FOR PEER REVIEW 6 of 17 a variation of k-fold cross-validation where each subset contains the same proportion of class labels as the original dataset. Figure 1. Proposed ML model to detect movement and direction of tagged products. 3.1. Dataset We proposed a prediction model based on RF to improve the prediction performance for tag movement and direction. We used a dataset from a previous study [17,35] which consists of five (5) types of tag movements, they are moving in, moving out, moving close, static, and turning back. There are 180 unique data generated for each move in, move out, move close and turn back, while for static tag 310 unique data were collected. In total, our study uses 1030 unique RFID movement data. The dataset was collected using the RFID reader ALR-9900+ from Alien Technology and two linear antennas, ALR-9610-AL with 5.90 dbi Gain. The reader operates at a frequency of 902–928 MHz and supports EPC Class1 Gen2 (18000-6C). Passive RFID tags were attached to one side of each product box, using the model 9662 with a frequency range of 860‒960 MHz, IC type Alien H3 and EPC Class1 Gen2 (ISO 18000-6C) protocol. The dataset in [17,35] was gathered by considering various possible movements and directions of tags that can happen in real warehouse environments such as moving in and out through the gate, moving near the gate, turning back, and static tags (Figure 2). The setup used for this scenario was a single reader with two antennas, one installed outside and the other inside the warehouse gate. This allows for the recording of tagged products moving in and out of the warehouse. However, the RFID reader may also pick up false positive readings like when the product is moved near the gate, during a turn-back movement, or from static tags. These static tags occur when tags are located within the nominal read range or when the range is extended accidentally by metal objects within the field. The prediction model in this study is utilized to record the products that move in or out through the gate and filter out false positive readings. Figure 3 illustrates an example of tagged products moving in through the gate in a real warehouse. Figure 1. Proposed ML model to detect movement and direction of tagged products. The dataset was collected using the RFID reader ALR-9900+ from Alien Technology and two linear antennas, ALR-9610-AL with 5.90 dbi Gain. The reader operates at a frequency of 902–928 MHz and supports EPC Class1 Gen2 (18000-6C). Passive RFID tags were attached to one side of each product box, using the model 9662 with a frequency range of 860–960 MHz, IC type Alien H3 and EPC Class1 Gen2 (ISO 18000-6C) protocol. The dataset in [ 17 , 35 ] was gathered by considering various possible movements and directions of tags that can happen in real warehouse environments such as moving in and out through the gate, moving near the gate, turning back, and static tags (Figure 2). The setup used for this scenario was a single reader with two antennas, one installed outside and the other inside the warehouse gate. This allows for the recording of tagged products moving in and out of the warehouse. However, the RFID reader may also pick up false positive readings like when the product is moved near the gate, during a turn-back movement, or from static tags. These static tags occur when tags are located within the nominal read range or when the range is extended accidentally by metal objects within the field. The prediction model in this study is utilized to record the products that move in or out through the gate and filter out false positive readings. Figure 3illustrates an example of tagged products moving in through the gate in a real warehouse. 3.2. iForest Outlier Detection iForest works by constructing an ensemble of isolation trees (iTrees) for each dataset, where outliers are defined as instances with short average lengths in the iTrees [ 33 ]. The iTrees are recursively built by dividing the dataset until all instances are isolated or a specific tree height is reached. Algorithm 1 provides pseudocode for iForest. Given D(input data), MaxSample (subsample size), and NumTree (number of trees to build), the algorithm generates many iTrees and returns a Forest. The iTree is generated by using sample data from D. Algorithm 1 Isolation forest - Input D, NumTree, MaxSample Output Set of iTrees 1: Initialize Forest 2: set height limit h = ceiling(log2(MaxSample)) 3: for i = 1 to NumTree do 4: D0←− sample(D, MaxSample) 5: Forest ←− Forest ∪iTree (D0, 0, h) 6: end for 7: return Forest Future Internet 2023,15, 103 7 of 16 Future Internet 2023, 15, x FOR PEER REVIEW 7 of 17 Figure 2. Possible tag movement types. Figure 3. Application of RFID to track the products. Figure 2. Possible tag movement types. Future Internet 2023, 15, x FOR PEER REVIEW 7 of 17 Figure 2. Possible tag movement types. Figure 3. Application of RFID to track the products. Figure 3. Application of RFID to track the products. Future Internet 2023,15, 103 8 of 16 During iTrees generation, the next process is randomly select a feature qfrom each iTree and select a random value pwithin the range. The data is then split into two parts, they are left branch (data points q<p ) and right branch (data points q≥p ). This process is iterated until there is only one data point in the branch or the iTree has reached the maximum depth. This process is repeated many times for each iTree and finally, a Forest is produced. The last step is finding data points from each iTree which has a shorter path length and is labeled as an outlier. We used the Scikit-learn Python library to implement iForest. We found 120 outliers’ data and eliminated them from the RFID readings dataset and retained the remaining data for further analysis. 3.3. Feature Extraction RSS attributes, which are used to distinguish between moving and stationary tags, have been used in previous studies [ 10 , 11 , 13 , 17 ]. The strength of the RSS signal is determined by the distance between the antenna and the tag, with closer tags producing stronger signals. The timestamp information, which is used to determine the direction of the tags, is also an important parameter [ 10 , 13 , 17 ]. Table 1shows our statistical features extracted from a single antenna. Since this study utilizes two antennas, 36 attributes (including RSS and Timestamps) are extracted in total from both antennas. The statistical attributes were generated from the RFID readings dataset after outlier data were removed by iForest. We used all statistical features in [ 17 ] and add other features such as median, kurtosis, skewness, and count for both RSS and timestamps. Table 1. Attributes extracted from RSS and TimeStamp. Feature Type Attribute Name Description RSS RSS_Min Minimum signal strength RSS_Max Maximum signal strength RSS_Mean The average signal strength RSS_Std Standard deviation signal strength RSS_Med The median signal strength RSS_Diff Difference between the highest and lowest signal strengths RSS_Kurt Indication of whether the RSS distribution is heavy- or light-tailed relative to normal RSS_Skew Distribution asymmetry of signal strengths RSS_Count Total number of reads for the tag Timestamp Time_Min Timeframe (seconds) of tag read at the first time. Time_Max Timeframe (seconds) of tag read at the last time. Time_Mean The average value for the timeframe (seconds) Time_Std Standard deviation value for the timeframe (seconds) Time_Med The median value for the timeframe (seconds) Time_Diff Total period (seconds) for a tag between the first and last read time Time_Kurt Indication of whether the timeframe distribution is heavy- or light-tailed relative to normal Time_Skew Distribution asymmetry of timeframe Time_Count Total number of seconds for the tag Finally, the extracted features from the dataset were used as input X, while the label of tag movement was used as output y. Machine-learning algorithms are utilized to learn from this pair of Xand yin the training set, thus generating predictions. In our study, we use RF to detect the direction of RFID tags. 3.4. SMOTE The SMOTE (Synthetic Minority Over-sampling Technique) is a method used to increase the number of minority class instances in a dataset by generating new synthetic instances of the minority class [ 29 ]. This is done by randomly selecting the nearest neighbors of each minority class sample and creating new synthetic samples between them Future Internet 2023,15, 103 9 of 16 (see Figure 4). In this study, SMOTE was applied to our training set during Stratified 10-Fold CV in order to balance the training set, so that could improve prediction accuracy. Future Internet 2023, 15, x FOR PEER REVIEW 9 of 17 RSS_Skew Distribution asymmetry of signal strengths RSS_Count Total number of reads for the tag Timestamp Time_Min Timeframe (seconds) of tag read at the first time. Time_Max Timeframe (seconds) of tag read at the last time. Time_Mean The average value for the timeframe (seconds) Time_Std Standard deviation value for the timeframe (seconds) Time_Med The median value for the timeframe (seconds) Time_Dif f Total period (seconds) for a tag between the first and last read time Time_Kurt Indication of whether the timeframe distribution is heavy- or lighttailed relative to normal Time_Skew Distribution asymmetry of timeframe Time_Count Total number of seconds for the tag Finally, the extracted features from the dataset were used as input X, while the label of tag movement was used as output y. Machine-learning algorithms are utilized to learn from this pair of X and y in the training set, thus generating predictions. In our study, we use RF to detect the direction of RFID tags. 3.4. SMOTE The SMOTE (Synthetic Minority Over-sampling Technique) is a method used to increase the number of minority class instances in a dataset by generating new synthetic instances of the minority class [29]. This is done by randomly selecting the nearest neighbors of each minority class sample and creating new synthetic samples between them (see Figure 4). In this study, SMOTE was applied to our training set during Stratified 10-Fold CV in order to balance the training set, so that could improve prediction accuracy. Figure 4. Synthesized data generated by SMOTE. Figure 4. Synthesized data generated by SMOTE. 3.5. Random Forest The RF (random forest) algorithm is a classification method that combines decision trees [ 34 ]. Previous research has shown that using a randomization approach, such as bagging or the random space method, can improve the performance of RF. This randomization is achieved by using bootstrapped sampling of the original data and randomly selecting a subset of features at each node to determine the best split. The process of generating each tree in an RF model is described in Algorithm 2. Algorithm 2 Random forest Input : training dataset D, ensemble size T, subspace dimension d Output : majority votes from tree models for t= 1 to Tdo Build a bootstrap sample Dtfrom D Select dfeatures randomly and reduce the dimensionality of Dtaccordingly Train a tree model Mton Dt Split on the best feature in d Let Mtgrow without pruning end In the random forest method, individual decision trees are generated by randomly selecting a subset of features at each node to determine the split. The algorithm works as follows: given a training dataset (D), the number of trees (T) in the model, a subspace dimension (d), and the available features (F), then a bootstrapped sample ( Dt ) of the original dataset (D) is taken. This sample includes some records from the original dataset multiple times and excludes others. Then, a subset (d) of features is randomly selected from the bootstrapped sample ( Dt ) to use as candidates for the split at each node. The decision Future Internet 2023,15, 103 16 of 16 39. Rau, H.-H.; Hsu, C.-Y.; Lin, Y.-A.; Atique, S.; Fuad, A.; Wei, L.-M.; Hsu, M.-H. Development of a Web-Based Liver Cancer Prediction Model for Type II Diabetes Patients by Using an Artificial Neural Network. Comput. Methods Programs Biomed. 2016 , 125, 58–65. [CrossRef] 40. Ahmed, N.; Ahammed, R.; Islam, M.M.; Uddin, M.A.; Akhter, A.; Talukder, M.A.-A.; Paul, B.K. Machine Learning Based Diabetes Prediction and Development of Smart Web Application. Int. J. Cogn. Comput. Eng. 2021,2, 229–241. [CrossRef] Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.