Method, device, computer equipment and storage medium for determining forecast base period
By comparing the package quantity and shape similarity between real-time time series and historical time series, determining the historical date of the target historical time series as the prediction base period, the problem of error and difficulty in base period selection in the prior art is solved, and the prediction accuracy is improved.
Patent Information
- Application Number
- CN202110250805.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-08
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2041-03-08
AI Technical Summary
It is difficult for the prior art to effectively select appropriate base periods for logistics package prediction, especially in a short period of time, traditional methods are prone to manual errors or difficult to measure differences.
By obtaining the real-time time series of the current date and the historical time series of multiple historical dates, comparing the parcel similarity and sequence shape similarity, determining the target historical time series that meets the preset similarity conditions, and determining its corresponding historical date as the prediction base period.
When selecting the predicted base period, it is realized that when considering the similarity of real-time data cross-sections, and taking into account the dynamic correlation of multiple time points in the timing, improving the accuracy of base period selection, avoiding the problem of artificial errors and the difficulty of finding a suitable base period in traditional methods.
Smart Images

Figure CN115049091B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer equipment and storage medium for determining a forecast base period. Background Art
[0002] With the growing development of the logistics industry, in order to achieve the rational allocation of logistics resources, such as the adjustment of the number of receiving and delivery personnel, the volume of packages in the future can be predicted. When making predictions, a suitable base period can be selected and a suitable model can be used for prediction.
[0003] In the existing technology, the base period can be selected manually or based on traditional similarity indicators such as Euclidean distance or correlation coefficient. However, the former is prone to human bias; at the same time, due to the characteristics of logistics and transportation business, the overall trends on different days are mostly similar, and the latter base period selection method is difficult to measure the difference. The existing methods are difficult to select a suitable base period for parcel volume forecasting in a short period of time. Summary of the invention
[0004] Based on this, it is necessary to provide a method, device, computer equipment and storage medium for determining a forecast base period in response to the above technical problems.
[0005] A method for determining a forecast base period, the method comprising:
[0006] Obtaining a real-time time series corresponding to the current date, and obtaining a historical time series corresponding to each of a plurality of historical dates; both the real-time time series and the historical time series are used to record the logistics package quantity and its time point;
[0007] The real-time time series is compared with the historical time series to obtain the package quantity similarity and sequence shape similarity; the package quantity similarity represents the similarity of the logistics package quantity at the corresponding time point between the real-time time series and the historical time series; the sequence shape similarity represents the similarity of the corresponding curve of the real-time time series and the corresponding curve of the historical time series;
[0008] According to the package quantity similarity and the sequence shape similarity, in the historical time series, determining a target historical time series that meets a preset similarity condition;
[0009] The historical date corresponding to the target historical time series is determined as the prediction base period; the prediction base period is used to predict the logistics package volume at a future point in time on the current date.
[0010] Optionally, the real-time time series and the historical time series both include sequence elements, and the sequence elements are used to record the logistics package quantity and time point. The real-time time series is compared with the historical time series to obtain the sequence shape similarity, including:
[0011] A matrix is constructed according to the number of sequence elements corresponding to the real-time time series and the historical time series; the matrix elements in the matrix represent the similarity between the real-time logistics package volume and the historical logistics package volume;
[0012] Obtaining the shortest path corresponding to the matrix; the shortest path is the shortest path connecting the lower left matrix element and the upper right matrix element in the matrix;
[0013] The path distance corresponding to the shortest path is obtained as the sequence shape similarity.
[0014] Optionally, the matrix is a grid matrix, the matrix elements are grid point coordinates, and obtaining the path distance corresponding to the shortest path as the sequence shape similarity includes:
[0015] Obtaining multiple matrix elements that the shortest path passes through;
[0016] According to the grid point coordinates corresponding to each of the plurality of matrix elements, the Mink distance corresponding to the shortest path is determined as the sequence shape similarity.
[0017] Optionally, comparing the real-time time series with the historical time series to obtain the package quantity similarity includes:
[0018] Obtaining the real-time logistics package volume corresponding to each time point in the real-time time series, and obtaining the historical logistics package volume at the corresponding time point in the historical time series;
[0019] According to multiple real-time logistics package quantities and historical logistics package quantities at corresponding time points, the Minn distance corresponding to the historical time series and the real-time time series is obtained as the package quantity similarity.
[0020] Optionally, determining a target historical time series satisfying a preset similarity condition in the historical time series according to the package quantity similarity and the sequence shape similarity includes:
[0021] According to the package quantity similarity and the sequence shape similarity, obtaining the sequence similarity between the historical time series and the real-time time series;
[0022] According to the sequence similarity, a target historical time series that meets a preset similarity condition is determined in the historical time series.
[0023] Optionally, obtaining the sequence similarity between the historical time series and the real-time time series according to the package quantity similarity and the sequence shape similarity includes:
[0024] Obtain the similarity weights corresponding to the package quantity similarity and the sequence shape similarity;
[0025] According to the similarity weight, the package quantity similarity and the sequence shape similarity are weighted and summed, and the sum result is determined as the sequence similarity between the historical time series and the real-time time series.
[0026] Optionally, obtaining the historical time series corresponding to each of the multiple historical dates includes:
[0027] Obtain the original time series corresponding to each of the multiple candidate dates, and remove the sequence elements within the specified period in each original time series to obtain the historical time series corresponding to each candidate date;
[0028] A plurality of historical dates matching the current date are screened out from the plurality of candidate dates, and historical time series corresponding to the plurality of historical dates are acquired.
[0029] Optionally, the obtaining of original time series corresponding to each of the plurality of candidate dates includes:
[0030] Acquire a first time period corresponding to the real-time time series, and use the time series corresponding to the first specified time period among multiple candidate dates as the original time series;
[0031] The step of removing sequence elements within a specified period of time from each original time series includes:
[0032] The second time period in which the fluctuation amount of the package exceeds the fluctuation threshold is obtained, and the sequence elements corresponding to the second time period in the original time series are removed.
[0033] Optionally, the filtering out a plurality of historical dates matching the current date from the plurality of candidate dates includes:
[0034] Obtaining real-time logistics business volume characteristics corresponding to the current date and historical logistics business volume characteristics corresponding to each historical date;
[0035] From multiple candidate dates, multiple historical dates whose historical logistics business volume characteristics match the real-time logistics business volume characteristics are screened out.
[0036] A prediction base period determination device, the device comprising:
[0037] A time series acquisition module is used to acquire a real-time time series corresponding to the current date, and to acquire a historical time series corresponding to each of a plurality of historical dates; both the real-time time series and the historical time series are used to record the logistics package quantity and its time point;
[0038] A similarity determination module is used to compare the real-time time series with the historical time series to obtain the package quantity similarity and sequence shape similarity; the package quantity similarity represents the similarity of the logistics package quantity at the corresponding time point between the real-time time series and the historical time series; the sequence shape similarity represents the similarity of the corresponding curve of the real-time time series and the corresponding curve of the historical time series;
[0039] A target historical time series determination module is used to determine a target historical time series that meets a preset similarity condition in the historical time series according to the package quantity similarity and the sequence shape similarity;
[0040] A prediction base period determination module is used to determine the historical date corresponding to the target historical time series as the prediction base period; the prediction base period is used to predict the logistics package volume at a future point in time on the current date.
[0041] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above methods when executing the computer program.
[0042] A computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above methods.
[0043] The above-mentioned method, device, computer equipment and storage medium for determining a prediction base period obtains the real-time time series corresponding to the current date and the historical time series corresponding to multiple historical dates, compares the real-time time series with the historical time series to obtain the package quantity similarity and the sequence shape similarity, and determines the target historical time series that meets the preset similarity conditions in the historical time series based on the package quantity similarity and the sequence shape similarity, determines the historical date corresponding to the target historical time series as the prediction base period, and realizes accurate selection of the prediction base period. When selecting the prediction base period, both the similarity of the real-time data cross-section and the dynamic correlation of multiple time points in the time series are considered, effectively improving the accuracy of the base period selection, and avoiding the errors caused by manual selection of the base period or the problem of difficulty in finding a suitable base period using traditional distance metrics. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A schematic diagram of a flow chart of a method for determining a prediction base period in one embodiment;
[0045] Figure 2 A schematic diagram of a flow chart of a sequence shape similarity determination step in one embodiment;
[0046] Figure 3a is a schematic diagram of an original time series in one embodiment;
[0047] Figure 3b is a schematic diagram of a regularized cost matrix in one embodiment;
[0048] Figure 3c is a schematic diagram of a regularized time series in one embodiment;
[0049] Figure 4 A schematic diagram of a flow chart of a method for predicting real-time logistics package volume in one embodiment;
[0050] Figure 5 A schematic diagram of a time series comparison in one embodiment;
[0051] Figure 6 It is a structural block diagram of a prediction base period determination device in one embodiment;
[0052] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0054] In one embodiment, Figure 1 As shown, a method for determining a forecast base period is provided. This embodiment uses the method applied to a server as an example. It can be understood that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Among them, the server can be implemented as an independent server or a server cluster composed of multiple servers; the terminal can be installed in each logistics outlet or carried by logistics business personnel, and the terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices.
[0055] In this embodiment, the method may include the following steps:
[0056] Step 101, obtaining a real-time time series corresponding to the current date, and obtaining a historical time series corresponding to each of a plurality of historical dates.
[0057] As an example, both the real-time time series and the historical time series are used to record the logistics package volume and its time points. The real-time time series can be a time series that records the logistics package volume and time points on the current date, and the historical time series can be a time series that records the logistics package volume and time points on past historical dates.
[0058] The logistics package volume can be the package volume corresponding to the business node during the package flow process. The business node can include any one or more of the following: collection node, delivery node, packaging node, handling node, transit or distribution node.
[0059] In actual applications, the server can obtain real-time time information and multiple historical time series.
[0060] Specifically, the logistics outlets can count the logistics parcel volume within a preset time through the terminals of the outlets, or the logistics business personnel can also record the processed logistics parcels through the terminals during the operation. For example, in the process of receiving and delivering logistics parcels, the logistics business personnel scan the identification code (such as QR code or barcode) on the logistics parcel through a handheld terminal device. The server can then obtain the real-time time series based on the data collected from each terminal. Alternatively, the logistics business system can also generate a real-time time series based on the data collected from the terminal, and the server can receive the real-time time series sent by the logistics business system.
[0061] Step 102, compare the real-time time series with the historical time series to obtain package quantity similarity and sequence shape similarity.
[0062] As an example, the package volume similarity can represent the similarity of the logistics package volume at the corresponding time point of the real-time time series and the historical time series. Through the package volume similarity, the numerical gap between the real-time time series and the historical time series can be measured, such as the similarity of cross-sectional data. The sequence shape similarity can represent the similarity of the corresponding curve of the real-time time series and the corresponding curve of the historical time series.
[0063] In a specific implementation, a time series may refer to a series of values of the same statistical indicator arranged in the order of their occurrence. In this embodiment, the real-time time series and the historical time series may record the logistics package volume corresponding to multiple time points, and the time interval between any two adjacent time points may be the same. Based on the real-time time series and the historical time series, the corresponding relationship between each time point and the logistics package volume can be obtained.
[0064] After obtaining the real-time time series and multiple historical time series, the real-time time series can be compared with the historical time series for each historical time series. The comparison can include numerical comparison and shape comparison of the corresponding curves of the time series, so as to obtain the corresponding package quantity similarity and sequence shape similarity.
[0065] Step 103, determining a target historical time series that meets a preset similarity condition in the historical time series according to the package quantity similarity and the sequence shape similarity.
[0066] Specifically, a similarity condition may be preset, such as a preset number of historical time series with the highest similarity ranking, or historical time series with similarities satisfying a preset threshold.
[0067] After obtaining the package quantity similarity and shape similarity, the target historical time series that meets the preset similarity conditions can be determined from multiple historical time series based on the package quantity similarity and sequence shape similarity between each historical time series and the real-time time series.
[0068] Step 104: determine the historical date corresponding to the target historical time series as the prediction base period.
[0069] As an example, the prediction base period can be a period used for data prediction. In this embodiment, the prediction base period can be used to predict the logistics package volume at future points in the current date, that is, the logistics package volume at one or more points in time that have not been reached in the current date can be predicted based on the logistics package volume corresponding to multiple points in time in the prediction base period.
[0070] In practical applications, after determining the target historical time series, since the numerical values and curves corresponding to the target historical time series are highly similar to the real-time time series corresponding to the current date, the historical date corresponding to the target historical time series can be determined as the prediction base period.
[0071] In this embodiment, by obtaining the real-time time series corresponding to the current date and the historical time series corresponding to multiple historical dates, the real-time time series is compared with the historical time series to obtain the package quantity similarity and the sequence shape similarity. According to the package quantity similarity and the sequence shape similarity, in the historical time series, the target historical time series that meets the preset similarity condition is determined, and the historical date corresponding to the target historical time series is determined as the prediction base period, so as to achieve accurate selection of the prediction base period. When selecting the prediction base period, both the similarity of the real-time data cross-section and the dynamic correlation of multiple time points in the time series are considered, so as to effectively improve the accuracy of the base period selection and avoid the error caused by manual selection of the base period or the problem of difficulty in finding a suitable base period using traditional distance measurement.
[0072] In one embodiment, both the real-time time series and the historical time series include sequence elements, which are used to record the logistics package volume and the time points corresponding to the logistics package volume, such as Figure 2 As shown, the comparing the real-time time series with the historical time series to obtain the sequence shape similarity may include the following steps:
[0073] Step 201 : construct a matrix according to the number of sequence elements corresponding to the real-time time series and the historical time series.
[0074] Among them, the matrix elements in the matrix can represent the similarity between the real-time logistics package volume and the historical logistics package volume.
[0075] In practical applications, there are differences between time series data and cross-sectional data, which can be specifically reflected in the dynamic association between different time series data in the time direction, that is, the shapes of the two time series are similar. This dynamic association can exist in the time position offset or the size scaling of the time series. For the base period selection of short time series, although traditional similarity measurement methods can be used for selection, such as Euclidean distance, correlation coefficient, etc., the performance is generally poor. Taking the correlation coefficient as an example, due to the similarity of the overall trends of different days, the correlation coefficients of multiple historical time series to be selected and the real-time time series all exceed the preset threshold, making it difficult to measure the differences between different time series.
[0076] Based on this, the dynamic time warping (DTW) algorithm can be used to measure the sequence shape similarity of two time series.
[0077] In this embodiment, after obtaining the real-time time series and the historical time series, a matrix can be constructed according to the number of sequence elements corresponding to the real-time time series and the number of sequence elements corresponding to the historical time series. The matrix can also be called a regularized cost matrix.
[0078] Specifically, real-time time series may include a 1 、a 2 、a 3 ……a m There are m sequence elements in total. The historical time series can include b 1 、b 2 、b 3 ……b n There are n sequence elements in total, m can be the same as or different from n. Each sequence element is used to record the logistics package volume at the corresponding time point. The m sequence elements corresponding to the real-time time series respectively record the real-time logistics package volume corresponding to the m time points, and the n sequence elements corresponding to the historical time series respectively record the historical logistics package volume corresponding to the n time points.
[0079] After obtaining the real-time time series and the historical time series, an m*n matrix can be constructed according to the sequence elements contained in each of them, wherein each matrix element in the matrix can be associated with a similarity, and each matrix element can correspond to a real-time logistics package volume and a historical logistics package volume. For example, the matrix element (1,1) corresponds to the first sequence element a in the real-time time series. 1 and the first sequence element b in the historical time series 1 , the matrix element (m,n) corresponds to the mth sequence element a in the real-time time series m and the nth sequence element b in the historical time series n ; The matrix element (1,1) can represent the sequence element a 1 and sequence element b 1 The similarity between them, the matrix element (m,n) can represent the sequence element a m and sequence element b n The similarity between .
[0080] Step 202: Obtain the shortest path corresponding to the matrix.
[0081] As an example, the shortest path is the shortest path connecting the lower left matrix element and the upper right matrix element in the matrix. The shortest path can also be called the path with the smallest regularization cost.
[0082] After constructing the matrix, the shortest path corresponding to the matrix can be obtained. Specifically, the shortest path can be determined by adjusting the moving route in the matrix with the matrix element at the lower left corner of the matrix as the starting point and the matrix element at the upper right corner of the matrix as the end point. In this embodiment, the shortest path corresponding to the matrix can be determined by the DTW algorithm.
[0083] For example, according to Figure 3a The two time series shown in Figure 3b The matrix shown in the figure starts from the origin (0,0) and moves from the lower left matrix element to the upper right matrix element according to the DTW algorithm. Figure 3b The shortest path in .
[0084] Step 203: Obtain the path distance corresponding to the shortest path as the sequence shape similarity.
[0085] After determining the shortest path, the path distance corresponding to the shortest path can be obtained, and the path distance is used as the shape similarity between the real-time time series and the historical time series.
[0086] In this embodiment, by constructing a matrix according to the number of sequence elements corresponding to the real-time time series and the historical time series, the shortest path corresponding to the matrix is obtained, and the path distance corresponding to the shortest path is obtained as the sequence shape similarity. This can measure the shape similarity between the real-time time series and the historical time series, and provide a basis for obtaining historical time series with dynamic correlations and improving the accuracy of the prediction base period.
[0087] In one embodiment, the matrix may be a grid matrix, the matrix elements may be grid point coordinates, and obtaining the path distance corresponding to the shortest path as the sequence shape similarity may include the following steps:
[0088] A plurality of matrix elements through which the shortest path passes are obtained; and a Minkowski distance corresponding to the shortest path is determined according to the grid point coordinates corresponding to each of the plurality of matrix elements as the sequence shape similarity.
[0089] In a specific implementation, multiple matrix elements passed through in the shortest path can be obtained, and the grid point coordinates (x, y) corresponding to each matrix element can be obtained, and then the Minkowski distance of the shortest path can be determined according to the grid point coordinates corresponding to the matrix elements, and the Minkowski distance can be determined as the sequence shape similarity. Specifically, the Minkowski distance can be obtained using the following formula:
[0090]
[0091] Where n is the total number of matrix elements in the shortest path, x i is the horizontal coordinate corresponding to the coordinate of the ith grid point, y i is the horizontal coordinate corresponding to the coordinate of the ith grid point, when p=1, it is the Manhattan distance, when p=2, it is the Euclidean distance, in this embodiment, p=1 can be used. It should be noted that when determining the package quantity similarity and the sequence shape similarity, the p value can be adjusted according to actual needs when the same p value is used.
[0092] For example, Figure 3b For example, the shortest path in the example, the grid coordinates of the multiple matrix elements that the shortest path passes through are (0,0), (1,1), (2,2), (3,3), (4,3), (5,4), (5,5), (6,6), and the path distance can be obtained by determining the Minkowski distance corresponding to each grid point coordinate and summing them up. Figure 3a By regularizing the time series in, we can get Figure 3c The regularized results are shown.
[0093] In this embodiment, by obtaining multiple matrix elements that the shortest path passes through and determining the Minn distance corresponding to the shortest path according to the grid point coordinates corresponding to each of the multiple matrix elements, as the sequence shape similarity, the shape similarity of the time series can be accurately measured, providing a data basis for obtaining a suitable and accurate prediction base period.
[0094] In one embodiment, comparing the real-time time series with the historical time series to obtain the package quantity similarity may include the following steps:
[0095] The real-time logistics package volume corresponding to each time point in the real-time time series is obtained, and the historical logistics package volume at the corresponding time point in the historical time series is obtained; based on multiple real-time logistics package volumes and the historical logistics package volumes at corresponding time points, the Minn distance corresponding to the historical time series and the real-time time series is obtained as the package volume similarity.
[0096] In actual applications, after obtaining the real-time time series, the real-time logistics package quantity corresponding to each time point in the real-time time series can be obtained, and multiple time points corresponding to the real-time time series time points can be determined in the historical time series, and the corresponding historical logistics package quantity can be obtained. For example, if the real-time time series records the real-time logistics package quantity corresponding to 10 points, the historical logistics package quantity corresponding to 10 points can be obtained in the historical time series.
[0097] After determining the real-time logistics package volume and historical logistics package volume corresponding to multiple time points, the Minkowski distance between the historical time series and the real-time time series can be determined based on the real-time logistics package volume and the historical logistics package volume, and the Minkowski distance can be determined as the package volume similarity. Specifically, the Minkowski distance can be obtained using the following formula:
[0098]
[0099] Among them, n is the total number corresponding to the time point, x i is the real-time logistics package volume corresponding to the i-th time point, y i is the historical logistics package volume corresponding to the i-th time point, when p=1, it is the Manhattan distance, when p=2, it is the Euclidean distance. In this embodiment, p=1 can be used.
[0100] In this embodiment, the Minkowski distance can be used to measure the similarity between the real-time time series and the cross-sectional data of the historical time series, and the historical time series with high similarity in the logistics package volume at each point in time can be screened out to avoid excessive data differences between the historical time series and the real-time time series, thereby providing a data basis for obtaining an accurate and effective prediction base period.
[0101] In one embodiment, determining a target historical time series that meets a preset similarity condition in the historical time series according to the package quantity similarity and the sequence shape similarity includes:
[0102] According to the package quantity similarity and the sequence shape similarity, the sequence similarity between the historical time series and the real-time time series is obtained; according to the sequence similarity, in the historical time series, a target historical time series that meets a preset similarity condition is determined.
[0103] In the specific implementation, the sequence similarity between the historical time series and the real-time time series can be determined based on the package quantity similarity and the sequence shape similarity. The sequence similarity can be used to simultaneously evaluate the similarity between the historical time series and the real-time time series in cross-sectional data and time series shape (or trend).
[0104] After obtaining multiple sequence similarities, a target historical time series whose sequence similarity meets a preset similarity condition may be determined from among the multiple historical time series. For example, the historical time series with the highest sequence similarity may be determined as the target historical time series.
[0105] In this embodiment, by obtaining sequence similarity and determining the target historical time series in the historical time series based on the sequence similarity, the historical time series can be selected in combination with the package quantity similarity and the sequence shape similarity. While evaluating the similarity of the real-time data sections, the dynamic correlation between the time series is considered to provide a data basis for obtaining an accurate and effective prediction base period.
[0106] In one embodiment, obtaining the sequence similarity between the historical time series and the real-time time series according to the package quantity similarity and the sequence shape similarity includes:
[0107] The similarity weights corresponding to the package quantity similarity and the sequence shape similarity are obtained; according to the similarity weights, the package quantity similarity and the sequence shape similarity are weighted summed, and the sum result is determined as the sequence similarity between the historical time series and the real-time time series.
[0108] In practical applications, corresponding similarity weights can be set for package quantity similarity and sequence shape similarity respectively. After determining the package quantity similarity and sequence shape similarity, the corresponding similarity weights can be obtained, and according to the similarity weights, the package quantity similarity and the sequence shape similarity are weighted and summed. The sum result can be determined as the sequence similarity between the historical time series and the real-time time series.
[0109] For example, the sequence similarity can be determined according to the following formula:
[0110] d=λd1 +(1-λ)d 2
[0111] Among them, λ is the sequence shape similarity d 1 The corresponding similarity weight, 1-λ is the package volume similarity d 2 Corresponding similarity weights, those skilled in the art can adjust the size of λ according to actual needs. In one example, 1 is the distance determined based on the DTW algorithm, d 2 is the Minkowski distance, d can be called the combined distance, and the combined distance is inversely proportional to the sequence similarity, that is, the smaller the combined distance, the higher the sequence similarity. Therefore, when determining the target historical time series, the sequence similarities can be arranged in ascending order, and the historical time series with the highest sequence similarity can be determined as the target historical time series with the highest sequence similarity.
[0112] In this embodiment, by weightedly summing the package quantity similarity and the sequence shape similarity according to the similarity weight, the sum result is determined as the sequence similarity between the historical time series and the real-time time series, which can provide a data basis for the subsequent determination of the target historical time series.
[0113] In one embodiment, obtaining the historical time series corresponding to each of the multiple historical dates includes:
[0114] The original time series corresponding to each of the multiple candidate dates are obtained, and the sequence elements within the specified time period in each original time series are eliminated to obtain the historical time series corresponding to each candidate date; multiple historical dates matching the current date are screened out from the multiple candidate dates, and the historical time series corresponding to the multiple historical dates are obtained.
[0115] As an example, the candidate date may be a date before the current date. For example, if the current date is October 1, 2019, the candidate date may be a date on or before September 30, 2019.
[0116] In a specific implementation, the original time series corresponding to multiple candidate dates may be obtained. The original time series may record the logistics package volume corresponding to each time point in the candidate date. For example, the logistics package volume corresponding to 24 time points may be recorded in units of hours.
[0117] After obtaining the original time series, the sequence elements within the specified period in the original time series can be eliminated to obtain the historical time series corresponding to each candidate date, and then multiple historical dates matching the current date can be screened out from multiple candidate dates, and the historical time series corresponding to the multiple historical dates can be obtained. In one example, the screening can be performed based on the characteristics of the logistics business volume.
[0118] In this embodiment, the data of a specified period in the original time series can be removed to avoid interference of the fluctuating data in the time series on the selection of the prediction base period, thereby effectively improving the accuracy of the selection of the prediction base period.
[0119] In one embodiment, obtaining the original time series corresponding to each of the plurality of candidate dates may include:
[0120] A first time period corresponding to the real-time time series is obtained, and a time series corresponding to the first specified time period among a plurality of candidate dates is used as an original time series.
[0121] In a specific implementation, the real-time time series can be a real-time time series generated based on the real-time logistics package volume corresponding to each time point in the first period starting from the specified time point of the current date and ending at the current time point. After obtaining the real-time time series, the first time period corresponding to the real-time time series can be determined, and the time series corresponding to the first time period among multiple candidate dates can be determined as the original time series.
[0122] The step of removing the sequence elements within the specified time period in each original time series may include the following steps:
[0123] The second time period in which the fluctuation amount of the package exceeds the fluctuation threshold is obtained, and the sequence elements corresponding to the second time period in the original time series are removed.
[0124] Since there is a period in the preset time when the logistics package volume fluctuation exceeds the preset threshold, after obtaining the original time series, the second period in which the package fluctuation exceeds the fluctuation threshold can be obtained. The second period can be a pre-specified period, for example, the logistics package volume data between midnight and nine in the morning fluctuates greatly, and the package fluctuation corresponding to this period exceeds the preset fluctuation threshold. Then, the sequence elements in the original time series that are included in the second period can be removed.
[0125] In this embodiment, by obtaining the first time period corresponding to the real-time time series as the original time series and removing the sequence elements corresponding to the second time period in the original time series, it can be ensured that the time periods corresponding to the historical time series and the real-time time series are the same, thereby improving data comparability. At the same time, by removing the sequence elements corresponding to the second time period, it is possible to reduce the interference caused by the fluctuating data and improve the accuracy of selecting the target historical time series.
[0126] In one embodiment, the step of selecting a plurality of historical dates that match the current date from the plurality of candidate dates includes:
[0127] Acquire the real-time logistics business volume characteristics corresponding to the current date and the historical logistics business volume characteristics corresponding to each historical date; and select from multiple candidate dates multiple historical dates whose historical logistics business volume characteristics match the real-time logistics business volume characteristics.
[0128] As an example, the logistics business volume feature may be a feature that reflects the amount of logistics packages processed per unit time, such as the amount of logistics packages processed in a day. The logistics business volume feature may be divided into the following types according to the amount of logistics packages: high, medium, and low.
[0129] In practical applications, different dates may correspond to different logistics business volume characteristics. During the promotion period of e-commerce, the collection and delivery of logistics packages is at a peak, and the corresponding logistics business volume characteristics may be high, such as e-commerce shopping festivals such as the 99 Shopping Festival and the 618 Shopping Festival. During holidays, such as national statutory holidays (such as National Day, Dragon Boat Festival, Mid-Autumn Festival, etc.), the collection and delivery of logistics packages is at a low point, and the logistics business volume characteristics may be low.
[0130] After determining the current date, the real-time logistics business characteristics corresponding to the current date and the historical logistics business volume characteristics corresponding to each historical date can be determined, and then from multiple candidate dates, multiple historical dates whose historical logistics business volume characteristics match the real-time logistics business volume characteristics can be screened out. Specifically, the candidate dates whose historical logistics business volume characteristics are the same as the real-time logistics business volume characteristics can be determined as historical dates.
[0131] For example, for the 99 Shopping Festival, the dates corresponding to the 618 Shopping Festival and past 99 Shopping Festivals can be determined as historical dates; for the National Day, the dates corresponding to the Dragon Boat Festival, Mid-Autumn Festival and past National Days can be determined as historical dates; for the daily period with medium logistics business volume characteristics, the date of the most recent preset time can be determined as the historical date.
[0132] In this embodiment, by screening out multiple historical dates whose historical logistics business volume characteristics match the real-time logistics business volume characteristics from multiple candidate dates, time series comparison can be performed based on dates with similar or identical logistics business volumes to improve the efficiency and accuracy of obtaining the prediction base period.
[0133] In one embodiment, the method may further include the following steps:
[0134] Obtain a complete time series corresponding to the prediction base period; input the complete time series and the real-time time series into a real-time prediction model, and determine the logistics package volume corresponding to a future point in time on the current date based on the prediction result output by the real-time prediction model.
[0135] As an example, the complete time series may include the logistics package volume corresponding to all time points in the forecast base period except when the package fluctuation volume exceeds the fluctuation threshold.
[0136] In this embodiment, after determining the prediction base period, the complete time series and real-time time series corresponding to the prediction base period can be input into the real-time prediction model. The real-time prediction model can predict the logistics package volume corresponding to future time points on the current date based on the logistics package volume corresponding to each time point in the complete time series and the total logistics package volume of the current prediction base period.
[0137] In this embodiment, the complete time series and the real-time time series can be input into the real-time prediction model, and the logistics package volume corresponding to the future time point on the current date can be determined based on the prediction results output by the real-time prediction model. The logistics package volume can be predicted based on an accurate and appropriate base period, effectively improving the accuracy of real-time predictions in daily predictions and efficiently guiding the temporary allocation of resources.
[0138] In order to enable those skilled in the art to better understand the above steps, the embodiment of the present application is illustrated below by using an example, but it should be understood that the embodiment of the present application is not limited to this.
[0139] like Figure 4 As shown, historical real-time data corresponding to multiple historical dates (corresponding to the historical time series in this application) and daily real-time data corresponding to the current day (corresponding to the real-time time series in this application) can be obtained. The historical real-time data and the daily real-time data include the logistics package volume from the specified time point to the current time point.
[0140] After obtaining the historical real-time data and the real-time data of the day, data screening can be performed. Specifically, the data from 0:00 to 9:00 every day in the historical real-time data and the real-time data of the day can be eliminated, and multiple historical dates with the same logistics business volume characteristics as the day can be used to determine the candidate set of historical dates.
[0141] After data screening, the Minkowski distance and DTW distance between the current day's real-time data and each historical real-time data in the historical date candidate set can be calculated, and the combined similarity can be obtained based on the Minkowski distance and DTW distance, and the date corresponding to the historical real-time data with the highest combined similarity can be determined as the prediction base period. Then, the data of the entire day of the prediction base period and the current day's real-time data can be input into the real-time prediction model, and the corresponding logistics package volume at the future point in time (T+0) of the current day can be determined based on the output results of the model.
[0142] like Figure 5As shown, it includes sequence 1 corresponding to the base period determined by this embodiment, sequence 2 corresponding to the base period determined by the similarity measurement method, and sequence 3 corresponding to the current date. For sequence 1 and sequence 2, their distances from sequence 3 under different similarity measurement methods are shown in the following table:
[0143] Similarity measurement method Sequence 1 Sequence 2 Euclidean distance 367 347 DTW distance 776 870 Combined similarity (λ = 0.5) 572 609
[0144] according to Figure 5 It can be seen that when the similarity of sequence 1, sequence 2 and sequence 3 is determined by Euclidean distance, although the logistics package volume of sequence 2 is closest to that of sequence 3, the shapes of the two are quite different. Sequence 1, which is selected by the combined similarity after combining the DTW distance, has a higher similarity with the real-time sequence corresponding to the current date in sequence shape and logistics package volume.
[0145] It should be understood that although Figure 1-5 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-5 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0146] In one embodiment, Figure 6 As shown, a prediction base period determination device is provided, and the device may include:
[0147] The time series acquisition module 601 is used to acquire the real-time time series corresponding to the current date, and to acquire the historical time series corresponding to each of multiple historical dates; the real-time time series and the historical time series are both used to record the logistics package quantity and its time point;
[0148] The similarity determination module 602 is used to compare the real-time time series with the historical time series to obtain the package quantity similarity and the sequence shape similarity; the package quantity similarity represents the similarity of the logistics package quantity at the corresponding time point between the real-time time series and the historical time series; the sequence shape similarity represents the similarity of the corresponding curve of the real-time time series and the corresponding curve of the historical time series;
[0149] A target historical time series determination module 603 is used to determine a target historical time series that meets a preset similarity condition in the historical time series according to the package quantity similarity and the sequence shape similarity;
[0150] The prediction base period determination module 604 is used to determine the historical date corresponding to the target historical time series as the prediction base period; the prediction base period is used to predict the logistics package volume at a future point in time on the current date.
[0151] In one embodiment, the real-time time series and the historical time series both include sequence elements, and the sequence elements are used to record the logistics package quantity and time point. The similarity determination module 602 includes:
[0152] A matrix construction submodule, used to construct a matrix according to the number of sequence elements corresponding to the real-time time series and the historical time series; the matrix elements in the matrix represent the similarity between the real-time logistics package volume and the historical logistics package volume;
[0153] A shortest path acquisition submodule, used to acquire the shortest path corresponding to the matrix; the shortest path is the shortest path connecting the lower left matrix element and the upper right matrix element in the matrix;
[0154] The sequence shape similarity determination submodule is used to obtain the path distance corresponding to the shortest path as the sequence shape similarity.
[0155] In one embodiment, the matrix is a grid matrix, the matrix elements are grid point coordinates, and the sequence shape similarity determination submodule includes:
[0156] A matrix element acquisition unit, used to acquire a plurality of matrix elements through which the shortest path passes;
[0157] The Minn distance determination unit is used to determine the Minn distance corresponding to the shortest path according to the grid point coordinates corresponding to each of the plurality of matrix elements as the sequence shape similarity.
[0158] In one embodiment, the similarity determination module 602 includes:
[0159] The logistics package quantity determination submodule is used to obtain the real-time logistics package quantity corresponding to each time point in the real-time time series, and to obtain the historical logistics package quantity at the corresponding time point in the historical time series;
[0160] The package quantity similarity determination submodule is used to obtain the Minn distance corresponding to the historical time series and the real-time time series according to multiple real-time logistics package quantities and historical logistics package quantities at corresponding time points as the package quantity similarity.
[0161] In one embodiment, the target historical time series determination module 603 includes:
[0162] A sequence similarity determination submodule, used for obtaining the sequence similarity between the historical time series and the real-time time series according to the package quantity similarity and the sequence shape similarity;
[0163] The target historical time series screening submodule is used to determine, in the historical time series, a target historical time series that meets a preset similarity condition based on the sequence similarity.
[0164] In one embodiment, the sequence similarity determination submodule includes:
[0165] A weight acquisition unit, used to acquire the similarity weights corresponding to the package quantity similarity and the sequence shape similarity respectively;
[0166] The weighted summing unit is used to weightedly sum the package quantity similarity and the sequence shape similarity according to the similarity weight, and determine the summation result as the sequence similarity between the historical time series and the real-time time series.
[0167] In one embodiment, the time series acquisition module 601 includes:
[0168] The original time series acquisition submodule is used to obtain the original time series corresponding to multiple candidate dates, and remove the sequence elements within the specified period in each original time series to obtain the historical time series corresponding to each candidate date;
[0169] The candidate date matching submodule is used to filter out multiple historical dates matching the current date from the multiple candidate dates, and obtain historical time series corresponding to the multiple historical dates.
[0170] In one embodiment, the original time series acquisition submodule includes:
[0171] A first time period determination unit is used to obtain a first time period corresponding to the real-time time series, and use the time series corresponding to the first specified time period among multiple candidate dates as the original time series;
[0172] The original time series acquisition submodule further includes:
[0173] The sequence element elimination submodule is used to obtain the second time period in which the package fluctuation amount exceeds the fluctuation threshold, and eliminate the sequence elements corresponding to the second time period in the original time series.
[0174] In one embodiment, the candidate date matching submodule includes:
[0175] A business volume feature acquisition unit, used to acquire the real-time logistics business volume features corresponding to the current date and the historical logistics business volume features corresponding to each historical date;
[0176] The screening unit is used to screen out multiple historical dates whose historical logistics business volume characteristics match the real-time logistics business volume characteristics from multiple candidate dates.
[0177] For the specific definition of the prediction base period determination device, please refer to the definition of the prediction base period determination method in the above text, which will not be repeated here. Each module in the above prediction base period determination device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0178] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store time series. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for determining a forecast base period is implemented.
[0179] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0180] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0181] Obtaining a real-time time series corresponding to the current date, and obtaining a historical time series corresponding to each of a plurality of historical dates; both the real-time time series and the historical time series are used to record the logistics package quantity and its time point;
[0182] The real-time time series is compared with the historical time series to obtain the package quantity similarity and sequence shape similarity; the package quantity similarity represents the similarity of the logistics package quantity at the corresponding time point between the real-time time series and the historical time series; the sequence shape similarity represents the similarity of the corresponding curve of the real-time time series and the corresponding curve of the historical time series;
[0183] According to the package quantity similarity and the sequence shape similarity, in the historical time series, determining a target historical time series that meets a preset similarity condition;
[0184] The historical date corresponding to the target historical time series is determined as the prediction base period; the prediction base period is used to predict the logistics package volume at a future point in time on the current date.
[0185] In one embodiment, when the processor executes the computer program, the steps in the other embodiments described above are also implemented.
[0186] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0187] Obtaining a real-time time series corresponding to the current date, and obtaining a historical time series corresponding to each of a plurality of historical dates; both the real-time time series and the historical time series are used to record the logistics package quantity and its time point;
[0188] The real-time time series is compared with the historical time series to obtain the package quantity similarity and sequence shape similarity; the package quantity similarity represents the similarity of the logistics package quantity at the corresponding time point between the real-time time series and the historical time series; the sequence shape similarity represents the similarity of the corresponding curve of the real-time time series and the corresponding curve of the historical time series;
[0189] According to the package quantity similarity and the sequence shape similarity, in the historical time series, determining a target historical time series that meets a preset similarity condition;
[0190] The historical date corresponding to the target historical time series is determined as the prediction base period; the prediction base period is used to predict the logistics package volume at a future point in time on the current date.
[0191] In one embodiment, when the computer program is executed by a processor, the steps in the other embodiments described above are also implemented.
[0192] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0193] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0194] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for determining a forecast base period, It is characterized in that The method comprises: Obtaining a real-time time series corresponding to the current date, and obtaining a historical time series corresponding to each of a plurality of historical dates; both the real-time time series and the historical time series are used to record the logistics package quantity and its time point; The real-time time series is compared with the historical time series to obtain the package quantity similarity and sequence shape similarity; the package quantity similarity represents the similarity of the logistics package quantity at the corresponding time point between the real-time time series and the historical time series; the sequence shape similarity represents the similarity of the corresponding curve of the real-time time series and the corresponding curve of the historical time series; Obtain the similarity weights corresponding to the package quantity similarity and the sequence shape similarity; According to the similarity weight, weighted summing the package quantity similarity and the sequence shape similarity is performed, and the summing result is determined as the sequence similarity between the historical time series and the real-time time series; According to the sequence similarity, determining a target historical time series that meets a preset similarity condition in the historical time series; The historical date corresponding to the target historical time series is determined as the prediction base period; the prediction base period is used to predict the logistics package volume at a future point in time on the current date.
2. The method according to claim 1, It is characterized in that The real-time time series and the historical time series both include sequence elements, and the sequence elements are used to record the logistics package quantity and time point. The real-time time series is compared with the historical time series to obtain the sequence shape similarity, including: A matrix is constructed according to the number of sequence elements corresponding to the real-time time series and the historical time series; the matrix elements in the matrix represent the similarity between the real-time logistics package volume and the historical logistics package volume; Obtaining the shortest path corresponding to the matrix; the shortest path is the shortest path connecting the lower left matrix element and the upper right matrix element in the matrix; The path distance corresponding to the shortest path is obtained as the sequence shape similarity.
3. The method according to claim 2, It is characterized in that The matrix is a grid matrix, the matrix elements are grid point coordinates, and the path distance corresponding to the shortest path is obtained as the sequence shape similarity, including: Obtaining multiple matrix elements that the shortest path passes through; According to the grid point coordinates corresponding to each of the plurality of matrix elements, the Mink distance corresponding to the shortest path is determined as the sequence shape similarity.
4. The method according to claim 1, It is characterized in that The comparing the real-time time series with the historical time series to obtain the package quantity similarity includes: Obtaining the real-time logistics package volume corresponding to each time point in the real-time time series, and obtaining the historical logistics package volume at the corresponding time point in the historical time series; According to multiple real-time logistics package quantities and historical logistics package quantities at corresponding time points, the Minn distance corresponding to the historical time series and the real-time time series is obtained as the package quantity similarity.
5. The method according to claim 1, It is characterized in that The obtaining of the historical time series corresponding to the multiple historical dates includes: Obtain the original time series corresponding to each of the multiple candidate dates, and remove the sequence elements within the specified period in each original time series to obtain the historical time series corresponding to each candidate date; A plurality of historical dates matching the current date are screened out from the plurality of candidate dates, and historical time series corresponding to the plurality of historical dates are acquired.
6. The method according to claim 5, It is characterized in that The obtaining of the original time series corresponding to the plurality of candidate dates includes: Acquire a first time period corresponding to the real-time time series, and use the time series corresponding to the first time period among multiple candidate dates as the original time series; The step of removing sequence elements within a specified period of time from each original time series includes: The second time period in which the fluctuation amount of the package exceeds the fluctuation threshold is obtained, and the sequence elements corresponding to the second time period in the original time series are removed.
7. The method according to claim 5, It is characterized in that The step of selecting a plurality of historical dates matching the current date from the plurality of candidate dates includes: Obtaining real-time logistics business volume characteristics corresponding to the current date and historical logistics business volume characteristics corresponding to each historical date; From multiple candidate dates, multiple historical dates whose historical logistics business volume characteristics match the real-time logistics business volume characteristics are screened out.
8. A prediction base period determination device, It is characterized in that The device comprises: A time series acquisition module is used to acquire a real-time time series corresponding to the current date, and to acquire a historical time series corresponding to each of a plurality of historical dates; both the real-time time series and the historical time series are used to record the logistics package quantity and its time point; A similarity determination module is used to compare the real-time time series with the historical time series to obtain the package quantity similarity and sequence shape similarity; the package quantity similarity represents the similarity of the logistics package quantity at the corresponding time point between the real-time time series and the historical time series; the sequence shape similarity represents the similarity between the corresponding curve of the real-time time series and the corresponding curve of the historical time series; The target historical time series determination module is used to obtain the similarity weights corresponding to the package quantity similarity and the sequence shape similarity respectively; according to the similarity weights, the package quantity similarity and the sequence shape similarity are weighted and summed, and the summation result is determined as the sequence similarity between the historical time series and the real-time time series; according to the sequence similarity, in the historical time series, a target historical time series that meets a preset similarity condition is determined; A prediction base period determination module is used to determine the historical date corresponding to the target historical time series as the prediction base period; the prediction base period is used to predict the logistics package volume at a future point in time on the current date.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Method and equipment for processing and predicting time sequence containing sample points
CN103294729A
Method and system for complementing historical piece quantity data of newly-added website
CN111242340A