Inventory Management using Machine Learning

—A major requirement for small/medium-sized businesses is Inventory Management since a lot of money and skilled labor has to be invested to do so. E-commerce giants use Machine Learning models to maintain their inventory based on demand for a particular item. Inventory Management can be extended as a service to small/medium sized businesses to improve their sales and predict the demand of various products. Demand forecasting is a crucial part of all businesses and brings up the following question: How much stock of an item should a company/business keep to meet the demands, i.e., what should the predicted demand of a product be? Among its many benefits, a predictive forecast is a key enabler for a better customer experience through the reduction of out-of-stock situations, and for lower costs due to better planned inventory and less write-off items. We discuss the challenges of building an Inventory system and discuss the design decisions.

INTRODUCTION "Inventory is the supply of raw materials, partially finished goods called work-in-progress and finished goods, an organization maintains to meet its operational needs. It represents a sizeable investment and a potential source of waste that needs to be carefully controlled. Inventory is defined as a stock of goods that is maintained by a business in anticipation of some future demand [2]". Inventory management is a major requirement even for the small and medium shop owners. A system which tracks inventory levels, orders and sales in order to perform predictive analysis, obtaining forecasted demand will help to reduce over-stock and out of-stock situations. A good inventory management system must ensure keeping enough stock in the warehouse to ensure the business keep functioning but not enough stock to drain its limited cash reserves. This is a task where all business needs are to be anticipated, most of the calls made are crisis calls, yet where the people in-charge of the inventory need to find a solution. All done while simultaneously not using all the capital into non-moving stock." Forecasting product demand is one of the core challenges in any retail business [1]". Another question that needs to be answered is how we plan on using artificial intelligence into inventory management. Does it have any use in managing inventory? Artificial intelligence needs to be teamed with human oversight and should be treated as part of the system but not as a replacement for the system or the system itself. That being said, there are several companies that are using artificial intelligence in the inventory process and it is yielding very impressive results which leads us to believe that artificial intelligence might after all have a significant impact on demand forecasting. We are transitioning from the traditional ways of managing inventory, which is the direct result of the availability of the huge amounts of real-time data that are now routinely generated on the internet and through the interconnected world of enterprise software systems and smart products. Managers need to make effective use of this newly available data, by redesigning their inventory management process, to stay in the competition against several other Ecommerce businesses. Amazon, one of the giants in the business have used inventory management teamed with artificial intelligence in almost every part of the prediction process. "Optimum inventory should be maintained by all organization so that under inventory can be eliminated which disrupt the financial figures. Careful evaluation of internal and external factors through better planning can improve the status of inventory [4]".
II. LITERATURE SURVEY The concept of inventory management includes a vast set of areas to be dealt with. With the rapid expansion of ecommerce industry, the demand for efficient inventory management is the need of the hour. More research effort is required to improvise the existing inventory management techniques.
E-commerce giants define an end-to-end machine learning system using probabilistic demand forecasting models that is built on Apache Spark. Such e-commerce giants contain large datasets. Forecasting usually includes two different methodologies: Time series methodology and Machine learning methods [1].
A case study of Inventory Management focused on identification of factors that influences inventory optimization

International Journal of Engineering Research & Technology (IJERT)
ISSN: 2278-0181 http://www.ijert.org among SMEs in steel sector through a structured and unstructured questionnaire can aid in effective inventory management. It involves grouping the factors into two sets as internal variables and external variables [2].
Artificial neural networks (ANN) is an intelligent system that uses layers of neurons. ANNs are very good with fitting problems. A retrospective study on ANN for inventory management is required to improve prediction accuracy [3].
AI proves to be beneficial in handling the customer data and forecasting the purchase behavior of customers AI can be used to provide notification when a company has to re-order stock and assist in creating manufacturing schedule considering the variations in demand including seasonal increases accurately [4]. A decision support system (DSS) is another technique that could be used to assist for effective monitoring of inventory levels and to ensure continuous availability [5].
To perform inventory analysis that consists of multiple attributes under consideration, a hybrid methodology that integrates multi-criteria decision making (MCDM) techniques with different machine learning algorithms are used. The methodology uses ABC analyses for determining classes and Artificial Neural Network (ANN), Bayesian network, and Support Vector Machine (SVM) algorithms to predict different classes for inventory items. [6].
Identification of dead inventory can be achieved by predictive modelling. Predictive modelling is a methodology in which a predictive algorithm predicts part obsolescence in advance with reasonable accuracy [7].
ABC analyses is a classification technique that determines the relevant classes for each of the inventory items, thus providing the proper foundation for demand forecast process. ABC analyses generates an optimized inventory stock classification. [8].
The demand forecasting technique can be modeled by artificial intelligence approaches using artificial neural networks. Algorithms used for training such models include Batch gradient descent and Variable learning rate [9].
Software agents are multiagent systems developed within the JADE platform. Agents communicate through message exchange. The system is proposed to make the transition from the manual approach of inventory management software to a completely automated process [10].

