The present invention relates to a learning model generation system, a learning model generation method, and a learning model generation program configured to generate a learning model.
Various techniques for predicting the number of store visitors to a certain place and the like have been proposed (refer to, for example, Patent Literatures 1 and 2).
Patent Literature 1 describes a method of calculating the prospective number of attendees to an event on the basis of a visit pattern. In the method described in Patent Literature 1, visit patterns are corrected according to entrance record information on an event during the exhibition period and record information on an event of similar kind held in the past to re-calculate visit prediction data for the event during the exhibition period.
A prediction system described in Patent Literature 2 creates a probability table of a Bayesian network from empirical data. Then, the prediction system described in Patent Literature 2 outputs number-of-visitors prediction data on the basis of this probability table and information received from an external information input unit (information used as a parameter when the number of visitors is predicted).
PTL 1: Japanese Patent Application Laid-Open No. 2007-265317
PTL 1: Japanese Patent Application Laid-Open No. 2005-228014
There is a general technique for generating a learning model to be used in prediction of a prediction target by machine learning. Here, a variable representing data used as a parameter at the time of prediction is called “explanatory variable”, while a variable representing a prediction target is called “objective variable”.
Even if a predicted value obtained by applying the value of each explanatory variable to a learning model continues to have almost a similar value to an actual value, the trend of the actual value sometimes changes at a certain point in time and afterward. For example, in some cases, the actual value becomes larger than the actual value until a certain point in time at the certain point in time and afterward, or conversely, the actual value becomes smaller than the actual value until a certain point in time at the certain point in time and afterward. Consequently, a difference between the predicted value and the actual value increases because the trend of the actual value has changed.
A specific example will be described below. For example, it is supposed that a learning model for predicting the number of store visitors per day in a convenience store is generated. In addition, it is assumed that a situation where a predicted value of the number of store visitors per day obtained by applying the value of each explanatory variable to this learning model has a similar value to an actual value (the actual number of store visitors) has continued. After that, it is assumed that, as a stadium opened in the vicinity of the convenience store, the actual value of the number of store visitors increased at the opening day of the stadium and afterward as compared with the actual value before the opening day of the stadium and the trend of the actual value has changed. In such a case, a difference between the predicted value of the number of store visitors obtained from the above learning model and the actual value increases. This means that the accuracy of the learning model decreases at a certain point in time (in this example, the day when the stadium opened) and afterward.
As described above, there is a case where the accuracy of the predicted value decreases at a certain point in time and afterward due to a sudden change in the situation.
However, the techniques described in Patent Literatures 1 and 2 do not take into consideration a change in the trend of the actual value caused by a sudden change in the situation. Therefore, in a case where the trend of the actual value has changed due to a sudden change in the situation, the techniques described in Patent Literatures 1 and 2 cannot prevent the prediction accuracy from decreasing.
Therefore, an object of the present invention is to provide a learning model generation system, a learning model generation method, and a learning model generation program capable of solving a technical problem for preventing a decrease in prediction accuracy in a case where the trend of the actual value of a prediction target has changed.
A learning model generation system according to the present invention is characterized by including a learning model generation means that generates a learning model for calculating a predicted value of a prediction target using, as learning data, time series data in which a value of each explanatory variable used in prediction of the prediction target is associated with an actual value of the prediction target; a prediction means that calculates the predicted value of the prediction target using the learning model once the value of each explanatory variable is given; a change point determination means that determines a change point which is a point in time when a trend of the actual value of the prediction target changed; and a data correction means that corrects the time series data by adding a difference between the actual value and the predicted value of the prediction target at the change point and afterward to the actual value before the change point in the time series data when the change point is determined, in which the learning model generation means regenerates the learning model using the time series data after the correction as the learning data once the time series data is corrected.
In addition, a learning model generation method according to the present invention is characterized by generating a learning model for calculating a predicted value of a prediction target using, as learning data, time series data in which a value of each explanatory variable used in prediction of the prediction target is associated with an actual value of the prediction target; calculating the predicted value of the prediction target using the learning model once the value of each explanatory variable is given; determining a change point which is a point in time when a trend of the actual value of the prediction target changed; correcting the time series data by adding a difference between the actual value and the predicted value of the prediction target at the change point and afterward to the actual value before the change point in the time series data when the change point is determined; and regenerating the learning model using the time series data after the correction as the learning data in a case where the time series data is corrected.
Furthermore, a learning model generation program according to the present invention is characterized by causing a computer to execute learning model generation processing of generating a learning model for calculating a predicted value of a prediction target using, as learning data, time series data in which a value of each explanatory variable used in prediction of the prediction target is associated with an actual value of the prediction target; prediction processing of calculating the predicted value of the prediction target using the learning model once the value of each explanatory variable is given; change point determination processing of determining a change point which is a point in time when a trend of the actual value of the prediction target changed; data correction processing of correcting the time series data by adding a difference between the actual value and the predicted value of the prediction target at the change point and afterward to the actual value before the change point in the time series data when the change point is determined; and processing of regenerating the learning model using the time series data after the correction as the learning data in a case where the time series data is corrected.
According to the technical means of the present invention, it is possible to prevent a decrease in prediction accuracy in a case where the trend of the actual value of the prediction target has changed.
Hereinafter, exemplary embodiments of the present invention will be described with reference to the drawings.
In the following exemplary embodiments, a case where the number of store visitors per day in a convenience store is treated as a prediction target will be described as an example, but the prediction target is not limited to this example.
The data storage unit 2 is a storage device that stores time series data in which the value of each explanatory variable used in prediction of the prediction target (the number of store visitors per day in a convenience store; hereinafter, simply referred to as the number of store visitors) is associated with an actual value of this prediction target. The explanatory variable is a variable representing data used as a parameter at the time of prediction. Here, description is made assuming that plural types of explanatory variables are used.
The value of each explanatory variable corresponding to a certain time (date) is used as a parameter when a predicted value of the prediction target at that time is calculated.
The actual value illustrated in
When the value of each explanatory variable for predicting the number of store visitors on the prediction target day and the actual value of the number of store visitors on the same prediction target day are newly input, this value of each explanatory variable and this actual value are associated with each other and added to the time series data stored in the data storage unit 2. In the present exemplary embodiment, it is assumed that every day is individually treated as the prediction target day.
The learning model generation unit 3 generates a learning model using the time series data exemplified in
For example, when the learning model is generated for the first time, it is only required to prepare time series data equivalent to two years in advance such that the learning model generation unit 3 generates a learning model using this time series data equivalent to two years as learning data.
A method by which the learning model generation unit 3 generates the learning model is not particularly limited. For example, the learning model generation unit 3 may generate a learning model by regression analysis using learning data. Alternatively, the learning model generation unit 3 may generate a learning model by another machine learning algorithm.
The learning model may be, for example, a prediction formula for calculating the value of an objective variable. For simplicity of explanation, a case where the learning model is a prediction formula expressed by following formula (1) will be described as an example. However, the form of the learning model is not limited to the form of the prediction formula.
y=a
1
x
1
+a
2
x
2
+ . . . +a
n
x
n
+b Formula (1)
y is an objective variable representing the predicted value. x1 to xn are explanatory variables. a1 to an are coefficients of the explanatory variables. b is a constant term. The values of a1 to an and b are fixed by the learning model generation unit 3 on the basis of the learning data.
The value of each explanatory variable used in prediction of the number of store visitors on the prediction target day is input to the prediction unit 4 from, for example, an administrator of the learning model generation system 1 (hereinafter, simply referred to as administrator) for each time (in this example, on a daily basis). The prediction unit 4 calculates a predicted value y of the number of store visitors on the prediction target day by applying the value of each input explanatory variable to the learning model. As in this example, when the learning model is expressed by the prediction formula illustrated in formula (1), the prediction unit 4 substitutes values into x1 to xn in the prediction formula in accordance with the value of each input explanatory variable, thereby calculating the predicted value y. Hereinafter, an operation of the prediction unit 4 substituting values into x1 to xn in the prediction formula in accordance with the values of the explanatory variables will be described.
There are continuous variables and categorical variables as types of the explanatory variables.
The continuous variable takes a numerical value as a value. For example, the forecast value of the temperature illustrated in
The categorical variable takes an item as a value. For example, the forecast value of the weather and the day of the week illustrated in
One continuous variable corresponds to one of the explanatory variables x1 to xn in the prediction formula. The prediction unit 4 substitutes the value (numerical value) of an explanatory variable falling within the continuous variable into a corresponding explanatory variable in the prediction formula.
Meanwhile, each value of one categorical variable corresponds to one of the explanatory variables x1 to xn in the prediction formula. For example, each possible value of “day of the week” (each item such as “Sunday” or “Monday”), which is a categorical variable, corresponds to one of the explanatory variables x1 to xn in the prediction formula. The prediction unit 4 substitutes one of binary values (assumed as 0 and 1 in this example) into each explanatory variable in the prediction formula corresponding to each value of the categorical variables. For example, when the value of input “day of the week” is “Monday”, the prediction unit 4 substitutes 1 into an explanatory variable in the prediction formula corresponding to Monday and substitutes 0 into each explanatory variable in the prediction formula corresponding to each day of the week except Monday.
As described above, the prediction unit 4 calculates the predicted value y of the number of store visitors by substituting values into x1 to xn in the prediction formula in accordance with the values of the explanatory variables.
The prediction unit 4 sends the predicted value of the number of store visitors that has been calculated to the change point determination unit 5.
In addition, the values of each explanatory variable input for each day are added to the time series data stored in the data storage unit 2. For example, when the value of each explanatory variable is input in order to calculate the predicted value for a certain prediction target day, the prediction unit 4 simply stores this value of each explanatory variable to the data storage unit 2. A case where the prediction unit 4 stores the value of each input explanatory variable to the data storage unit 2 has been exemplified here, a means for storing the value of each input explanatory variable to the data storage unit 2 may be separately provided.
A point in time when the trend of the actual value of the prediction target changed will be referred to as a change point. The change point determination unit 5 determines a change point.
The actual value of the number of store visitors per day is input to the change point determination unit 5 from, for example, the administrator for each time (in this example, on a daily basis).
Note that the actual value input for each day is added to the time series data stored in the data storage unit 2 in association with the value of each explanatory variable used for calculating the predicted value with the day on which the actual value was obtained as the prediction target day. The processing of adding the input actual value to the time series data stored in the data storage unit 2 in association with the value of each explanatory variable as described above may be performed by, for example, the change point determination unit 5. Alternatively, a means for executing the processing of adding the input actual value to the time series data may be separately provided.
As modes of a change in trend of the actual value, there are a mode in which the actual value becomes a larger value than those until the change point at the change point and later and a mode in which the actual value becomes a smaller value than those until the change point at the change point and later.
The determination of the change point in a case where the actual value becomes a larger value than those until the change point at the change point and later will be described. The change point determination unit 5 compares the predicted value and the actual value of the number of store visitors for each prediction target day (that is, on a daily basis) and, in a case where the actual value continues to be larger than the predicted value by a threshold value or more for a predetermined period consecutively, determines a first point in time when the actual value became larger than the predicted value by the threshold value or more as the change point. This predetermined period is referred to as a determination period. The determination period is set in advance. Hereinafter, a case where the determination period is three days will be described as an example, but the determination period is not limited to three days and may be, for example, one week or the like. The threshold value is also set in advance.
It is assumed that the actual value continues to be larger than the predicted value by the threshold value or more for three consecutive days from July 5th (refer to
Next, the determination of the change point in a case where the actual value becomes a smaller value than those until the change point at the change point and later will be described. The change point determination unit 5 compares the predicted value and the actual value of the number of store visitors for each prediction target day (that is, on a daily basis) and, in a case where the actual value continues to be smaller than the predicted value by a threshold value or more for the determination period consecutively, determines a first point in time when the actual value became smaller than the predicted value by the threshold value or more as the change point.
It is assumed that the actual value continues to be smaller than the predicted value by the threshold value or more for three consecutive days from July 5th (refer to
The change point determination unit 5 sends information on the determined change point to the data correction unit 6 and the learning model generation unit 3.
The data correction unit 6 calculates a difference between the actual value and the predicted value of the prediction target at the change point and afterward. For example, the data correction unit 6 subtracts the predicted value from the actual value to find out a difference between both for each day in a period from the change point to a point in time when the change point was determined (in other words, the determination period starting from the change point) and then calculates an average value of these differences.
In a case where the actual value becomes a larger value than those until the change point at the change point and later (refer to
The data correction unit 6 adds the average value of the differences calculated as described above (hereinafter, simply referred to as difference) to the actual value before the change point in the time series data, thereby correcting the time series data stored in the data storage unit 2.
Next, a period for which the data correction unit 6 adds the difference D to the actual value is assumed as a predetermined period before the change point (July 5th). This predetermined period is different from the above-described determination period. In order to distinguish this predetermined period from the determination period, this predetermined period is referred to as a correction target period. The length of the correction target period is set in advance such that a period obtained by adding the determination period (three days in this example) to the correction target period serves as the learning data period (two years in this example). Therefore, the length of a period obtained by subtracting the determination period from the learning data period can be set in advance as the length of the correction target period.
When correcting the actual value in the time series data stored in the data storage unit 2, the data correction unit 6 corrects the actual value by adding the difference D to the actual value of each point in time within the correction target period before the change point (July 5th) (in other words, the actual values of July 4th, which is a point in time directly before the change point, and earlier). The difference D is an average value of differences obtained by subtracting the predicted value from the actual value for each point in time (each day) within the determination period starting from the change point.
Note that the data correction unit 6 does not correct the value of each explanatory variable included in the time series data.
Once the data correction unit 6 corrects the actual value in the time series data as described above, the learning model generation unit 3 uses the time series data for the earliest point in time and afterward within the correction target period before the change point as learning data to regenerate the learning model. More specifically, the learning model generation unit 3 regenerates the learning model using the time series data equivalent to the learning data period starting from the earliest point in time within the correction target period as learning data. In the example illustrated in
Note that the learning model generation unit 3 can specify the earliest point in time within the correction target period before the change point on the basis of the change point sent from the change point determination unit 5.
The learning model generation unit 3, the prediction unit 4, the change point determination unit 5, and the data correction unit 6 are realized by, for example, a CPU of a computer operating in line with a learning model generation program. In this case, the CPU reads the learning model generation program from a program recording medium such as a program storage device (illustration is omitted in
In addition, the learning model generation system 1 may have a configuration in which two or more physically separated devices are connected by wired or wireless connection.
Next, processing progress will be described.
The learning model generation unit 3 generates a learning model using, as learning data, the time series data equivalent to the learning data period, in which the actual value and the value of each explanatory variable are associated with each other (step S1). As described above, the method of generating the learning model using the learning data is not particularly limited. In addition, in this example, it is assumed that the learning model generation unit 3 generates the learning model in the form of the prediction formula. The learning model generation unit 3 sends the generated learning model to the prediction unit 4.
Once the value of each explanatory variable is input, the prediction unit 4 substitutes this value of each explanatory variable into the learning model (prediction formula) to calculate the predicted value (step S2). Since this operation has already been described, a description thereof will be omitted here. In step S2, the prediction unit 4 sends the predicted value that has been calculated to the change point determination unit 5. Every time the value of the explanatory variable of each day is input, the prediction unit 4 repeats calculation of the predicted value (step S2).
The change point determination unit 5 compares the actual value of the number of store visitors input from the outside for each day with the predicted value sent from the prediction unit 4 and, in the case of detecting the day when the actual value became larger than the predicted value by the threshold value or more, sets this day as a candidate for the change point (step S11).
In a case where the actual value continues to be larger than the predicted value by the threshold value or more for the determination period consecutively after the candidate for the change point was detected in step S11, the change point determination unit 5 determines the candidate for the change point as the change point (step S12). That is, the candidate for the change point is settled as the change point in step S12. The change point determination unit 5 sends information on the change point to the data correction unit 6 and the learning model generation unit 3.
Note that, in a case where the actual value does not continue to be larger than the predicted value by the threshold value or more for the determination period consecutively after the candidate for the change point was detected in step S11, the change point determination unit 5 cancels the candidate for the change point detected in step S11 from candidate. Then, the change point determination unit 5 waits until the change point determination unit 5 detects a candidate for the change point again.
After step S12, the data correction unit 6 finds out the difference by subtracting the predicted value from the actual value for each day in the determination period starting from the change point and then calculates the average value of these differences (step S13). This average value of the differences is referred to as the difference D.
Then, the data correction unit 6 corrects the time series data stored in the data storage unit 2 by adding the difference D to the actual value of each day within the correction target period before the change point (step S14).
After step S14, the learning model generation unit 3 regenerates the learning model using the time series data equivalent to the learning data period starting from the earliest day within the correction target period as learning data (step S15). The method of generating the learning model in step S15 is the same as the method of generating the learning model in step S1 (refer to
Once the learning model generation unit 3 regenerates the learning model in step S15, the learning model generation unit 3 sends this learning model to the prediction unit 4. Every time the value of the explanatory variable of each day is input to the prediction unit 4, the prediction unit 4 repeats calculation of the predicted value (step S2). At this time, once the learning model generated in step S15 is sent, the prediction unit 4 thereafter calculates the predicted value using this learning model.
In the flowchart illustrated in
According to the present invention, when the change point determination unit 5 determines the change point, the data correction unit 6 calculates the average value of the differences between the actual values and the predicted values in the determination period starting from the change point. Then, the data correction unit 6 corrects the time series data by adding the average value of these differences to the actual value of each day within the correction target period before the change point. As described with reference to
Next, modifications of the above exemplary embodiments will be described.
The change point determination unit 5 may determine the change point without using the predicted value. In this case, the prediction unit 4 does not have to send the predicted value to the change point determination unit 5. Also in the following description, explanation will be given for both of a case where the actual value becomes a larger value than those until the change point at the change point and later and a case where the actual value becomes a smaller value than those until the change point at the change point and later.
First, a case where the actual value becomes a larger value than those until the change point at the change point and later will be described with reference to
That is, on the condition that the newly input actual value is larger than the average value A of the actual values equivalent to the past certain time period from the point in time corresponding to the actual value immediately before this new actual value by the threshold value or more, the change point determination unit 5 sets a point in time corresponding to this newly input actual value as a candidate for the change point. Then, in a case where the subsequent actual values continue to be larger than the average value A by the threshold value or more for the determination period consecutively, the change point determination unit 5 determines this candidate for the change point as the change point. Meanwhile, in a case where the subsequent actual values do not continue to be larger than the average value A by the threshold value or more for the determination period consecutively, the change point determination unit 5 cancels the detected candidate for the change point from the candidate. Then, the change point determination unit 5 waits until the change point determination unit 5 detects a candidate for the change point again.
Next, a case where the actual value becomes a smaller value than those until the change point at the change point and later will be described with reference to
That is, on the condition that the newly input actual value is smaller than the average value A of the actual values equivalent to the past certain time period from the point in time corresponding to the actual value immediately before this new actual value by the threshold value or more, the change point determination unit 5 sets a point in time corresponding to this newly input actual value as a candidate for the change point. Then, in a case where the subsequent actual values continue to be smaller than the average value A by the threshold value or more for the determination period consecutively, the change point determination unit 5 determines this candidate for the change point as the change point. Meanwhile, in a case where the subsequent actual values do not continue to be smaller than the average value A by the threshold value or more for the determination period consecutively, the change point determination unit 5 cancels the detected candidate for the change point from the candidate. Then, the change point determination unit 5 waits until the change point determination unit 5 detects a candidate for the change point again.
Also in this modification, as in the above exemplary embodiments, it is possible to prevent a decrease in prediction accuracy in a case where the trend of the actual value of the prediction target has changed. Furthermore, in this modification, since the change point determination unit 5 can determine the change point without using the predicted value, the prediction unit 4 does not need to send the predicted value to the change point determination unit 5.
In the above exemplary embodiments and the modifications thereof, a case where the number of store visitors per day in a convenience store is treated as a prediction target has been described as an example, but the prediction target may be, for example, the number of attendance in various facilities such as movie theaters and theme parks.
In addition, the prediction target is not limited to the number of people such as the number of store visitors and the number of attendance but may be another matter such as the number of sales.
In the above exemplary embodiments and the modifications thereof, a case where “one day” is treated as a unit of time has been described as an example, but the unit of time may be other than “one day”.
The learning model generation system 1 of the present invention is implemented in the computer 1000. The operation of the learning model generation system 1 is stored in the auxiliary storage device 1003 in the form of a program. The CPU 1001 retrieves the program from the auxiliary storage device 1003 to develop in the main storage device 1002 and executes the above processing in line with this program.
The auxiliary storage device 1003 is an example of a non-transitory tangible medium. Other examples of non-transitory tangible media include magnetic disks, magneto-optical disks, CD-ROMs, DVD-ROMs, and semiconductor memories connected via the interface 1004. In addition, when this program is delivered to the computer 1000 through a communication line, the computer 1000 that has accepted the delivery may develop the program in the main storage device 1002 and execute the above processing.
Meanwhile, the program may be for realizing a part of the above-described processing. Additionally, the program may be a differential program that realizes the above-described processing in combination with another program already stored in the auxiliary storage device 1003.
Next, the outline of the present invention will be described.
The learning model generation means 71 (for example, the learning model generation unit 3) generates a learning model for calculating a predicted value of a prediction target using, as learning data, time series data in which a value of each explanatory variable used in prediction of the prediction target is associated with an actual value of the prediction target.
The prediction means 72 (for example, the prediction unit 4) calculates the predicted value of the prediction target using the learning model once the value of each explanatory variable is given.
The change point determination means 73 (for example, the change point determination unit 5) determines a change point which is a point in time when a trend of the actual value of the prediction target changed.
The data correction means 74 (for example, the data correction unit 6) corrects the time series data by adding a difference between the actual value and the predicted value of the prediction target at the change point and afterward to the actual value before the change point in the time series data when the change point is determined.
The learning model generation means 71 regenerates the learning model using the time series data after the correction as the learning data once the time series data is corrected.
With such a configuration, it is possible to prevent a decrease in prediction accuracy in a case where the trend of the actual value of the prediction target has changed.
In addition, in a case where the actual value continues to be larger than the predicted value by a threshold value or more for a predetermined period (for example, the determination period) consecutively, the change point determination means 73 may determine a first point in time when the actual value became larger than the predicted value by the threshold value or more as the change point, or in a case where the actual value continues to be smaller than the predicted value by the threshold value or more for a predetermined period consecutively, the change point determination means 73 may determine a first point in time when the actual value became smaller than the predicted value by the threshold value or more as the change point.
In addition, when a new actual value is given, the change point determination means 73 may calculate an average value of the actual values equivalent to a past certain time period from a point in time corresponding to an actual value immediately before the new actual value and, in a case where the new actual value is larger than the average value by a threshold value or more and actual values subsequent to the new actual value continue to be larger than the average value by the threshold value or more for a predetermined period (for example, the determination period) consecutively, or a case where the new actual value is smaller than the average value by the threshold value or more and actual values subsequent to the new actual value continue to be smaller than the average value by the threshold value or more for a predetermined period consecutively, may determine a point in time corresponding to the new actual value as the change point.
In addition, the data correction means 74 may calculate an average value of differences between the measured values and the predicted values in a period from the change point to a point in time when the change point was determined and add the average value of the differences to the actual value before the change point in the time series data.
In addition, the data correction means 74 may calculate an average value of differences between the measured values and the predicted values in a period from the change point to a point in time when the change point was determined and add the average value of the differences to each actual value equivalent to a second predetermined period (for example, the correction target period) before the change point in the time series data, and the learning model generation means 71 may regenerate the learning model using data out of the time series data for an earliest point in time and afterward within the second predetermined period.
The present invention is suitably applied to a learning model generation system configured to generate a learning model.
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/JP2015/001741 | 3/26/2015 | WO | 00 |