## 4 Variable Weight Input Based on Difference Degree  
The concept of the difference degree refers to the difference in size due to the characteristics (such as temperature and wind speed) of the two samples. The smaller the difference degree, the closer the characteristics of various factors between the two samples are. Short-term load forecasting generally needs to refer to historical data such as the load and its characteristic factors in the days before the forecast. The smaller the date difference between historical data and forecast day, the closer the fitting law of the characteristic factors and load is to the fitting law of the forecast day. Therefore, this paper treats historical data differently based on the difference between the date and the difference degree between the days [1].  
The idea of weighting input data based on the difference is as follows. First of all, calculate the difference degree between any two days; then, the weights of each day are calculated according to the difference degree and the difference degree is reflected by the size of the weight. Based on the time sequence, the historical data close to the forecast time have significant weight, while the historical data far away from the forecast time have small weight; finally, when fitting the polynomial coefficients, the weights calculated based on the difference degree are assigned to the historical data of the corresponding days for the next calculation.  
The Lance-Williams distance is used to calculate the difference degree. The Lance-Williams distance is one of the commonly used clustering algorithms, proposed by [PERSON] and [PERSON]. The distance in cluster analysis is used to measure the similarity and difference between samples, which is the key step of cluster analysis. Compared with the typical method Euclidean distance, the Lance-Williams distance is insensitive to singular values, which can suppress the influence of noise and handle highly skewed data. In addition, it is a dimensionless standardized value that can eliminate the influence of data due to dimensional differences, so the calculated value of the Lance-Williams distance is used to describe the difference degree [1; 43]. The value of the Lance-Williams distance is the value of the difference. The smaller the value, the smaller the difference between the two sample data, the greater the contribution of the sample data in the model training.  
Set \(m\) characteristic variables and \(t\) group sample data. The Lance-Williams distance is:  
\[d_{ij}=\sum_{t=1}^{m}\frac{\left|x_{it}-y_{it}\right|}{\left|x_{it}+y_{it} \right|}, \tag{11}\]  
where \(x_{ik},y_{jk}\geq 0\), \(i,j=1,2,3,\ldots,t\). And \(i\
eq j,i<j\). \(d_{ij}\) represents the Lance-Williams distance between the \(i\)th sample and the \(j\)th sample.  
Calculate the weight of each sample by the different \(d_{ij}\) according to the above formula. Let the weight of each sample be \(w_{i}^{*}(i=1,2,3,\ldots,t)\). Then:  
\[\left\{\begin{array}{l}\frac{w_{1}-w_{2}}{w_{1}+w_{2}}=d_{12}\\ \frac{w_{1}-w_{3}}{w_{1}+w_{3}}=d_{13}\\ \vdots\\ \frac{w_{1}-w_{t}}{w_{1}+w_{t}}=d_{1t}\\ \frac{w_{2}-w_{1}}{w_{2}+w_{1}}=d_{21}\\ \frac{w_{2}-w_{2}}{w_{2}+w_{2}}=d_{22}\\ \vdots\\ \frac{w_{t-1}-w_{t}}{w_{t-1}+w_{t}}=d_{t-1t}\end{array}\right., \tag{12}\]get \(\mathbf{W}=(w_{1},w_{2},w_{3},\ldots,w_{t})\). Thus, the weight \(w_{i}^{*}\) can be obtained:  
\[w_{i}^{*}=\frac{w_{i}}{\sum\limits_{i=1}^{t}w_{i}}, \tag{13}\]  
The weight \(w_{i}^{*}\) satisfies the following conditions:  
1. \(\sum\limits_{i=1}^{t}w_{i}^{*}=1\)
2. \(w_{1}^{*}\geq w_{2}^{*}\geq w_{3}^{*}\geq\ldots w_{t}^{*}\)
3. \(0<w_{i}^{*}\leq 1\)