III. PROPOSED SYSTEM
Organizations face a lot of internal and external risks, like high competition, labor unrest, high risk and change in government laws. So, a lot of the decisions an organization makes are under conditions of risk and grave uncertainty. These risks can be reduced by predicting the demand for sales of its products and services in the future. Demand forecasting is a systematic process of anticipating the demand of a product or service offered by the organization in the future under a set of unpredictable and competitive forces. In this paper we use the XGBoost regression model to perform demand predictions. XGBoost is a machine learning algorithm which uses decision trees. In prediction problems that have the data unstructured Neural networks outperform other prediction algorithms, but in our case the data is structured and tabulated, and decision tree algorithms are considered best for structured Figure 1: architrcture data. Hence, we decided to go with the XGBoost algorithm for demand forecasting.

IV. ARCHITECTURE
The proposed architecture is collectively obtained from five components: Data Ingestion, Data Pre-Processing, Storage, Feature Extraction, ML model. The architecture of Inventory Management Using Machine Learning is as shown in Fig.1:

A. Data Ingestion:
Initially, shop owners can login to the system and add their product details which is stored in a database. Also, the historical sales data is recorded in the database. This data, which is used to train the ML model, is ingested to the system. The training data used consists of several thousands of rows

B. Data Pre-processing:
Data pre-processing is a data mining technique which is used to transform the raw data in a useful and efficient format. The data ingested is cleaned before it is used for training the model. Hence, the unnecessary fields are eliminated from the database. Pre-processing also involves the transformation of raw data into an understandable format. and performance. S3 enables customers of all sizes and industries to use it and protect any amount of data for various use cases, such as websites, mobile applications, backup and restore. It is designed for 99.999999999% (11 9's) of durability. The pre-processed data is stored in the S3 Bucket.

D. Feature Extraction:
The data stored in S3 bucket contains several fields. With the help of proper feature extraction, the accuracy of model can be increased, hence only certain fields of the dataset were extracted for training. For example, the training data consists of product name as well as product ID. Only product ID is required to train the model. Thus, only the required features are extracted from the dataset and used to train the model.

E. ML Model:
An algorithm called XGBoost is used as the machine learning model. XGBoost is an ensemble algorithm which is based on decision-trees and uses gradient boosting framework. It was evolved from basic bagging algorithm. Normally prediction problems consisting of unstructured data neural networks tend to perform poorly when compared to other algorithms or frameworks. However, when it comes to smallto-medium, structured/tabular data, decision tree-based algorithms perform well.

F. Report:
The demand values for the next 2 weeks are predicted by the XGBoost model. The predicted demand values are real numbers. To get actual demand values, the values were rounded. The predicted values are output as a report to the shop owners aiding for an efficient inventory management.
V. IMPLEMENTATION The model utilized to perform the prediction is known as XGBoost (Extreme Gradient Boosting) regression model. XGBoost is an ensemble decision tree machine learning algorithm. When the data is small and structured, these decision tree-based algorithms outperform other algorithms. XGBoost algorithm was evolved from Bagging Algorithm. The evolution of the XGBoost can be better understood from the figure 2, which makes it highly suitable for implementing large amount of data.

A. XGBoost Working:
The XGBoost constructs the decision trees based on the error factor obtained from the previous tree. The technique followed is like that of a normal tree boosting except the way error calculated from the loss function is different. The XGBoost follows certain steps; 1. Model fitting to the data, 2. Model fitting to the residuals, 3. Generating new model (where the new model is boosted version of the old), 4. Repeating all the steps till error is improved.

B. Training the model:
After the model is implemented, training of the model is necessary to predict the demand with better accuracy. The train_test_split is a function for splitting data arrays into two subsets: for training data and for testing data. With this function, eliminates the task of splitting the dataset manually. By default, train_test_split will make random partitions for the two targets x and y. The model is trained using an approach known as early-stopping-rounds which helps to avoid overfitting. It works by halting the training when there is no increase in the performance on the test dataset up to the specified number of iterations (i.e. up to 100 in our case). It can automatically circumvent overfitting by considering the point of inflection where the performance starts to decrease on test data while for the training data goes on improving towards overfit.

VI. EXPERIMENTAL RESULTS
On each week the data was extrapolated of the previous week and the predicted demands was verified with the dataset. The table 2 depicts the RMSE values obtained for each week added. The increase in the RMSE values is due to the new week data appended to the previous and so on, making the training data large.