Commodity sales forecasting method, storage medium and computer device
By acquiring and correcting weather and sales data, combined with prediction algorithms, the problem of inaccurate prediction of vending machine product sales data is solved, improving prediction accuracy and reducing economic losses.
Patent Information
- Application Number
- CN202010797853.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-10
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2040-08-10
AI Technical Summary
The prior art is difficult to accurately predict the sales data of vending machine products, especially when the commodity changes frequently, resulting in inaccurate prediction results and economic losses.
By obtaining weather data on the forecast date and reference date, and sales data on the reference date, data correction and supplementation are carried out, people's travel probability is determined based on the weather conditions, and a prediction algorithm is used to calculate the predicted sales volume of the product.
It improves the accuracy of commodity sales data, reduces economic losses, and reduces operating costs through reasonable arrangement of operation and maintenance work.
Smart Images

Figure CN112150188B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of information processing, and in particular to a commodity sales forecasting method, storage medium and computer equipment. Background Art
[0002] Sales forecast refers to the prediction of future sales based on past sales and the use of built-in or user-defined sales forecast models. Sales forecast can directly generate sales plans of the same type. One of the central tasks of sales planning is sales forecasting. Regardless of the size of the company or the number of sales staff, sales forecasting affects all aspects of sales management, including planning, budgeting and sales volume determination.
[0003] For vending machines in actual commercial use, the entire value acquisition cycle is lengthy and is not suitable for situations where goods change frequently, which can make the prediction results inaccurate and cause economic losses. Summary of the invention
[0004] In view of the above-mentioned deficiencies, the purpose of this application is to provide a commodity sales forecasting method, storage medium and computer equipment to accurately forecast the sales data of commodities on the forecast date and reduce economic losses.
[0005] In order to achieve the above-mentioned purpose, the technical solution provided by the present application is: a commodity sales forecasting method, comprising the steps of:
[0006] Get weather data for the forecast date and reference day;
[0007] Get sales data for the reference date;
[0008] Correct or supplement sales data;
[0009] The weather data and the corrected or supplemented sales data are calculated through a forecasting algorithm to obtain the forecasted sales volume of the forecasted product.
[0010] Furthermore, the data correction comprises the steps of:
[0011] Calculate the standard deviation of the sales data for the reference day;
[0012] Determine the trend of sales data for the forecast date and classify it.
[0013] Furthermore, the data correction step includes the following steps:
[0014] Divide dates into weekdays, weekends, and holidays;
[0015] Determine the date of the forecast.
[0016] Furthermore, when the forecast date is a working day, the data correction includes the steps of:
[0017] Get sales data for the previous three working days;
[0018] If there is any missing sales data, the average of the two days before and after will be used to fill the gap;
[0019] If the sales data is higher than twice the average or lower than twice the average, the sales data for that day will be taken as three quarters of the maximum value, rounded up to one decimal place.
[0020] Furthermore, when the predicted date is a holiday, the data correction includes the steps of:
[0021] Get sales data for the same festival in the previous three years;
[0022] If the sales data is all empty, fill in 0;
[0023] If there are any missing sales data, take three quarters of the maximum value and round up to the nearest decimal place to complete the missing data.
[0024] Furthermore, when the forecast date is a weekend, the data correction includes the steps of:
[0025] Get sales data for the previous three weekends;
[0026] If there are more than 3 missing sales data, take 1.25 times the sales data of Friday of the previous three weeks, round up to the nearest decimal place, and fill in the missing data.
[0027] If the missing sales data is less than 3, determine whether the missing sales data is in the increasing interval or the decreasing interval;
[0028] If the sales data is in an increasing range, take 0.75 times the maximum value and round up to the nearest decimal place to make up the difference;
[0029] If the sales data is in a decreasing range, take 0.75 times the average value and round up to the nearest decimal place to make up the difference;
[0030] If the sales data is in a flat range, take the average value to make up the difference.
[0031] Furthermore, the step of determining whether the missing sales data is in an increasing interval, a decreasing interval, or a flat interval comprises the following steps:
[0032] Get sales data for three days before the forecast date;
[0033] If B[0]<B[1]<B[2], the sales data is in an increasing range;
[0034] If B[0]>B[1]>B[2], the sales data is in a decreasing range;
[0035] If B[0]=B[1]=B[2], the sales data is in a flat range;
[0036] Among them, B[0] is the sales data of the day before yesterday, B[1] is the sales data of the day before yesterday, and B[2] is the sales data of yesterday.
[0037] Furthermore, the obtaining of weather data for the forecast date and the reference date includes:
[0038] Get the maximum temperature, minimum temperature, average temperature, average relative humidity and average wind speed of the forecast date and reference day;
[0039] Calculate the relative wet bulb temperature for the forecast date and the reference day;
[0040] Calculate weather comfort levels for the forecast date and reference day;
[0041] Calculate the normalized values of weather comfort for the forecast date and the reference day.
[0042] Furthermore, the calculation formula of the relative wet bulb temperature is:
[0043]
[0044] Among them, T W is the wet bulb temperature, T m is the maximum temperature, and H is the normalized relative humidity.
[0045] Furthermore, the calculation formula of the weather comfort is:
[0046] cft=0.72*(T a +T w )-7.2*W a +4.8
[0047] Among them, cft is comfort, T w is the wet bulb temperature, T a is the maximum temperature, W a is the average wind speed.
[0048] Furthermore, the calculation formula of the normalized value of the comfort difference is:
[0049]
[0050] Among them, Δcft is the comfort difference, and Δd is the normalized value of the comfort difference.
[0051] The present application also provides a technical solution: a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned commodity sales forecasting method when executing the computer program.
[0052] The present application also provides a technical solution: a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above-mentioned commodity sales forecasting method when executed by a processor.
[0053] Beneficial effects:
[0054] This application obtains more accurate sales data for the reference day by correcting or supplementing the anomalies or omissions in the sales data for the reference day, and combines it with the probability of people traveling determined by weather conditions to calculate a more accurate sales volume for the predicted date, reasonably arrange operation and maintenance work, and reduce economic losses. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] The included drawings are used to provide a further understanding of the embodiments of the present application, which constitute a part of the specification, are used to illustrate the implementation methods of the present application, and together with the text description, explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0056] Figure 1 This is a flowchart of a commodity sales forecast in one embodiment of the present application;
[0057] Figure 2 is a flow chart of steps of data correction in one embodiment of the present application;
[0058] Figure 3 is a flowchart of the division of forecast dates according to an embodiment of the present application;
[0059] Figure 4 is a flow chart of sales data correction when the forecast date is a working day according to an embodiment of the present application;
[0060] Figure 5 is a flow chart of correcting sales data when the forecast date is a holiday according to an embodiment of the present application;
[0061] Figure 6 is a flowchart of sales data correction when the forecast date is a weekend in one embodiment of the present application;
[0062] Figure 7 This is a flow chart of determining the interval in which sales data is located according to an embodiment of the present application;
[0063] Figure 8 This is a flowchart of obtaining weather data for a predicted date according to an embodiment of the present application. DETAILED DESCRIPTION
[0064] It should be understood that the terms used herein, the specific structures and functional details disclosed are only for describing specific embodiments and are representative, but the present application can be implemented in many alternative forms and should not be construed as being limited to only the embodiments described herein.
[0065] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating relative importance or implicitly indicating the number of technical features indicated. Therefore, unless otherwise specified, features defined as "first" and "second" may explicitly or implicitly include one or more of the features; "plurality" means two or more. The term "including" and any variation thereof means non-exclusive inclusion, and one or more other features, integers, steps, operations, units, components and / or combinations thereof may exist or be added.
[0066] In addition, terms indicating orientation or positional relationships, such as “center,” “lateral,” “up,” “down,” “left,” “right,” “vertical,” “horizontal,” “top,” “bottom,” “inside,” and “outside,” are described based on the orientation or relative positional relationships shown in the accompanying drawings and are merely simplified descriptions for the convenience of describing the present application. They do not indicate that the devices or elements referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limitations on the present application.
[0067] In addition, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be internally connected between two components. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.
[0068] Vending machines are usually placed in crowded places such as stations, shopping malls, and office buildings. Each vending machine is connected to the main server through the network to transmit data. Hardware failure of the vending machine, software communication failure, no delivery feedback, code error, main server failure or network disconnection will cause data loss.
[0069] The present application is further described below with reference to the accompanying drawings and optional embodiments.
[0070] like Figure 1 As shown, the embodiment of the present application discloses a commodity sales forecasting method, comprising the steps of:
[0071] S1. Obtain weather data for the forecast date and reference date;
[0072] S2. Obtain sales data on the reference day;
[0073] S3, determining whether the acquired sales data is abnormal;
[0074] S4. If the sales data is abnormal, correct the data;
[0075] S5. The weather data and the corrected sales data are calculated through a prediction algorithm to obtain the predicted sales volume of the product.
[0076] Among them, Figure 2 As shown, the data correction includes the steps of:
[0077] S41. Calculate the standard deviation of the sales data on the reference day;
[0078] S42. Determine the trend of the sales data on the forecast date and classify it.
[0079] This application obtains more accurate sales data for the reference day by correcting or supplementing the anomalies or omissions in the sales data for the reference day, and combines it with the probability of people traveling determined by weather conditions to calculate a more accurate sales volume for the predicted date, reasonably arrange operation and maintenance work, and reduce economic losses.
[0080] like Figure 3 As shown, specifically, before correcting the data, the steps include:
[0081] S31. Divide dates into working days, weekends and holidays;
[0082] S32. Determine the date of the predicted date.
[0083] Among them, working days are Monday to Friday, weekends are Saturday and Sunday, and holidays are statutory holidays, including: New Year's Day, Spring Festival, Qingming Festival, May Day, Dragon Boat Festival, Mid-Autumn Festival, National Day and other days.
[0084] On different dates, the probability of people going out and shopping will be different. According to the laws of life, the dates are divided into the above three types. On each date, people's daily activity patterns are basically the same. Therefore, using the same type of dates as a reference to predict the sales volume of a certain day will be more referenceable and more accurate, so as to reasonably arrange operation and maintenance work and reduce economic losses.
[0085] After dividing the dates, there are different correction methods for the abnormal or missing sales data of different dates.
[0086] like Figure 4As shown, when the forecast date is a working day, the data correction includes the steps of:
[0087] S3211. Obtain sales data for the previous three working days;
[0088] S3212. If there are missing sales data, the average of the two days before and after will be used to fill the gap;
[0089] S3213. If the sales data is higher than twice the average value or lower than twice the average value, the sales data for that day shall be taken as three quarters of the maximum value, rounded up to one decimal place.
[0090] On weekdays, people's activities are relatively regular. Under normal circumstances, the data of the previous and next few days will be relatively similar. When there is missing data, the average value of the data of the previous and next two days can be used to fill the gap. When the data is abnormal, three-quarters of the maximum sales data of the day can be taken to correct the abnormal data so that the data of the day is close to the correct value, making the final calculated forecast value closer to the actual value, making the forecast more accurate, and arranging operation and maintenance work more reasonably to reduce economic losses.
[0091] like Figure 5 As shown, when the predicted date is a holiday, the data correction includes the steps of:
[0092] S3221. Obtain sales data for the same festival in the previous three years;
[0093] S3222, if the sales data is all empty, fill in 0;
[0094] S3223. If there are any missing sales data, take three quarters of the maximum value and round up to the nearest decimal place to complete the missing data.
[0095] If the sales data is empty, it means that the product was not sold during the previous holidays, so there is no need to replenish it. If it is just missing, it can be supplemented based on the comprehensive values taken according to past experience, so as to make the forecast calculation more accurate, arrange the operation and maintenance work more reasonably, and reduce economic losses.
[0096] like Figure 6 As shown, when the forecast date is a weekend, the data correction includes the steps of:
[0097] S3231. Get the sales data of the weekends of the previous three weeks;
[0098] S3232. If there are more than 3 missing sales data, the missing data shall be 1.25 times the sales data of Friday of the previous three weeks, rounded up to the nearest decimal place, to complete the missing data.
[0099] S3233. If the missing sales data is less than 3, determine whether the missing sales data is in an increasing interval or a decreasing interval;
[0100] S3234. If the sales data is in an increasing interval, take 0.75 times the maximum value, round up to one decimal place, and fill in the blanks.
[0101] S3235. If the sales data is in a decreasing interval, take 0.75 times the average value, round up to one decimal place, and fill in the blanks.
[0102] S3236. If the sales data is in a flat interval, fill in the blanks with the average value.
[0103] Taking half of the number of missing data as the boundary, that is, there are six days in the first three weeks, so there are six data. Taking three days as the boundary, different correction processes are carried out. If the number of missing data is greater than or equal to three, it means that more than half are missing. Since the data missing is relatively serious, it cannot be supplemented according to the remaining data, which will be inaccurate. Therefore, take Friday near the weekend. After work on Friday, people's travel and shopping activities are similar to those on weekends. Therefore, after expanding the sales data on Friday to fill in, it can make the prediction result more accurate; if the number of missing data is less than half, check whether the prediction date is in an increasing, decreasing or flat interval, and take a larger or smaller value according to the trend to fill in, which can make the prediction result more accurate.
[0104] Among them, as Figure 7 shown, the method for determining whether the missing sales data is in an increasing interval, a decreasing interval or a flat interval is as follows:
[0105] Obtain the sales data of the three days before the prediction date;
[0106] If B[0]<B[1]<B[2], then the sales data is in an increasing interval;
[0107] If B[0]>B[1]>B[2], then the sales data is in a decreasing interval;
[0108] If B[0]=B[1]=B[2], then the sales data is in a flat interval;
[0109] Among them, B[0] is the sales data of the day before yesterday, B[1] is the sales data of yesterday, and B[2] is the sales data of today.
[0110] Under normal circumstances, the trend will not change suddenly in a short period of time. Therefore, taking the sales data of the first three days to judge the trend of the prediction date is more valuable for reference and more accurate.
[0111] Furthermore, as Figure 8 shown, the obtaining of the weather data of the prediction date and the reference date includes:
[0112] S11, obtaining the maximum temperature, minimum temperature, average temperature, average relative humidity and average wind speed of the forecast date and the reference day;
[0113] S12, calculating the relative wet bulb temperature of the forecast date and the reference date;
[0114] S13, calculating the weather comfort level on the forecast date and the reference date;
[0115] S14. Calculate the normalized values of weather comfort levels on the forecast date and the reference date.
[0116] Obtain the weather data that people are most likely to feel when going out, and then calculate and judge people's willingness to go out, so that the calculated predicted sales have higher credibility, so that operation and maintenance work can be arranged more reasonably and economic losses can be reduced.
[0117] Specifically, the calculation formula for relative wet bulb temperature is:
[0118]
[0119] Among them, T W is the wet bulb temperature, T m is the maximum temperature, and H is the normalized relative humidity.
[0120] The calculation formula for weather comfort is:
[0121] cft=0.72*(T a +T w )-7.2*W a +4.8
[0122] Among them, cft is comfort, T w is the wet bulb temperature, T a is the maximum temperature, W a is the average wind speed.
[0123] The calculation formula of the normalized value of comfort difference is:
[0124]
[0125] Among them, Δcft is the comfort difference, and Δd is the normalized value of the comfort difference.
[0126] More specifically, the sales data corresponding to the forecast date is taken as a set, recorded as B, and the trend of set B is judged and classified. The classification category is recorded as tnd. The judgment method of tnd is:
[0127] If B[0]>B[1]and B[1]>B[2], it is considered to be increasing;
[0128] If B[0] < B[1] and B[1] < B[2], it is judged as decreasing;
[0129] If B[0] == B[1] and B[1] == B[2], it is judged as flat;
[0130] If (B[0] < B[1] and B[1] > B[2]) or (B[0] == B[1] and B[1] < B[2]) or (B[0] > B[1] and B[1] == B[2]), it is judged as a peak;
[0131] If (B[0] > B[1] and B[1] < B[2]) or (B[0] == B[1] and B[1] > B[2]) or (B[0] < B[1] and B[1] == B[2]), it is judged as a valley.
[0132] Among them, B[0] is the sales data of the day before yesterday, B[1] is the sales data of yesterday, and B[2] is the sales data of today.
[0133] According to the above calculation results, substitute the values into the prediction algorithm in Table 1 below to obtain the predicted sales volume p.
[0134] Table 1. Prediction Algorithm
[0135]
[0136]
[0137] Among them, md_mnt is the standard deviation of set B in the three weeks before the prediction date, v_mnt is the median of set B, bfmd_mnt is the standard deviation of set B in the three days closest to the prediction date, and mx_mnt is the maximum value of set B.
[0138] This application also provides a computer device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the above-mentioned commodity sales volume prediction method are implemented.
[0139] The technical solution provided by this application is also: a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned commodity sales volume prediction method are implemented.
[0140] It should be noted that the limitations of the steps involved in this solution, without affecting the implementation of the specific solution, are not considered as limiting the order of the steps. The steps written in the front can be executed first, or can be executed later, or even can be executed simultaneously. As long as the solution can be implemented, it should be regarded as falling within the protection scope of this application.
[0141] The above content is a further detailed description of the present application in combination with specific optional implementation methods, and it cannot be determined that the specific implementation of the present application is limited to these descriptions. For ordinary technicians in the technical field to which the present application belongs, several simple deductions or substitutions can be made without departing from the concept of the present application, which should be deemed to fall within the scope of protection of the present application.
Claims
1. A commodity sales forecasting method, characterized in that: Including steps: Obtain the weather data of the prediction date and the reference date; Obtain the sales data of the reference date; Divide the dates into weekdays, weekends and festivals, and determine the date type of the prediction date; Based on the date type of the prediction date, correct the sales data, including: Calculate the standard deviation of the sales data of the reference date, judge the trend of the sales data of the prediction date and classify it; When the prediction date is a weekday, the correction of the data includes the steps: Obtain the sales data of the weekdays in the previous three weeks; If there is missing sales data, take the average value of the previous and next two days to fill it; If there is sales data higher than twice the average value or lower than twice the average value, the sales data of that day is taken as three-quarters of the maximum value, and rounded up to one decimal place; When the prediction date is a festival, the correction of the data includes the steps: Obtain the sales data of the same festival in the previous three years; If all the sales data are empty, fill in 0; If there is missing sales data, take three-quarters of the maximum value, and round up to one decimal place to fill it; When the prediction date is a weekend, the correction of the data includes the steps: Obtain the sales data of the weekends in the previous three weeks; If the number of missing sales data is greater than or equal to 3, take 1.25 times the sales data of Friday in the previous three weeks, and round up to one decimal place to fill it; If the number of missing sales data is less than 3, judge whether the missing sales data is in an increasing interval, a decreasing interval or a flat interval; If the sales data is in an increasing interval, take 0.75 times the maximum value, and round up to one decimal place to fill it; If the sales data is in a decreasing interval, take 0.75 times the average value, and round up to one decimal place to fill it; If the sales data is in a flat interval, fill it with the average value; The judgment of whether the missing sales data is in an increasing interval, a decreasing interval or a flat interval includes the steps: Obtain the sales data of the three days before the prediction date; If B[0]<B[1]<B[2], the sales data is in an increasing interval; If B[0]>B[1]>B[2], the sales data is in a decreasing interval; If B[0]=B[1]=B[2], the sales data is in a flat interval; Wherein, B[0] is the sales data of the day before yesterday, B[1] is the sales data of the day before, and B[2] is the sales data of yesterday; According to the weather data, the corrected sales data and the interval type of the sales data, use the corresponding prediction algorithm to calculate the predicted sales volume of the predicted product.
2. A commodity sales forecasting method according to claim 1, characterized in that: The obtaining of the weather data of the prediction date and the reference date includes: Obtain the maximum temperature, minimum temperature, average temperature, average relative humidity and average wind speed of the prediction date and the reference date; Calculate the relative wet bulb temperature of the prediction date and the reference date; Calculate the weather comfort of the prediction date and the reference date; Calculate the normalized value of the weather comfort of the prediction date and the reference date.
3. A commodity sales forecasting method according to claim 2, characterized in that: The calculation formula of the relative wet bulb temperature is: in, is the wet bulb temperature, is the maximum temperature, is the normalized relative humidity.
4. A commodity sales forecasting method according to claim 2, characterized in that: The calculation formula of the weather comfort is: in, For comfort, is the wet bulb temperature, is the maximum temperature, is the average wind speed.
5. A commodity sales forecasting method according to claim 2, characterized in that: The calculation formula of the normalized value of the comfort difference is: in, For poor comfort, is the normalized value of the comfort difference.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 5.
7. A computer-readable storage medium having a computer program stored thereon, 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 5 are implemented.
Citation Information
Patent Citations
Short-term load forecasting method based on hourly comprehensive meteorological indexes
CN103606015A
sales volume forecasting method and a training method, a device and an electronic system of a model thereof
CN109509030A
Sales volume prediction method and device
CN110555578A