## 3 Materials and Methods
Generally, the popular algorithms that can be used for binary classification include: logistic regression, k-nearest neighbors (KNN), decision trees, support vector machine (SVM), and naive Bayes. Logistic regression is easier to implement, interpret, and very efficient to train. Moreover, it can interpret model coefficients as indicators of feature importance. KNN is a non-parametric model, where logistic regression is a parametric model. Moreover, KNN is comparatively slower than logistic regression. In decision trees, you can have two or more decisions (for example, option 1, option 2, and option 3). However, in logistic regression, there are only two options (for example, come and not come). SVM works well with unstructured and semi-structured data such as text and images, while logistic regression works with already identified independent variables. However, in many cases, both of them can be used. Naive Bayes has a naive assumption that the algorithm expects the features to be independent which not always is the case. In the last step of forecasting (logistic regression), the \(glm\) function is used. The continuous results from zero to one are first obtained. Then, they are rounded to 0 or 1. For the optimal level of overall accuracy, normal rounding is used, where any value from 0.5 until 1 is 1, and the rest of the values are 0. However, to obtain results with a type I error that is less, larger thresholds can be used. For example, 0.55 can be used. The study is performed using the following steps:  
1. The demand during the last three months. This step shows the pattern of demand over the study period. Most of the demand is satisfied during six weeks. However, sometimes, some orders need more than two months to be satisfied. This is why it might be better to investigate the demand during the last three months. 2. The percentage of satisfied demand occurred in the last three months (PSDTM). The moving average can be used with \(n=3\). 3. The demand for the next week (DNW). It is given, and it is simply the waiting demand (the demand not satisfied so far). Such demand does not include the orders coming after the current delivery date. Any order that comes after the current delivery date will not be satisfied in the next delivery time, because of the long lead time. Therefore, DNW will be used to forecast if a certain order will come in the next week or not, in the final step. 4. The total number of orders delivered in the next delivery (expected satisfied demand in the next week) (SDNW). Moving average can represent a fast and practical solution since the changes in demand are relatively slow over time. However, simple linear regression can also be used. The independent variable is the DNW. It is multiplied by the estimated percentage of satisfied demand next delivery week (PSD), and this percentage is found using moving average or using the linear regression. This percentage is different from the one in step 2 for the last three months. Forecasting PSD, and then SDNW from it, was found to have better accuracy than forecasting SDNW directly. 5. The probability that a certain order will come in the next delivery week (PONW). This is performed using logistic regression, and it is the most important step in this research. Figure 1 shows the methodology of the study. The results of forecasting are that there are orders that are expected to come in the next week and others that are not coming in the next week. For those coming in the next week, the question is if there are orders already waiting in the warehouse for the same customer (come in the current week). If yes, then the question is if waiting for one more week is possible without exceeding the allowable lead time. If yes, then temporal aggregation is possible. It is clear that moving average, linear regression, and logistic regression are used in the previous steps. A moving average captures the average change in a data series over time. Linear regression is used to predict the continuous dependent variable using a given set of independent variables.