A kind of blood glucose prediction method, device, terminal and storage medium
Technical field
The present embodiments relate to computer data digging technology field more particularly to a kind of blood glucose prediction method, device,
Terminal and storage medium.
Background technique
For diabetic, blood glucose level, which deviates normal range (NR), can lead to serious short-term or for a long time concurrent
Disease is also possible to lead to death when serious.Therefore, it is of great importance in terms of clinical application to the prediction of continuous blood sugar value.
The existing method for blood glucose prediction mainly includes time series analysis, neural network model, Kalman filtering
Prediction etc., but the prediction accuracy of the above method and prediction duration are to be improved.Such as: first with Kalman filtering into
Row denoising, the method for then adaptive AR madal being recycled to carry out blood glucose prediction, since AR model is focused on for predicting blood glucose value
Volume of data average value so that it reacts more blunt when blood glucose value quickly changes.In addition, AR model is to continuous blood
The prediction duration longest of sugar only has half an hour.And neural network is easily trapped into locally optimal solution in the training process, tends not to
Obtain globally optimal solution.And the parameter setting in neural network mathematically lacks stringent proof, it is explanatory weaker.This
Outside, also there is the method for carrying out blood glucose prediction using support vector regression, but this method is directed to different data sets, often exists
It has difficulties when choosing appropriate parameter.
Summary of the invention
The present invention provides a kind of blood glucose prediction method, device, terminal and storage medium, improves the accurate of blood glucose prediction
Property, while also adding the duration of blood glucose prediction.
In a first aspect, the embodiment of the invention provides a kind of blood glucose prediction methods, which comprises
Input blood glucose training data and output blood glucose training data based on target patient, return the supporting vector of initialization
Model is returned to carry out the first model training, to determine kernel function used in support vector regression model and support vector regression model
Carry out the target window value used when rolling forecast;
Based on the target window value, the second model instruction is carried out to using the support vector regression model of the kernel function
Practice, with the value of nuclear parameter in the determination kernel function, using the support vector regression model obtained after the second model training as
Target support vector regression model;
Using the target support vector regression model and the target window value, to the blood glucose of the target patient into
Row rolling forecast.
Second aspect, the embodiment of the invention also provides a kind of blood glucose prediction device, described device includes:
Kernel function and window value determining module, for input blood glucose training data and output blood glucose based on target patient
Training data carries out the first model training to the support vector regression model of initialization, to determine support vector regression model
The kernel function and support vector regression model used carries out the target window value used when rolling forecast;
Target support vector regression model determining module is based on the target window value, to using the kernel function
Support vector regression model carries out the second model training, and with the value of nuclear parameter in the determination kernel function, the second model is instructed
The support vector regression model obtained after white silk is as target support vector regression model;
Rolling forecast module, for utilizing the target support vector regression model and the target window value, to institute
The blood glucose for stating target patient carries out rolling forecast.
The third aspect, the embodiment of the invention also provides a kind of blood glucose prediction terminal, the terminal includes:
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processing
Device realizes the blood glucose prediction method as described in the embodiment of the present invention is any.
Fourth aspect, the embodiment of the invention also provides a kind of computer readable storage mediums, are stored thereon with computer
Program realizes the blood glucose prediction method as described in the embodiment of the present invention is any when the program is executed by processor.
Blood glucose prediction method, device, terminal and storage medium provided in an embodiment of the present invention, by based on target patient
Blood glucose training data and output blood glucose training data are inputted, the first model instruction is carried out to the support vector regression model of initialization
Practice, with what is used when determining that kernel function used in support vector regression model and support vector regression model carry out rolling forecast
Target window value;Based on target window value, the second model training is carried out to using the support vector regression model of kernel function,
To determine the value of nuclear parameter in kernel function;It is supported the support vector regression model obtained after the second model training as target
Vector regression model;Using target support vector regression model and target window value, the blood glucose of target patient is rolled
Prediction, improves the accuracy of blood glucose prediction, while also adding the duration of blood glucose prediction.
Detailed description of the invention
Exemplary embodiments of the present invention will be described in detail referring to the drawings by general below, makes those skilled in the art
Become apparent from above-mentioned and other feature and advantage of the invention, in attached drawing:
Fig. 1 is the flow chart of one of the embodiment of the present invention one blood glucose prediction method;
Fig. 2 a is the flow chart of one of the embodiment of the present invention two blood glucose prediction method;
Fig. 2 b is that the rolling of 30 minutes blood glucose values in continuous prediction target patient test set in the embodiment of the present invention two is pre-
Survey effect picture;
Fig. 2 c is that the rolling of 60 minutes blood glucose values in continuous prediction target patient test set in the embodiment of the present invention two is pre-
Survey effect picture;
Fig. 2 d is that the rolling of 90 minutes blood glucose values in continuous prediction target patient test set in the embodiment of the present invention two is pre-
Survey effect picture;
Fig. 2 e is the rolling of 120 minutes blood glucose values in continuous prediction target patient test set in the embodiment of the present invention two
Prediction effect figure;
Fig. 3 is the structural schematic diagram of one of embodiment of the present invention three blood glucose prediction device;
Fig. 4 is the structural schematic diagram of one of embodiment of the present invention four blood glucose prediction terminal;
Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to just
Only the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
Embodiment one
Fig. 1 is a kind of flow chart for blood glucose prediction method that the embodiment of the present invention one provides, and the present embodiment is applicable to need
The case where carrying out blood glucose prediction to target patient, this method can be executed by a kind of blood glucose prediction device, wherein the device
It can be implemented by software and/or hardware.As shown in Figure 1, this method specifically includes:
S110, the input blood glucose training data based on target patient and output blood glucose training data, the support to initialization
Vector regression model carries out the first model training, to determine that kernel function used in support vector regression model and supporting vector are returned
The target window value for returning model to use when carrying out rolling forecast.
The blood glucose value of the prediction of continuous blood sugar value mainly research diabetic changes with time and according to foundation
Prediction model predicts the changing rule in blood glucose value future.What the forecasting problem of continuous blood sugar value needed to predict is this moment
Temporal correlation between blood glucose value and the blood glucose value at lower a moment.Support vector regression model is evolved by support vector machines
For recurrence machine learning model, due to the model have preferable estimated performance, and the derivation process of the model be
Solve Lagrange duality non trivial solution in convex set, be a double optimization problem, the solution obtained using the model for it is global most
Excellent solution, it is therefore preferable that can be predicted using support vector regression model continuous blood sugar value.Utilize support vector regression mould
Type predicts continuous blood sugar value, is fitted using the temporal correlation of the measurement blood glucose level data concentration of target patient
Then a prediction model out carries out forecast analysis to the blood glucose value in a period of time after target patient with prediction model.
Since support vector regression model has preferable feasibility and adaptability in terms of small data set prediction,
It preferably can use the support vector regression model based on rolling forecast in the present embodiment to predict the blood glucose of target patient,
Rolling forecast is carried out using blood glucose of the support vector regression model to target patient.Wherein, rolling forecast is a kind of effective benefit
With the prediction technique of conception of history measured data, constantly can go to predict again as historical data using for the predicted value of observation
New data point.Window value is the number of the historical data for once being predicted during rolling forecast.Target window
Mouth value is related with the blood glucose level data of target patient, and different target patients may correspond to different target window values.Example
Property: the detailed process predicted to a data point in continuous blood sugar time series using the method for rolling forecast can be with
Be: assuming that sharing n data point in original time series, the target window value of rolling forecast (utilizes every 20 for 20
Data point trains a support vector regression model to go to predict the size of next data point).With time series { X1,X2,X3,
X4,X5...X20It is given data to predict X21Size, with time series { X2,X3,X4,X5,X6,...X21It is given data
To predict X22Size, and so on: with { Xn-19,Xn-18,Xn-17,Xn-16...Xn-1,XnIt is given data to predict Xn+1's
Size.
Wherein, when the input space is mapped to high-dimensional feature space by certain nonlinear transformation by support vector machines, exist
Some function in the low-dimensional input space is equal to the inner product in higher dimensional space, then such function is kernel function.Support to
It measures in regression model, it is not necessary that input vector is mapped to high-dimensional feature space, as long as calculating feature sky using kernel function
Between in dot product, i.e., all necessary calculating can implicitly execute in the input space, without being transported in feature
It calculates, greatly reduces the complexity of calculating.Wherein, kernel function may include linear kernel function, Polynomial kernel function, Gaussian kernel letter
Number, sigmoid kernel function and Radial basis kernel function etc..
In the present embodiment, the historical glucose data of target patient can be divided into input blood glucose training data and output blood
Sugared training data, using input blood glucose training data and export blood glucose training data to the support vector regression model of initialization into
The first model training of row.Specifically, will input blood glucose training data as the input of support vector regression model, obtain supporting to
The output of regression model is measured, and using output blood glucose training data as reference standard, it is continuous to adjust support vector regression mould
Parameter in type, until the corresponding output of input blood glucose training data can be fitted output blood glucose training data to greatest extent,
Wherein, the parameter in support vector regression model includes the type and target window value of kernel function.It preferably, can be preparatory
Preset difference value range is set, which can set based on experience value, when the corresponding output of input blood glucose training data
When difference between output blood glucose training data is within the scope of preset difference value, stop the ginseng of adjustment support vector regression model
Number.
In above-mentioned training process, in order to determine suitable kernel function type in numerous kernel function types, preferably may be used
To initialize the nuclear parameter of each kernel function using empirical value, the change relevant to kernel function during model training is levied to protect
Amount is only the type of kernel function.In addition, can preferably preset window for the determining target window value to match with target patient
The range intervals of mouth value, to determine target window value from the range intervals.
S120, it is based on target window value, carries out the second model training to using the support vector regression model of kernel function,
To determine the value of nuclear parameter in kernel function, supported the support vector regression model obtained after the second model training as target
Vector regression model.
It is above-mentioned for the ease of determine kernel function type, using empirical value by the nuclear parameter determinization of each kernel function, but
It is to be not necessarily suitable for each patient using the kernel function that empirical value determines.In order to guarantee the standard of target patient blood glucose prediction
True property preferably can use the input blood glucose of target patient after the type of above-mentioned determining target window value and kernel function
Training data and output blood glucose training data carry out the second mould to the support vector regression model for having had determined kernel function type
Type training, it has been determined that the value with the matched nuclear parameter of target patient.Wherein, the training process of the second model training and the first mould
The training process of type training is roughly the same, and the main distinction is: during the first model training, nuclear parameter is determining value, mesh
The type for marking window value and kernel function is adjustable, and during the second model training, the type of target window value and kernel function
It determines, nuclear parameter is adjustable.Finally using the support vector regression model obtained after the completion of the second model training as target support to
Measure regression model.
S130, using target support vector regression model and target window value, the blood glucose of target patient is rolled
Prediction.
After the target window value of target support vector regression model and rolling forecast has been determined, target can be suffered from
The blood glucose of person carries out rolling forecast.Since the nuclear parameter of target support vector regression model Kernel Function is according to target patient
What input blood glucose training data and output blood glucose training data training obtained, the individualized feature with target patient, and be used for
The target window value of rolling forecast is also the input blood glucose training data and output blood glucose training data training by target patient
It obtains, the same individualized feature with target patient, therefore, using above-mentioned target support vector regression model and rolls pre-
The target window value of survey can largely improve the blood glucose prediction accuracy rate of target patient.Although in addition, rolling forecast
The error of algorithm will continue to accumulate, and with increasing (i.e. the passage of time) for predicted number, error can reach default prediction error
Threshold value, but the blood glucose prediction accuracy rate due to being integrally improved target patient, blood can also be increased to a certain extent
The number of sugar prediction, that is, increase the duration of blood glucose prediction.
It is illustrative: after target support vector regression model and target window has been determined, to utilize rolling forecast method
The detailed process predicted a data point in continuous blood sugar time series, which may is that, to be assumed in original time series
Share n data point, (i.e. every 20 data points train a support vector regression model for 20 for the window size of rolling forecast
Go to predict the size of next data point).With time series { X1,X2,X3,X4,X5...X20It is given data to predict X21's
Size is expressed as PX21, with time series { X2,X3,X4,X5,X6,...X21It is given data to predict X22Size, be expressed as
PX22, and so on: with { Xn-19,Xn-18,Xn-17,Xn-16...Xn-1,XnIt is given data to predict Xn+1Size, be expressed as
PXn+1.When the detailed process predicted for continuous five data points in continuous blood sugar time series may is that hypothesis is former
Between n data point is shared in sequence, and the window size of rolling forecast is still 20.With time series { X1,X2,X3,X4,
X5...X20It is five data point X that given data carrys out forecasting sequence sequence21,X22,X23,X24,X25Size, be expressed as PX21,
PX22,PX23,PX24,PX25, and the prediction of this five data points carries out respectively: 1. with preceding 20 points { X in time series1,
X2,X3,X4,X5...X20Go to predict X21Size, be expressed as PX21;2. with { X2,X3,X4,X5,X6...X20,PX21Go to predict
X22Size, be expressed as PX22;3. with { X3,X4,X5,X6...,X20,PX21,PX22Remove prediction X23Size, be expressed as PX23;④
With { X4,X5,X6...X20,PX21,PX22,PX23Remove prediction X24Size, be expressed as PX24;5. with { X5,X6...X20,PX21,PX22,
PX23,PX24Remove prediction X25Size, be expressed as PX25.Similarly, it can use support vector regression model rolling forecast continuous ten
The data points such as a, continuous 15, continuous 20.
Blood glucose prediction method provided in this embodiment passes through input blood glucose training data and output blood based on target patient
Sugared training data carries out the first model training to the support vector regression model of initialization, to determine support vector regression model
Used kernel function and support vector regression model carry out the target window value used when rolling forecast;Based on target window
Value carries out the second model training to using the support vector regression model of kernel function, to determine taking for nuclear parameter in kernel function
Value;Using the support vector regression model obtained after the second model training as target support vector regression model;Utilize target branch
Vector regression model and target window value are held, rolling forecast is carried out to the blood glucose of target patient, improves the standard of blood glucose prediction
True property, while also adding the duration of blood glucose prediction.
On the basis of the various embodiments described above, further, in input blood glucose training data based on target patient and defeated
Blood glucose training data out carries out the first model training to the support vector regression model of initialization, to determine support vector regression
Before kernel function used in model and support vector regression model carry out the target window value used when rolling forecast, also
Include:
The original blood glucose training data of target patient is pre-processed, input blood glucose training data is obtained and exports blood glucose
Training data, wherein pretreatment includes that data cleansing processing and smooth denoising are carried out to original blood glucose training data.
Data cleansing processing preferably is carried out to original blood glucose training data, comprising:
It whether is that preset time is poor according to the time difference between two neighboring original blood glucose training data, it is original to determine
The continuity of blood glucose training data in time;If it is determined that original blood glucose training data is discontinuous in time, then:
If it is determined that the number for the data point that original blood glucose training data is omitted in time is lower than preset number, then mesh is utilized
The routine information of mark patient extrapolates data point;
If it is determined that the number for the data point that original blood glucose training data is omitted in time is equal to or higher than preset number, then
, as node, original blood glucose training data is divided into multiple blood glucose training datas continuous in time at each interruption.
It wherein, whether is being preset time difference according to the time difference between two neighboring original blood glucose training data
Before, the time of original blood glucose training data is carried out unification by the timestamp that can use in original blood glucose training data.Wherein, when
Between stab and can be stored in the form of character string (unit is the second) in original blood glucose training data.Preferably, the time can be passed through
Timestamp is uniformly converted to Beijing time expression by stamp transfer function.
In general, it is 3 minutes a length of when measurement between the two neighboring original blood glucose training data of target patient, i.e., it is default
Time difference preferably can be 3 minutes, and certainly, preset time difference is also possible to other periods, not do special restriction herein.
It is illustrated so that preset time difference is 3 minutes as an example: determining that every two is adjacent in original blood glucose training data first
Original blood glucose training data between time difference the case where whether being 3 minutes, be not 3 minutes if there is time difference,
It can then determine that original blood glucose training data is discontinuous in time.If determining original blood glucose training according to time difference
The data for the data point that data are omitted in time are lower than preset number, then the routine information that can use target patient is extrapolated
The data point of omission, wherein preset number can be 3, and the routine information of target patient can be from target patient and participate in blood
The time point of sugared data collection, the information such as time of getting up of target patient, sleeping time, working time, meal time.Such as
Fruit determines that the data of data point that original blood glucose training data is omitted in time are equal to or higher than present count according to time difference
Mesh, at this time since the data point of omission is excessive, the confidence level of the blood glucose level data speculated using routine information is lower.Base
It, can be, as node, original blood glucose training data be divided into multiple blood glucose training continuous in time at each interruption in this
Data, using multistage in time continuous blood glucose training data as original blood glucose training data.
Preferably, smoothing denoising processing is carried out to original blood glucose training data, comprising:
To in Kalman filtering algorithm tuner parameters Q and tuner parameters R initialize;
Tuner parameters Q and tuner parameters R is adjusted, so that using the blood glucose training number after Kalman filtering algorithm smoothing denoising
It is lower than default root-mean-square error according to the root-mean-square error between original blood glucose training data, and flat using Kalman filtering algorithm
The points that blood glucose training data after sliding denoising is lagged relative to original blood glucose training data lag points lower than default.
Wherein, Kalman filtering algorithm can preferably remove the high-frequency noise that original blood glucose training data is concentrated, thus
Obtain the more reasonable smoothed data of value.Kalman filtering algorithm needs the continuous estimated value and measurement for updating different moments
Value, to obtain the best estimate of the state variable at corresponding moment.According to its tune of the basic principle of Kalman filtering algorithm
Humorous parameter Q and tuner parameters R can also make smoothed out blood glucose while improving the flatness of original blood glucose training dataset
Training data lags behind original blood glucose training data.Wherein, the value of Q/R is bigger, and smoothed out original blood glucose training data is put down
Slip is poorer, but compared with original blood glucose training data, and real-time is preferably (degree lagged is smaller).Q/R is smaller, after smooth
Original blood glucose training data flatness it is better, but compared with original blood glucose training data, the poor (degree lagged of real-time
It is larger).Based on this, need to comprehensively consider joining because usually determining tuner parameters Q and tuning for two aspects of flatness and real-time
The value of number R.
Preferably, first can rule of thumb data, to the tuner parameters Q and tuner parameters R in Kalman filtering algorithm
It is initialized, i.e., gives mono- initial value of tuner parameters Q and tuner parameters R respectively.
It is (i.e. smooth compared to the accuracy of original blood glucose training data in order to measure smoothed out original blood glucose training data
The quality of property), it can preferably define root-mean-square error (Root Mean Square Error, RMSE).The meter of root-mean-square error
Calculation mode can be the quadratic sum and data amount check of original blood glucose training data and smoothed out original blood glucose training data deviation
The square root (dimension are as follows: mmol/L) of ratio, expression formula is as follows:
Wherein, XfIt is one-dimensional vector with X, respectively represents smoothed out original blood glucose training data and the training of original blood glucose
Data, Xf,iIt is i-th of smoothed out original blood glucose training data, XiIt is i-th of original blood glucose training data.Adjust separately tune
The value of humorous parameter Q and tuner parameters R, the value of obtained RMSE is smaller, then smoothed out original blood glucose training data is compared to original
Beginning blood glucose training data is more accurate, i.e., real-time of the smoothed out original blood glucose training data compared to original blood glucose training data
Better, flatness is more unobvious.
It, can be with 480 original blood glucose training datas in one day meanwhile in order to measure the real-time of Kalman filtering algorithm
On the basis of maximum value (wave crest) in point (obtaining every one data point of measurement in 3 minutes), smoothed out original blood glucose is calculated
Training data is compared with original blood glucose training data, the number of the data point of lag.Adjust separately tuner parameters Q and tuner parameters
The data points of the value of R, obtained lag are fewer, then smoothed out original blood glucose training data is compared to original blood glucose training number
According to real-time it is preferable, i.e. the time delay of Kalman filtering algorithm is smaller.
When choosing the value of suitable tuner parameters Q and tuner parameters R, due to needing to comprehensively consider flatness and real-time
Therefore default root-mean-square error and default lag points can be set, in adjustment tuner parameters Q and tune in the factor of two aspects
During humorous parameter R, the tuner parameters Q and tuner parameters R that meet preset condition are chosen as target tuner parameters Q and target
Tuner parameters R.Wherein, preset condition is using the smoothed out original blood glucose training data of Kalman filtering algorithm and original blood glucose
Root-mean-square error between training data is lower than default root-mean-square error, and using the blood after Kalman filtering algorithm smoothing denoising
Sugared training data is counted relative to the points that original blood glucose training data lags lower than default lag.
Illustratively, it is flat to verify Kalman filter to select five groups of different tuner parameters Q and tuner parameters R value
The effect of sliding original blood glucose training data.In each group of experiment, the value of tuner parameters Q is 1 × 10-4, tuner parameters R's
Value is respectively as follows: 5 × 10-2, 1 × 10-2, 5 × 10-3, 1 × 10-3, 1 × 10-4, calculate separately each group of tuner parameters Q and tuning
The root-mean-square error of filtered original blood glucose training data and original blood glucose training data under parameter R value, and choose minimum
The value of root-mean-square error corresponding tuner parameters Q and tuner parameters R.Using the Kalman filter determined to target patient one
It original blood glucose training data (480) is filtered.
Embodiment two
Fig. 2 a is a kind of flow chart of blood glucose prediction method provided by Embodiment 2 of the present invention.The present embodiment is in above-mentioned each reality
On the basis of applying example, by the input blood glucose training data based on target patient and output blood glucose training data, to initialization
Support vector regression model carry out the first model training, to determine kernel function used in support vector regression model and support
Vector regression model carries out the target window value used when rolling forecast, advanced optimizes are as follows: obtain each support vector regression
Model, wherein each support vector regression model respectively corresponds different types of kernel function;For each support vector regression
Model: keeping the nuclear parameter in the support vector regression model constant, traverses the window value in preset group;For each
Input blood glucose training data with the window value corresponding number is input to the support vector regression model by window value
In, and prediction blood glucose level data is exported, calculate the prediction blood glucose level data and first exported between blood glucose training data
Square error;Determine that kernel function corresponding to the smallest first root-mean-square error of value and window take in each first root-mean-square error
Value.Described it will be based on the target window value, and carry out the second model to using the support vector regression model of the kernel function
Training, with the value of nuclear parameter in the determination kernel function;The support vector regression model obtained after second model training is made
It for target support vector regression model, advanced optimizes are as follows: determine corresponding with kernel function penalty factor nuclear parameter and not
All valued combinations of sensitive factor nuclear parameter;It calculates under each valued combinations, the support vector regression model adjusted
The second root-mean-square error between output prediction blood glucose level data and the output blood glucose training data;By each second root-mean-square error
Valued combinations corresponding to middle the smallest second root-mean-square error of value are joined as the core of the target support vector regression model
Number, to obtain target support vector regression model.As shown in Fig. 2, this method specifically includes:
S210, each support vector regression model is obtained, wherein each support vector regression model respectively corresponds different types of
Kernel function.
In the present embodiment, by different types of kernel function assign initialization support vector regression model, obtain from it is different
The corresponding each support vector regression model of the kernel function of type.Wherein, different kernel functions may include linear kernel function, it is more
Item formula kernel function, gaussian kernel function, sigmoid kernel function and Radial basis kernel function etc..
S220, it is directed to each support vector regression model: keeping the nuclear parameter in support vector regression model constant, traversal
Window value in preset group.
S230, it is directed to each window value, the input blood glucose training data with window value corresponding number is input to branch
It holds in vector regression model, and exports prediction blood glucose level data, calculate between prediction blood glucose level data and output blood glucose training data
First root-mean-square error.
Wherein, preset group is the integer number of the preset one each possible window value for including rolling forecast
Group.Such as preset group can be [5,180], the window value of the array representation rolling forecast can be between 5 to 180 (packet
Containing 5 and any one integer 180), i.e., the value for predicting next data point can be at least gone with 5 data points, at most may be used
Go to predict the value of next data point with 180 data points.
For each support vector regression model corresponding with specific kernel function type, the support vector regression mould is kept
The nuclear parameter of kernel function in type is constant, that is, initializes the nuclear parameter of the kernel function.For example, for corresponding with linear kernel function
Support vector regression model, initialize the nuclear parameter of linear kernel function in the support vector regression model, but for it is multinomial
The corresponding support vector regression model of formula kernel function initializes the core ginseng of Polynomial kernel function in the support vector regression model
Number etc..For each support vector regression model, keep the nuclear parameter of the kernel function in support vector regression model constant, traversal
Window value in preset group traverses the window in preset group that is, in the case where determining each support vector regression model
Mouth value.
For each window value, using to the input blood glucose training data of window value corresponding number as it is corresponding support to
The input of regression model, output prediction blood glucose level data are measured, and is calculated between prediction blood glucose level data and output blood glucose training data
First root-mean-square error.Wherein, the expression formula of the first root-mean-square error is as follows:
Wherein, yp,kIt is k-th of prediction blood glucose level data, ykIt is k-th of output blood glucose training data.
S240, kernel function and window corresponding to the smallest first root-mean-square error of value in each first root-mean-square error are determined
Mouth value.
Preferably, for each support vector regression model corresponding with specific kernel function type and each window value and
Speech, can determine kernel function corresponding with target patient and window value by the size of the first root-mean-square error.It is preferred that
, it can will kernel function corresponding with the smallest first root-mean-square error of value in each first root-mean-square error and window value
As finally kernel function corresponding with target patient and window value.
All value groups of S250, determination penalty factor nuclear parameter corresponding with kernel function and insensitive factor nuclear parameter
It closes.
S260, calculate under each valued combinations, the output prediction blood glucose level data of support vector regression model adjusted with it is defeated
The second root-mean-square error between blood glucose training data out.
S270, using valued combinations corresponding to the smallest second root-mean-square error of value in each second root-mean-square error as
The nuclear parameter of target support vector regression model, to obtain target support vector regression model.
Wherein, the nuclear parameter of kernel function may include penalty factor nuclear parameter and insensitive factor nuclear parameter.Above-mentioned true
After determining kernel function and window value, the penalty factor core in kernel function can be preferably adjusted according to the blood glucose level data of target patient
Parameter and insensitive factor nuclear parameter.
Specifically, rule of thumb corresponding with kernel function penalty factor nuclear parameter and insensitive because of daughter nucleus can be determined data
All valued combinations of parameter, and calculate under each valued combinations, blood glucose is predicted in the output of support vector regression model adjusted
The second root-mean-square error between data and output blood glucose training data, and value in each second root-mean-square error is the smallest by the
Nuclear parameter of the valued combinations of nuclear parameter corresponding to two root-mean-square errors as target support vector regression model, to obtain mesh
Mark support vector regression model.Wherein, the expression formula of the second root-mean-square error is as follows:
Wherein, yp,kIt is k-th of output prediction blood glucose level data adjusted, ykIt is k-th of output blood glucose training data.
Illustratively, the possibility value of penalty factor nuclear parameter and insensitive factor nuclear parameter can be expressed as following two
A array: [0.01,0.1,0.3,1,10,30,100] and [0.001,0.003,0.01,0.03,0.1].Calculate separately each ginseng
Second root-mean-square error of output prediction blood glucose level data and output blood glucose training data under several valued combinations.Select lowest mean square
Nuclear parameter of the combination of the corresponding nuclear parameter of root error as support vector regression model, it is final to determine target support vector regression
Model.
S280, using target support vector regression model and target window value, the blood glucose of target patient is rolled
Prediction.
Blood glucose prediction method provided in this embodiment obtains each support vector regression on the basis of the various embodiments described above
Model keeps the nuclear parameter in support vector regression model constant for each support vector regression model, traverses preset group
In window value;For each window value, the input blood glucose training data with window value corresponding number is input to branch
It holds in vector regression model, and exports prediction blood glucose level data, calculate between prediction blood glucose level data and output blood glucose training data
First root-mean-square error;Determine in each first root-mean-square error kernel function corresponding to the smallest first root-mean-square error of value and
Window value determines all valued combinations of corresponding with kernel function penalty factor nuclear parameter and insensitive factor nuclear parameter;Meter
Calculate under each valued combinations, the output of support vector regression model adjusted prediction blood glucose level data and output blood glucose training data it
Between the second root-mean-square error;By value group corresponding to the smallest second root-mean-square error of value in each second root-mean-square error
Cooperation is that the nuclear parameter of target support vector regression model further improves blood to obtain target support vector regression model
The accuracy of sugar prediction, while also adding the duration of blood glucose prediction.
On the basis of the various embodiments described above, further, it is being based on target window value, to the support using kernel function
Vector regression model carries out the second model training, to determine the value of nuclear parameter in kernel function;It will be obtained after second model training
Support vector regression model as target support vector regression model after, further includes:
Input blood sugar test data, output blood sugar test data and target window value based on target patient, to target
Support vector regression model is tested, to determine the rolling forecast effect of target support vector regression model.
Wherein, the original continuous blood glucose level data collection of target patient can divide four kinds of data: input blood glucose training data, defeated
Blood glucose training data, input blood sugar test data, output blood sugar test data out.These four data are taken due to rolling forecast window
Value it is different and different, input blood glucose training data and input blood sugar test data each record length be equal to
Rolling forecast window value, the output blood glucose training number obtained respectively by input blood glucose training data and input blood sugar test data
All it is a vector according to each record with output blood sugar test data, particularly, when predicting a data point, exports blood
Sugared training data and each record for exporting blood sugar test data are all a real numbers.
It, can input blood sugar test data, output blood sugar test data and target based on target patient in the present embodiment
Window value tests target support vector regression model, to determine the rolling forecast of target support vector regression model
Effect.Specifically, during the test, being based on target window value, target patient has been inputted to blood glucose level data input accordingly
In trained good target support vector regression model, by comparing the output and target patient of target support vector regression model
Output blood sugar test data root-mean-square error size, to determine the superiority and inferiority of target support vector regression model.
During the test, in order to improve the fairness of algorithm, target preferably can be continuously predicted in different time sections
The blood glucose value of patient.Specific: the data augmentation that preferably will can be used to predict reserves 480 data to one day range
Point is used as test set, and blood glucose level data in addition to this is as training set.It can continuously predict 15 minutes blood glucose value (five data
Point), 30 minutes blood glucose values (10 data points), 60 minutes blood glucose values (20 data points), 90 minutes blood glucose value (30 data
Point) and 120 minutes blood glucose values (40 data points) etc..
It should be noted that error can be generated by carrying out rolling forecast using rolling forecast algorithm, and error can be continuous
Accumulation, therefore the error between future position and actual data point is greater than needs when presetting precision of prediction and stops prediction.Assuming that mesh
Marking the time interval between the every two blood glucose level data of patient is 3 minutes, and the supporting vector based on rolling forecast can be used and return
Model is returned to remove continuously to predict 30 minutes blood glucose values (10 data points), 60 minutes blood glucose value (20 numbers in target patient test set
Strong point), 90 minutes blood glucose values (30 data points), 120 minutes blood glucose values (40 data points), then rolling forecast effect picture distinguish
As shown in Fig. 2 b, 2c, 2d, 2e, wherein the solid line in dotted line expression output blood sugar test data, figure in figure indicates output blood
Sugared prediction data.By above-mentioned Fig. 2 b, 2c, 2d, 2e it is found that prediction data point increases at any time, the error of rolling forecast result
It can increase with it.
Embodiment three
Fig. 3 is a kind of structural schematic diagram for blood glucose prediction device that the embodiment of the present invention three provides.As shown in figure 3, the dress
It sets and includes:
Kernel function and window value determining module 310, for based on target patient input blood glucose training data and output
Blood glucose training data carries out the first model training to the support vector regression model of initialization, to determine support vector regression mould
Kernel function used in type and support vector regression model carry out the target window value used when rolling forecast;
Target support vector regression model determining module 320, be based on target window value, to using kernel function support to
It measures regression model and carries out the second model training, to determine the value of nuclear parameter in kernel function, by what is obtained after the second model training
Support vector regression model is as target support vector regression model;
Rolling forecast module 330, for utilizing target support vector regression model and target window value, to target patient
Blood glucose carry out rolling forecast.
Blood glucose prediction device provided in this embodiment passes through input blood glucose training data and output blood based on target patient
Sugared training data carries out the first model training to the support vector regression model of initialization, to determine support vector regression model
Used kernel function and support vector regression model carry out the target window value used when rolling forecast;Based on target window
Value carries out the second model training to using the support vector regression model of kernel function, to determine taking for nuclear parameter in kernel function
Value;Using the support vector regression model obtained after the second model training as target support vector regression model;Utilize target branch
Vector regression model and target window value are held, rolling forecast is carried out to the blood glucose of target patient, improves the standard of blood glucose prediction
True property, while also adding the duration of blood glucose prediction.
On the basis of the various embodiments described above, further, kernel function specifically can wrap with window value determining module 310
It includes:
Each support vector regression model acquiring unit, for obtaining each support vector regression model, wherein each supporting vector
Regression model respectively corresponds different types of kernel function;
Window value Traversal Unit, for being directed to each support vector regression model: keeping in support vector regression model
Nuclear parameter it is constant, traverse preset group in window value;
First root-mean-square error computing unit will be defeated with window value corresponding number for being directed to each window value
Enter blood glucose training data to be input in support vector regression model, and export prediction blood glucose level data, calculate prediction blood glucose level data with
Export the first root-mean-square error between blood glucose training data;
Kernel function and window value determination unit, for determining, value the smallest first is square in each first root-mean-square error
Kernel function corresponding to root error and window value.
Further, target support vector regression model determining module 320 can specifically include:
Nuclear parameter determination unit, for determining penalty factor nuclear parameter corresponding with kernel function and insensitive factor nuclear parameter
All valued combinations;
Second root-mean-square error computing unit, for calculating under each valued combinations, support vector regression model adjusted
Output prediction blood glucose level data and export blood glucose training data between the second root-mean-square error;
Target support vector regression model acquiring unit, for value the smallest second in each second root-mean-square error is equal
Nuclear parameter of the valued combinations corresponding to square error as target support vector regression model is returned with obtaining target supporting vector
Return model.
Further, blood glucose prediction device can also include:
Target support vector regression model measurement module, for being based on target window value, to the branch using kernel function
It holds vector regression model and carries out the second model training, to determine the value of nuclear parameter in kernel function;It will be obtained after second model training
After the support vector regression model arrived is as target support vector regression model, the input blood sugar test number based on target patient
According to, output blood sugar test data and target window value, target support vector regression model is tested, to determine target branch
Hold the rolling forecast effect of vector regression model.
Further, blood glucose prediction device can also include:
Preprocessing module, for based on target patient input blood glucose training data and output blood glucose training data, it is right
The support vector regression model of initialization carries out the first model training, to determine kernel function used in support vector regression model
Before the target window value used when carrying out rolling forecast with support vector regression model, to the original blood glucose of target patient
Training data is pre-processed, and is obtained input blood glucose training data and is exported blood glucose training data, wherein pretreatment includes to original
Beginning blood glucose training data carries out data cleansing processing and smooth denoising.
Further, preprocessing module can specifically include:
Data cleansing processing unit, for according to the time difference between two neighboring original blood glucose training data whether be
Preset time is poor, to determine the continuity of original blood glucose training data in time;If it is determined that original blood glucose training data when
Between it is upper discontinuous, then:
If it is determined that the number for the data point that original blood glucose training data is omitted in time is lower than preset number, then mesh is utilized
The routine information of mark patient extrapolates data point;
If it is determined that the number for the data point that original blood glucose training data is omitted in time is equal to or higher than preset number, then
, as node, original blood glucose training data is divided into multiple blood glucose training datas continuous in time at each interruption.
Further, preprocessing module specifically can also include:
Smoothing denoising processing unit, for in Kalman filtering algorithm tuner parameters Q and tuner parameters R carry out it is initial
Change;
Tuner parameters Q and tuner parameters R is adjusted, so that using the blood glucose training number after Kalman filtering algorithm smoothing denoising
It is lower than default root-mean-square error according to the root-mean-square error between original blood glucose training data, and flat using Kalman filtering algorithm
The points that blood glucose training data after sliding denoising is lagged relative to original blood glucose training data lag points lower than default.
It is pre- that blood glucose provided by any embodiment of the invention can be performed in blood glucose prediction device provided by the embodiment of the present invention
Survey method has the corresponding functional module of execution method and beneficial effect.
Example IV
Fig. 4 is the structural schematic diagram for the blood glucose prediction terminal that the embodiment of the present invention four provides.Fig. 4, which is shown, to be suitable for being used in fact
The block diagram of the exemplary blood glucose prediction terminal 412 of existing embodiment of the present invention.The blood glucose prediction terminal 412 that Fig. 4 is shown is only
One example, should not function to the embodiment of the present invention and use scope bring any restrictions.
As shown in figure 4, blood glucose prediction terminal 412 is showed in the form of universal computing device.The group of blood glucose prediction terminal 412
Part can include but is not limited to: one or more processor 416, memory 428, connect (including the storage of different system components
Device 428 and processor 416) bus 418.
Bus 418 indicates one of a few class bus structures or a variety of, including memory bus or Memory Controller,
Peripheral bus, graphics acceleration port, processor or the local bus using any bus structures in a variety of bus structures.It lifts
For example, these architectures include but is not limited to industry standard architecture (ISA) bus, microchannel architecture (MAC)
Bus, enhanced isa bus, Video Electronics Standards Association (VESA) local bus and peripheral component interconnection (PCI) bus.
Blood glucose prediction terminal 412 typically comprises a variety of computer system readable media.These media can be any energy
Enough usable mediums accessed by blood glucose prediction terminal 412, including volatile and non-volatile media, it is moveable and irremovable
Medium.
Memory 428 may include the computer system readable media of form of volatile memory, such as arbitrary access is deposited
Reservoir (RAM) 430 and/or cache memory 432.Blood glucose prediction terminal 412 may further include it is other it is removable/no
Movably, volatile/non-volatile computer system storage medium.Only as an example, storage device 434 can be used for reading and writing
Immovable, non-volatile magnetic media (Fig. 4 do not show, commonly referred to as " hard disk drive ").Although not shown in fig 4, may be used
To provide the disc driver for reading and writing to removable non-volatile magnetic disk (such as " floppy disk "), and it is non-volatile to moving
Property CD (such as CD-ROM, DVD-ROM or other optical mediums) read and write CD drive.In these cases, each drive
Dynamic device can be connected by one or more data media interfaces with bus 418.Memory 428 may include at least one journey
Sequence product, the program product have one group of (for example, at least one) program module, these program modules are configured to perform this hair
The function of bright each embodiment.
Program/utility 440 with one group of (at least one) program module 442, can store in such as memory
In 428, such program module 442 includes but is not limited to operating system, one or more application program, other program modules
And program data, it may include the realization of network environment in each of these examples or certain combination.Program module 442
Usually execute the function and/or method in embodiment described in the invention.
Blood glucose prediction terminal 412 can also be with one or more external equipments 414 (such as keyboard, sensing equipment, display
424 etc., wherein display 424 can decide whether to configure according to actual needs) it communicates, can also to use with one or more
The communication of equipment that family can be interacted with the blood glucose prediction terminal 412, and/or with enable the blood glucose prediction terminal 412 and one or
A number of other any equipment (such as network interface card, modem etc.) communications for calculating equipment and being communicated.This communication can be with
It is carried out by input/output (I/O) interface 422.Also, blood glucose prediction terminal 412 can also pass through network adapter 420 and one
A or multiple networks (such as local area network (LAN), wide area network (WAN) and/or public network, such as internet) communication.Such as figure
Shown, network adapter 420 is communicated by bus 418 with other modules of blood glucose prediction terminal 412.Although should be understood that Fig. 4
In be not shown, can in conjunction with blood glucose prediction terminal 412 use other hardware and/or software module, including but not limited to: micro- generation
Code, device driver, redundant processing unit, external disk drive array, RAID system, tape drive and data backup are deposited
Storage device etc..
The program that processor 416 is stored in memory 428 by operation, thereby executing various function application and data
Processing, such as realize blood glucose prediction method provided by the embodiment of the present invention.
Embodiment five
The embodiment of the present invention five provides a kind of computer readable storage medium, is stored thereon with computer program, the journey
The blood glucose prediction method as provided by the embodiment of the present invention is realized when sequence is executed by processor, comprising:
Input blood glucose training data and output blood glucose training data based on target patient, return the supporting vector of initialization
Model is returned to carry out the first model training, to determine kernel function used in support vector regression model and support vector regression model
Carry out the target window value used when rolling forecast;
Based on target window value, the second model training is carried out to using the support vector regression model of kernel function, with true
The value for determining nuclear parameter in kernel function, using the support vector regression model obtained after the second model training as target supporting vector
Regression model;
Using target support vector regression model and target window value, rolling forecast is carried out to the blood glucose of target patient.
Certainly, computer readable storage medium provided by the embodiment of the present invention, the computer program stored thereon are unlimited
In executing method as described above operation, can also be performed provided by any embodiment of the invention based on blood glucose prediction terminal
Relevant operation in blood glucose prediction method.
The computer storage medium of the embodiment of the present invention, can be using any of one or more computer-readable media
Combination.Computer-readable medium can be computer-readable signal media or computer readable storage medium.It is computer-readable
Storage medium for example may be-but not limited to-the system of electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, device or
Device, or any above combination.The more specific example (non exhaustive list) of computer readable storage medium includes: tool
There are electrical connection, the portable computer diskette, hard disk, random access memory (RAM), read-only memory of one or more conducting wires
(ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-
ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.In this document, computer-readable storage
Medium can be any tangible medium for including or store program, which can be commanded execution system, device or device
Using or it is in connection.
Computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal,
Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited
In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can
Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for
By the use of instruction execution system, device or device or program in connection.
The program code for including on computer-readable medium can transmit with any suitable medium, including --- but it is unlimited
In wireless, electric wire, optical cable, RF etc. or above-mentioned any appropriate combination.
The computer for executing operation of the present invention can be write with one or more programming languages or combinations thereof
Program code, described program design language include object oriented program language-such as Java, Smalltalk, C++,
Further include conventional procedural programming language-such as " C " language or similar programming language.Program code can be with
It fully executes, partly execute on the user computer on the user computer, being executed as an independent software package, portion
Divide and partially executes or executed on a remote computer or server completely on the remote computer on the user computer.?
Be related in the situation of remote computer, remote computer can pass through the network of any kind --- including local area network (LAN) or
Wide area network (WAN)-be connected to subscriber computer, or, it may be connected to outer computer (such as mentioned using Internet service
It is connected for quotient by internet).
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that
The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation,
It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention
It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also
It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.