The present invention relates to a prediction model re-learning device that re-learns a prediction model, a prediction model re-learning method, and a program recording medium.
It is known that prediction precision of a prediction model deteriorates over time due to a change in environment or the like.
Therefore, PTL 1 discloses a technique of re-learning a prediction model based on an evaluation index for evaluating the precision of the prediction model.
PTL 2 discloses a technique of re-learning a prediction model for identifying a smell every time measurement of five samples is completed.
[PTL 1] JP WO 2016/151618 A
[PTL 2] JP 1992-186139 A
By the way, a sensor that detects a smell has a characteristic that a behavior of a detection value of the sensor changes when a measurement environment such as temperature or humidity changes.
However, the evaluation index described in PTL 1 does not consider the above characteristic. Therefore, in the technique described in PTL 1, there is a case where the precision deterioration of the prediction model using a detection value of a sensor is not mitigated.
The technique described in PTL 2 does not consider the above characteristic because re-learning is performed every time the measurement of five samples is completed. Therefore, the technique described in PTL 2 may not mitigate precision deterioration of the prediction model.
Therefore, an object of the present invention is to mitigate precision deterioration of a prediction model.
A prediction model re-learning device according to the present invention includes calculation means for calculating an index for determining whether to re-learn a prediction model for a smell based on data related to smell detection by a sensor; and re-learning means for re-learning the prediction model in a case where the calculated index satisfies a predetermined condition.
A prediction model re-learning method according to the present invention calculates an index for determining whether to re-learn a prediction model for a smell based on data related to smell detection by a sensor; and re-learns the prediction model in a case where the calculated index satisfies a predetermined condition.
A program recording medium according to the present invention causes a computer to execute: processing of calculating an index for determining whether to re-learn a prediction model for a smell based on data related to smell detection by a sensor; and processing of re-learning the prediction model in a case where the calculated index satisfies a predetermined condition.
The present invention has an effect of mitigating precision deterioration of a prediction model.
Hereinafter, a first example embodiment according to the present invention will be described.
<Sensor>
A sensor used in the present example embodiment will be described.
The sensor 10 is a sensor having a receptor to which a molecule is attached, and a detection value changes according to attachment or detachment of the molecule at the receptor. Note that a gas sensed by the sensor 10 is referred to as a target gas. Furthermore, the time-series data of the detection value output from the sensor 10 is referred to as time-series data 20. Here, as necessary, the time-series data 20 is also referred to as Y, and the detection value at time t is also referred to as y(t). Y is a vector in which y (t) is listed.
For example, the sensor 10 may be a membrane-type surface stress sensor (MSS). The MSS has a sensory membrane to which the molecule is attached as the receptor, and stress generated in a support member of the sensory membrane changes according to the attachment or detachment of the molecule to or from the sensory membrane. The MSS outputs the detection value based on this change in stress. Note that the sensor 10 is not limited to the MSS, and may be any sensor as long as the sensor outputs the detection value based on a change in a physical quantity related to viscoelasticity or a dynamic characteristic (mass, inertia moment, or the like) of a member of the sensor 10, which occurs according to the attachment or detachment of the molecule to or from the receptor. Various types of sensors such as cantilever-type, membrane-type, optical-type, piezo-, and vibration-response sensors can be adopted.
The prediction model used in the present example embodiment will be described.
Note that, in the example embodiment to be described below, the prediction model is not limited to the model that predicts the type of fruit. The prediction model is only required to output the prediction result based on the time-series data of the detection value output from the sensor 10. For example, the prediction model may predict the presence or absence of a specific disease from exhalation of a person, may predict the presence or absence of a harmful substance from a smell in a house, or may predict abnormality of factory equipment from a smell in the factory.
The computer 1000 includes a bus 1020, a processor 1040, a memory 1060, a storage device 1080, an input/output interface 1100, and a network interface 1120. The bus 1020 is a data transmission path for the processor 1040, the memory 1060, the storage device 1080, the input/output interface 1100, and the network interface 1120 to transmit and receive data to and from one another. Note that the method of connecting the processor 1040 and the like to one another is not limited to the bus connection.
The processor 1040 is various processors such as a central processing unit (CPU), a graphics processing unit (GPU), and a field-programmable gate array (FPGA). The memory 1060 is a main storage device implemented by using a random access memory (RAM) or the like. The storage device 1080 is an auxiliary storage device implemented by using a hard disk, a solid-state drive (SSD), a memory card, a read only memory (ROM), or the like.
The input/output interface 1100 is an interface for connecting the computer 1000 and an input/output device. For example, an input device such as a keyboard and an output device such as a display device are connected to the input/output interface 1100. In addition, for example, the sensor 10 is connected to the input/output interface 1100. Note that the sensor 10 is not necessarily directly connected to the computer 1000. For example, the sensor 10 may store the acquired data in a storage device shared with the computer 1000.
The network interface 1120 is an interface for connecting the computer 1000 to a communication network. The communication network is, for example, a local area network (LAN) or a wide area network (WAN). The method of connecting the network interface 1120 to the communication network may be wireless connection or wired connection.
The storage device 1080 stores program modules that implement the functional configuration units of the prediction model re-learning device 2000. The processor 1040 reads the program modules to the memory 1060 and executes the program modules, thereby implementing the functions related to the program modules.
Information stored in the storage unit 2010 will be described.
Each record in
The measurement date may be, for example, a date on which the target gas has been injected into the sensor 10 or a date on which the acquired smell data has been stored in the storage unit 2010. Note that the measurement date may be measurement date and time including a measurement time.
The measurement environment is information related to the environment when the smell is measured. As illustrated in
The sampling period indicates a reciprocal for measuring the smell and is expressed as Δt [s] or a sampling frequency [Hz] using an inverse number of Δt [s]. For example, the sampling period is 0.1 [s], 0.01 [s], or the like.
When the smell is measured by alternately injecting a sample gas and a purge gas to the sensor 10, an injection time of the sample gas and the purge gas may be set as the sampling period. Here, the sample gas is a target gas in
The measurement environment such as the above-described temperature, humidity, and sampling period may be acquired by, for example, a meter provided inside or outside the sensor 10, or may be input from a user.
In the present example embodiment, the temperature, humidity, and sampling period have been described as examples of the measurement environment, but other examples of the measurement environment include information of a distance between an object to be measured and the sensor 10, the type of the purge gas, a carrier gas, the type of the sensor (for example, the sensor ID), a season at the time of measurement, an atmospheric pressure at the time of measurement, an atmosphere (for example, CO2 concentration) at the time of measurement, and a measurer. The carrier gas is a gas simultaneously injected with the smell to be measured, and for example, nitrogen or the atmosphere is used. The sample gas is a mixture of the carrier gas and the smell to be measured.
Furthermore, the above-described temperature and humidity may be acquired from set values of the object to be measured, the carrier gas, the purge gas, the sensor 10 itself, the atmosphere around the sensor 10, the sensor 10, or a device that controls the sensor 10.
Note that, in
As illustrated in
Next, the calculation unit 2020 acquires the temperature included in the measurement environment of the smell data that is the smell data other than the smell data used as the training data and on or after the measurement date of the smell data used as the training data (S210). For example, the calculation unit 2020 acquires the temperature “10° C.” of the smell data with the ID“125” illustrated in
Next, the calculation unit 2020 calculates a difference between the temperature acquired in S200 and the temperature acquired in S210 as an index (S220). For example, when the temperature acquired in S200 is “20° C.” and the temperature acquired in S210 is “10° C.”, the index is “10° C.”.
Note that, in the present example embodiment, the case where one smell data is acquired in S200 and one smell data is acquired in S210 has been described as an example. In this case, for example, the calculation unit 2020 may randomly acquire one of the smell data used for the training data or may receive designation of the smell data from the user and acquire the smell data. The same similarly applies to the smell data acquired in S210.
Furthermore, there may be a plurality of smell data acquired by the calculation unit 2020 in each of S200 and S210. In this case, the calculation unit 2020 acquires, for example, a statistical value (for example, an average value, a median value, or a mode value) of the temperatures of the plurality of smell data. The plurality of smell data may be all of the smell data used for the training data in S200 or may be the smell data designated by the user. The same similarly applies to the smell data acquired in S210.
In the present example embodiment, the case where the calculation unit 2020 acquires the temperature difference as an index has been described as an example. However, the index is not limited to the temperature difference, and may be, for example, a humidity difference or a sampling period difference.
As illustrated in
Next, the re-learning unit 2030 determines whether the index acquired in S300 satisfies the condition (
When the re-learning unit 2030 determines that the index satisfies the condition (S310; YES), the re-learning unit 2030 re-learns the prediction model using a machine learning technique (for example, a technique of stochastic optimization such as a stochastic gradient descent method) (S320). For example, in the case where the index acquired by the re-learning unit 2030 is the temperature difference “10° C.”, the re-learning unit 2030 re-learns the prediction model because the condition of the temperature difference illustrated in
Note that, in the present example embodiment, the case where the re-learning unit 2030 re-learns the prediction model has been described as an example, but the re-learning unit 2030 may newly generate a prediction model. In this case, the re-learning unit 2030 generates the prediction model using a new training data set. The new training data set is designated by the user, for example. As a designation method by the user, for example, a training data set may be directly input, a measurement date (or a measurement period) may be designated, a measurement environment may be designated, or a sampling method such as bagging may be designated.
As described above, the prediction model re-learning device 2000 according to the present example embodiment re-learns the prediction model in consideration of a characteristic that a behavior of the detection value of the sensor changes due to an influence of the measurement environment such as temperature and humidity. As a result, precision deterioration of the prediction model can be mitigated.
Hereinafter, a second example embodiment according to the present invention will be described. The second example embodiment is different from the first example embodiment in including a feature amount acquisition unit 2040 and a calculation unit 2050 that calculates an index based on an acquired feature amount. Details will be described below.
In the second example embodiment, information stored in the storage unit 2010 will be described.
Each record in
An example of a method of calculating the feature amount Fk illustrated in
A method of calculating the feature constant θ and the contribution value 4 will be described. The feature amount acquisition unit 2040 decomposes the time-series data as illustrated in the following expression (1)
In the expression (1), f is a function that differs depending on the feature constant.
When a velocity constant β is adopted as the feature constant θ, the equation (1) can be expressed as the following equation (2).
When a time constant τ that is a reciprocal of the velocity constant is adopted as the feature constant θ, the equation (1) can be expressed as the following equation (3).
A method of calculating the feature constants θ1, θ2, . . . , θn (hereinafter referred to as a set Θ) will be described. The set Θ can be determined by, for example, three parameters of (1) a minimum value θ min (that is, θ1) of the feature constant θ, (2) a maximum value θ max (that is, θn) of the feature constant θ, and (3) an interval ds between adjacent feature constants. In this case, the set Θ becomes Θ={θ min, θ min+ds, θ min+2ds, . . . , θ max}. Hereinafter, an example of a method for determining the above-described three parameters will be described.
(1) θ min
θ min is a constant multiple of a sampling interval Δt of the sensor 10. That is, θ min=Δt*C1 is satisfied where a predetermined constant is C1.
(2) θ max
θ max is a constant multiple of a length (the number of detection values) T of the time-series data y(t) acquired by the sensor 10. That is, θ max=T*C2 is satisfied where a value of 1 or larger is C2 in advance.
(3) ds
ds satisfies ds=(θ max−θ min)/(ns−1) where, for example, the number of the feature constants θ is ns.
In the case of using the velocity constant β as the feature constant, the minimum value θ min of the feature constant, the maximum value θ max of the feature constant, and the interval ds of the adjacent feature constants become the minimum value β min of the velocity constant, the maximum value β max of the velocity constant, and the interval Δβ of the adjacent velocity constant, respectively. Similarly, in the case of using the time constant τ as the feature constant, the minimum value θ min of the feature constant, the maximum value θ max of the feature constant, and the interval ds of the adjacent feature constants become the minimum value min of the time constant, the maximum value max of the time constant, and the interval Δτ of the adjacent time constant, respectively.
The feature amount acquisition unit 2040 calculates a contribution vector Ξ, which is the contribution value ξi of each feature constant θi included in the set Θ of the feature constants θ specified as described above, as the feature amount Fk. Specifically, the feature amount acquisition unit 2040 generates a detection value prediction model for predicting the detection value of the sensor 10 using the equation (1) using all the contribution values ξi (that is, the feature amount Fk, hereinafter described as “contribution vector Ξ” for the sake of description) as parameters. When generating the detection value prediction model, the contribution vector Ξ can be calculated by estimating the parameters for the contribution vector Ξ using the time-series data.
Various methods can be used for parameter estimation of the detection value prediction model. Hereinafter, an example of the method will be described. In the following description, a case where the velocity constant β is used as the feature constant is described. The parameter estimation method in the case where the time constant τ is the feature constant can be implemented by replacing the velocity constant β in the following description with 1/τ. For example, the feature amount acquisition unit 2040 estimates the parameter Ξ by maximum likelihood estimation or maximum posterior probability estimation using a prediction value obtained from the detection value prediction model and the time-series data of the detection value output from the sensor 10. Hereinafter, the case of maximum likelihood estimation will be described. For the maximum likelihood estimation, for example, a least squares method can be used. In this case, specifically, the parameter Ξ is determined according to the following objective function.
In the equation (4), y{circumflex over ( )}(ti) represents a prediction value at time ti and is determined by the detection value prediction model.
The vector Ξ that minimizes the above-described objective function can be calculated using the following equation (5).
In the equation (5), Y is a column vector obtained by transposing (y(t0), y(t1), . . . ).
Therefore, the feature amount acquisition unit 2040 calculates the parameter Ξ by applying the time-series data Y and the set Θ of feature constants={β1, β2, . . . } to the above equation (5).
Here, the meanings of “rising” and “falling” in the above equation (5) will be described. “Rising” indicates a state in which the detection value indicated by the time-series data is increasing by injecting the sample gas described in the description of the sampling period to the sensor 10. “Falling” indicates a state in which the target gas is removed from the sensor 10 by injecting the purge gas described in the description of the sampling period to the sensor 10, and the measurement value indicated by the time-series data is decreasing.
In the present example embodiment, the feature amount Fk is acquired from the “rising” time-series data and the “falling” time-series data. However, the present example embodiment is not limited thereto, and the feature amount acquisition unit 2040 may acquire the feature amount only from either the “rising” time-series data or the “falling” time-series data.
In addition, the method of acquiring the feature amount of the time-series data is not limited to the above-described method. For example, the feature amount acquisition unit 2040 may calculate the feature amount using not only the time-series data but also using the time-series data and the measurement environment. Specifically, the feature amount acquisition unit 2040 may acquire the feature amount from the time-series data and the measurement environment using a machine learning method such as a neural network.
As illustrated in
Next, the calculation unit 2050 predicts a class of the smell data using the feature amount of the smell data acquired in S500 (S510). For example, a positive class is assigned to the smell data predicted to correspond to a specific fruit type (for example, pear). A negative class is assigned to the smell data predicted not to correspond to a specific fruit type.
Next, the calculation unit 2050 calculates the separation factor of the prediction model as an index from the prediction result of each smell data (S520).
The separation factor will be described. The separation factor is expressed as, for example, a ratio of intra-class variance and inter-class variance. The intra-class variance indicates dispersion of data within a class and is represented by a sum of positive class variance and negative class variance. The inter-class variance indicates dispersion of classes in the entire data, and is calculated as a sum of the positive class variance and the negative class variance with respect to the entire data respectively multiplied by the numbers of samples of the classes. The separation factor may be directly calculated from the feature amount of the data or may be calculated from a dimensionally reduced feature amount (for example, a feature amount dimensionally reduced to a one-dimensional space).
The index calculated by the calculation unit 2050 is not limited to the separation factor that is the ratio of the intra-class variance and the inter-class variance. The calculation unit 2050 may use either the intra-class variance or the inter-class variance as an index.
In addition, the calculation unit 2050 may use the certainty factor as an index instead of the separation factor in S520.
The certainty factor will be described. For simplicity, a case where the prediction model performs binary classification will be described. The certainty factor is an index representing a degree of certainty of classification by the prediction model, and is a value obtained by a determination function as a value from 0 to 1 by, for example, a sigmoid function. At the time of learning, the prediction model is learned such that a positive class sample approaches 1 as much as possible and a negative class sample approaches 0 as much as possible. At the time of prediction, when a certainty factor larger than a threshold value (which is generally set to 0.5 in many cases) is obtained using the learned prediction model, the prediction result is output as the positive class. At this time, it can be estimated that the prediction sometimes becomes unstable as the number of data having the certainty factor near the threshold value increases, and thus, the certainty factor can be utilized as an index for re-learning.
As described above, the prediction model re-learning device 2000 according to the present example embodiment re-learns the prediction model in consideration of the feature amount of the detection value of the sensor. As a result, precision deterioration of the prediction model can be mitigated.
A modification of the second example embodiment will be described. In the modification, the feature amount acquisition unit 2040 can acquire the feature amount after correcting the influence of the measurement environment for the time-series data.
An example in which the correction unit 2060 corrects the time-series data using the correction coefficient will be described. The correction unit 2060 performs correction by multiplying the time-series data y(t) by the correction coefficient. The correction coefficient relates to, for example, an individual difference of a sensory membrane of the sensor 10. The correction coefficient is calculated in advance at the time of shipment of the sensor 10, for example, and is stored in a housing provided with the sensor 10. The correction unit 2060 corrects the time-series data y(t) by acquiring the correction coefficient from the housing provided with the sensor 10.
Hereinafter, a third example embodiment according to the present invention will be described. In the first and second example embodiments, the re-learned prediction model is stored and updated as it is in the storage unit 2010. However, for example, when a temporary error occurs in the measurement environment (for example, the humidity temporarily increases due to sudden heavy rain), there are some cases where update of the prediction model based on the index calculated using the measurement environment is not necessary.
Therefore, in the present third example embodiment, whether to update a prediction model is determined using a re-learned prediction model before updating the prediction model.
Update determination processing of the update determination unit 2070 will be described.
First, the update determination unit 2070 acquires the smell data for update determination (S700). The smell data for update determination is smell data different from the smell data used for calculating the index for determining whether to re-learn the prediction model. A specific example of the smell data for update determination will be described with reference to
The update determination unit 2070 may receive designation of a condition for one or more of the sensor ID, the measurement date and time, the measurement environment, and the object to be measured illustrated in
The description returns to the description using
Note that, here, an example of the precision index in the case where the prediction model is a determination model has been described. In the case where the prediction model is a regression model, the precision index is, for example, a determination coefficient, a mean square error, and a mean absolute error.
Next, when the precision index calculated in S710 satisfies a predetermined condition, the update determination unit 2070 stores the re-learned prediction model in the storage unit 2010 to update the prediction model (S720). The predetermined condition is, for example, whether the precision index calculated in S710 is equal to or larger than the threshold value. The threshold value of the precision index may be stored in advance in the storage unit 2010 or may be input from the user.
As described above, since the prediction model re-learning device 2000 according to the present example embodiment determines whether to update the prediction model according to the precision of the re-learned prediction model, the prediction model re-learning device 2000 can avoid unnecessary update of the prediction model.
Note that the invention of the present application is not limited to the above-described example embodiments as they are, and can be embodied by modifying the constituent elements without departing from the gist thereof at an implementation stage. Furthermore, various inventions can be formed by appropriately combining a plurality of constituent elements disclosed in the above example embodiments. For example, some constituent elements may be deleted from all the constituent elements shown in the example embodiments. Moreover, the constituent elements of different example embodiments may be appropriately combined.
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/JP2019/024338 | 6/19/2019 | WO |