## 1 Introduction
Mathematically defined theft cases that mimic the attackers' practical intentions were first introduced by the authors in [10] to train their ML-based consumption pattern-based energy theft detector (CPBETD) algorithm. Several existing studies in the literature have followed the same style of theft dataset generation while using ML/AI-based techniques to detect theft. Therefore, currently, modelling synthetic theft cases is necessary if one were to test and evaluate his/her designed ML/AI techniques. For theft detection, we propose a novel algorithm called the dynamic electricity theft detector (DETD) by adding window-based theft cases (discussed below), where the ToU-based dataset of the Low Carbon London project [19] is used as an example to illustrate our concept. We will use gradient boosting-based classifiers, specifically focusing on extreme gradient boosting (XGBoost) [20] as the base of our theft detector algorithm--DETD; XGBoost has been discussed in more detail in Section 3. The primary reason of choosing XGBoost is that its superiority has been proved in traditional NTL theft detection of SG [14; 15] as well as in various data mining competitions of different domains [20]. However, we leave room for improvement in the DETD algorithm as a part of our future work by replacing gradient boosting techniques with other ML/AI techniques. In order to tackle the lack of ToU pricing scheme-based theft detection, this paper begins by discussing how to model realistically feasible synthetic theft cases in the SG, followed by proposing a novel algorithm to detect theft. To overcome the shortcomings of the existing schemes, the following are the novel characteristics of DETD, which constitute the contributions of the paper:  
* DETD introduces a novel generation of new theft cases based on the ToU pricing model, whereas the majority of existing studies in the literature rely mainly on fixed pricing theft models. Hence, in the DETD algorithm, we use ToU as an example external factor, such that training dataset generation is modified to accommodate the latest ToU pricing-based SG metering. Another unique aspect of DETD is the data preprocessing technique by concatenating the usage vector with a window feature vector (explained in Section 4.2). * Additionally, DETD handles imbalanced data by using the XGBoost [20] hyperparameter \"scale_pos_weight\" and thus, the overfitting issue in existing ML schemes that is usually caused due to using the Synthetic Minority Oversampling Technique (SMOTE) [21] is easily avoidable. Additionally, DETD reduces memory complexity due to lack of synthetic data generated by SMOTE. * In the paper, we train and test the DETD algorithm using XGBoost as the base ML scheme for different consumers, report average performance results (detection rate (DR) and false positive rate (FPR)), and evaluate the effect of the testing and training dataset ratio on the performance of the theft detector (Section 4.3). * In addition, windows based on other factors such as temperature, seasonal trends, and so on can be used to train and create parallel (or combined) theft detectors, which can contribute to a weighted average (weights being the relative numerical significance of a certain factor for theft) towards improved theft detection (whose report is seen in Section 4.5). * Finally, DETD can harness the use of other alternative tree boosting algorithms (Section 4.6). Broadly, this paper can be broken into two main blocks--first, the generation of smarter ToU-based synthetic theft cases and second, detection of the theft cases. The detailed organization of the paper is as follows. In Section 2, we examine the need for new theft cases by discussing the new smart grid pricing programs, explaining the dataset, and briefly introducing the motivation of window-based theft cases. We then explain in detail the generation of new synthetic theft cases on the basis of ToU pricing as a primary example along with a minor note regarding the required performance standards for a practical theft detector.