## 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 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; 11; 12; 13; 14]. However, these studies have not evaluated different types of tag movement that may occur in real-world 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; 16; 17; 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; 20; 21; 22; 23; 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; 26; 27; 28] and balancing imbalanced data with Synthetic Minority Over Sampling Technique (SMOTE) [29; 30; 31; 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.