It is a kind of to can be used in prediction and drink water the method and system of time
Technical field
The invention belongs to Intelligent water cup technical field more particularly to it is a kind of can be used in prediction drink water the time method and be
System.
Background technique
With the high speed development of human society, be busy with one's work, affairs it is various, cause crowd to health ignorance it is more and more tighter
Weight, does not drink and only sleeps 2 glasss of water, a whole nights 5,6 hours for one day, and daily amount of exercise extremely lacks.World Health Organization's investigation
Report sub-health population accounting 75%, and one of the simplest reason for causing inferior health is just a lack of drinking-water.
And the few functions of reminding user to drink water of current cup, even if there is this function, and there is no scientific basis
Based on, it needs how much water drunk within one day mostly, is got up according to user to the time of sleep, averagely got off, this drinking-water side
Formula is extremely unscientific.We drink water be it is very exquisite, and it is this be particular about be not it is fixed, according to Various Seasonal, weather
Temperature, humidity can all influence amount and the time of moisturizing.
In order to solve the above-mentioned technical problem, people have carried out long-term exploration, such as Chinese patent discloses a kind of health
Cup [publication number: CN205285829U] is equipped with pcb board including the cup lid and cup body being detachably connected in the cup lid, described
Pcb board is connected with display module, temperature detection sensor, water quality detection sensor, acceleration transducer, photosensitive sensors and
One signaling module, the display module are located at the cup lid upper surface, the temperature detection sensor, water quality detection sensor,
Acceleration transducer, photosensitive sensors are connected with the display module and the first signaling module, first signaling module with
Mobile terminal is connected, and first signaling module is connected with APP module, and the APP module is located in the mobile terminal.
Above-mentioned technical proposal needs user's self-setting prompting drinking water time, and the reminding effect of cup is more passive, and not
Scientific intelligently user can be reminded to drink water, could be improved in terms of prompting drinking water mode.
Summary of the invention
Regarding the issue above, the present invention provides a kind of method for the time that can predict to drink water
The another object of this programme is to provide a kind of system based on the above method.
In order to achieve the above objectives, present invention employs following technical proposals:
One kind can be used in predicting time method of drinking water, comprising:
S1. the data information of sample of users is obtained;
S2. the data information is carried out based on Bayesian Classification Arithmetic in different time periods, to obtain each period
Categorized data set;
S3. it is calculated by categorized data set of the K- nearest neighbor algorithm to each period, it is each for calculating to obtain
The drinking-water algorithm of period optimal drinking-water time and optimal amount of drinking water.
It can be predicted in the method for drinking water the time above-mentioned, in step sl, select sample of users by the following method:
The drinking habit of all users is acquired, and selects all one day drinking times more than preset times, one day amount of drinking water
More than preset quantity user as sample of users;
After step s 3 further include:
S4. the characteristic attribute for obtaining object user, it is described right according to characteristic attribute calculating by the drinking-water algorithm
As the optimal drinking-water time of user's each period and optimal amount of drinking water, and is sent and pushed away to the object user according to calculated result
Send message.
It can be predicted in the method for drinking water the time above-mentioned, the data information includes the characteristic attribute, the feature
Attribute includes gender, age, height, weight and user position, time, the temperature and humidity of user;The data letter
Breath further includes the drinking habit of sample of users;
And the drinking habit includes drinking-water time and/or each amount of drinking water, is examined by the amount of drinking water being installed on cup body
Device is surveyed to obtain each amount of drinking water and the data information of each amount of drinking water is sent to server (1) by cup body.
It can be predicted in the method for drinking water the time above-mentioned, in step s3, the drinking-water algorithm includes drinking-water time public affairs
Formula 1. with amount of drinking water formula 2.:
Wherein,
X indicates the drinking-water time of object user;
Y indicates the amount of drinking water of object user;
N indicates characteristic attribute quantity possessed by object user;
Xi indicates the best drinking-water time of individual features attribute;
Ki indicates the coefficient of individual features attribute;
Yi indicates the best amount of drinking water of individual features attribute.
It can be predicted in the method for drinking water the time above-mentioned, the drinking-water time of object user's individual features attribute and object are used
3. 4. the amount of drinking water of family individual features attribute is obtained respectively by formula with formula:
Xi=x0+ (w-per)/per*x0 is 3.
Yi=y0+ (w-per)/per*y0 is 4.
Wherein,
Xi indicates the drinking-water time of object user's individual features attribute;
X0 indicates drinking-water time centre point;
W indicates object user's individual features attribute value;
Per indicates the average value of sample of users individual features attribute;
Yi indicates the amount of drinking water of object user's individual features attribute;
Y0 indicates amount of drinking water central point.
Can be predicted in the method for drinking water the time above-mentioned, the drinking-water time centre point and amount of drinking water central point all in accordance with
Euclidean distance formula 5. gained:
Wherein,
Dx indicates the otherness of drinking-water time between sample of users;
Dy indicates the otherness of amount of drinking water between sample of users;
N indicates characteristic attribute quantity;
Xi indicates the drinking-water time of sample of users individual features attribute;
Yi indicates the amount of drinking water of sample of users individual features attribute;
Wi indicates the value of sample of users individual features attribute;
W0 indicates the value of central point individual features attribute.
Can be predicted in the method for drinking water the time above-mentioned, the coefficient formulas of individual features attribute be formula 10.:
Ki=(w-per) * Ex+ (d1-w) * p1+ (d2-w) * p2+ ...+(dn-w) * pn is 10.
Wherein,
Ki, indicate individual features attribute coefficient, and the coefficient of all characteristic attributes and be 1;
W indicates active user's individual features attribute value;
Per indicates average value of the sample of users about individual features attribute;
Ex indicates accounting weight of the individual features attribute in all characteristic attributes;
P1 ... pn indicates particle scale factor of all sample of users about individual features coefficient, wherein the particle ratio
The calculation formula of the example factor is as follows:
Wherein, (1,2 ... n) indicates the total value of corresponding period individual features attribute to T.
It can be predicted in the method for drinking water the time above-mentioned, in step s 2, the categorized data set includes each time
The drinking-water time of each characteristic attribute of section and amount of drinking water, and 6. the bayesian algorithm includes drinking-water time correlation formula and drinks water
Measure correlation formula 7.,
Wherein,
P (yi | x), indicate the drinking-water probability for each characteristic attribute in the i period;
P (x) indicates the drinking-water probability of each characteristic attribute;
P (yi) indicates the drinking-water probability of i period;
P (x | yi), indicate the drinking-water probability of each characteristic attribute in the i period;
Q (yi | x), indicate the amount of drinking water for each characteristic attribute in the i period;
Q (x) indicates the amount of drinking water of each characteristic attribute;
Q (yi) indicates the amount of drinking water of i period;
Q (x | yi), indicate the amount of drinking water of each characteristic attribute in the i period.
It can be predicted in the method for drinking water the time above-mentioned, the categorized data set includes drinking-water time data set and drinking-water
Measure data set, the drinking-water time data set be formula 8., amount of drinking water data set for formula 9.,
Wherein,
P(x|yi), indicate the drinking-water probability of each characteristic attribute in the i period;
P (yi) indicates the drinking-water probability of i period;
Q (x | yi), indicate the amount of drinking water of each characteristic attribute in the i period;
Q (yi) indicates the amount of drinking water of i period;
X={ a1, a2 ... am } indicates each corresponding characteristic attribute;M indicates characteristic attribute quantity.
A kind of system for the time that can predict to drink water, including server, the server include sample acquisition module, instruction
Practice module, judgment module and pushing module, wherein
Sample acquisition module selects sample of users for acquiring the data information of user, and according to data information, will be described
The data information of sample of users is as training sample;
Training module carries out Bayesian Classification Arithmetic for the data information using sample of users to obtain classification data
Collection, and calculates the categorized data set by K- nearest neighbor algorithm, with acquisition for calculating optimal drinking-water time and optimal
The drinking-water algorithm of amount of drinking water;
Judgment module is based on for acquiring and receiving the characteristic attribute information of object user, and according to the drinking-water algorithm
The best drinking-water time of the characteristic attribute information computing object user and best amount of drinking water;
Pushing module, when sending for sending PUSH message to the object user according to calculated result about best drinking-water
Between and best amount of drinking water PUSH message.
The present invention has the advantage that compared to the prior art carries out depth to the sample of users drinking-water time by big data
Study is obtained and is most preferably drunk water the drinking-water algorithm of time and amount of drinking water for calculating user's per period, further according to the feature of user
Attribute obtains best drinking-water time and the amount of drinking water of irregular user by the drinking-water algorithm, and there is the more scientific drinking-water time to obtain
Mode is taken, the drinking habit of irregular user is effectively improved, promotes body metabolism, improves physical fitness.
Detailed description of the invention
Fig. 1 is the method flow diagram of the embodiment of the present invention one;
Fig. 2 is the system structure diagram of the embodiment of the present invention two.
Appended drawing reference: server 1;Sample acquisition module 11;Training module 12;Judgment module 13;Pushing module 14;Cup body
2;Drink water APP3.
Specific embodiment
Although operations are described as the processing of sequence by flow chart, many of these operations can by concurrently,
Concomitantly or simultaneously implement.The sequence of operations can be rearranged.Processing can be terminated when its operations are completed,
It is also possible to have the additional step being not included in attached drawing.Processing can correspond to method, function, regulation, subroutine, son
Program etc..
Term "and/or" used herein above includes any of associated item listed by one of them or more and institute
There is combination.When a unit referred to as " connects " or when " coupled " to another unit, can be connected or coupled to described
Another unit, or may exist temporary location.
Term used herein above is not intended to limit exemplary embodiment just for the sake of description specific embodiment.Unless
Context clearly refers else, otherwise singular used herein above "one", " one " also attempt to include plural number.Also answer
When understanding, term " includes " and/or "comprising" used herein above provide stated feature, integer, step, operation,
The presence of unit and/or component, and do not preclude the presence or addition of other one or more features, integer, step, operation, unit,
Component and/or combination thereof.
Present invention is mainly applied to Intelligent water cup system regions, the Intelligent water cup system for solving the prior art is used without normal direction
Family scientifically speculate user drink water the time the problems such as, be the preferred embodiment of the present invention and in conjunction with attached drawing below, to this
The technical solution of invention is further described, but the present invention is not limited to these Examples.
Embodiment one
As shown in Figure 1, can predict to drink water the method for time present embodiment discloses one kind, specifically includes the following steps:
S1. the data information of sample of users is obtained;
S2. the data information is carried out based on Bayesian Classification Arithmetic in different time periods, to obtain each period
Categorized data set;
S3. it is calculated by categorized data set of the K- nearest neighbor algorithm to each period, it is each for calculating to obtain
The drinking-water algorithm of period optimal drinking-water time and optimal amount of drinking water;
S4. the characteristic attribute for obtaining object user, it is described right according to characteristic attribute calculating by the drinking-water algorithm
As the optimal drinking-water time of user's each period and optimal amount of drinking water, and is sent and pushed away to the object user according to calculated result
Send message.
We drink water be it is very exquisite, and it is this be particular about be not it is fixed, according to Various Seasonal, weather temperature, humidity
Amount and the time of moisturizing will be influenced.The present embodiment explores good drinking habit rule from user.Drinking-water is advised
The user of rule will go to drink water when somagenic need is drunk water, we are the user relatively regular to drinking-water, collect big data, meter
Calculate drinking-water time and the amount of drinking water in each period, the period here can be divided into early morning (when 6-9), noon (when 9-1),
Afternoon (when 1-4), at dusk (when 4-7), at night (when 7-10), except of course that period division methods above-mentioned, can also by when
Between section draw it is thinner, between each period have identical duration, it is possible to have different durations can also skip certain times
Section, such as the afternoon nap time at noon.Specifically be divided into which is set on backstage period according to the actual situation by staff.It searches
After collecting the good user data of drinking habit, then cooperate the weather condition of each user region, by the product of certain time
It is tired, it will be able to calculate for the best drinking-water time of different user and best amount of drinking water.Finally by calculated standard, push
To the irregular user that drinks water, such user is reminded to go to drink water, to achieve the purpose that improve user's drinking habit.
Specifically, in step sl, sample of users, the i.e. good user of drinking habit are selected by the following method:
The drinking habit of all users is acquired, and selects all one day drinking times more than preset times, one day amount of drinking water
More than preset quantity user as sample of users;Here preset times can be 5 times, and preset quantity can be 2000ml.
For example, the data information format of collecting sample user can be as shown in the table:
Specifically, data information includes the characteristic attribute, the characteristic attribute include the gender of user, the age, height,
The information such as weight and user position, time, temperature and humidity;The data information further includes the drinking-water of sample of users
It is accustomed to, wherein the drinking habit drinking times and drinking-water daily including drinking-water time and each amount of drinking water and sample of users name
Total amount, and the drinking-water amount detecting device that can detecte each amount of drinking water of user is installed on cup body here, amount of drinking water detection
Device is specifically as follows the sensor devices such as water flow sensing unit, pressure sensor, the amount of drinking water data information that cup body will acquire
It is sent to server, follow-up work has server completion, such as the drinking-water time of user, since current data transmission technology compares
Maturation, cup body get data to being uploaded to time difference very little between server, or even almost without the time difference, it is possible to
Cup body uploads data time and is determined as drinking water the time for user, and one day total amount has server to be voluntarily added acquisition etc..In addition, cup
The sensors such as temperature, humidity can also be installed to obtain the temperature and humidity of user's local environment on body, it certainly, can also on cup body
Not install these temperature-humidity sensors, the current temperature and humidity of user have server voluntarily from user characteristics attribute from
Row obtains.
Specifically, in step s3, the drinking-water algorithm include drinking-water time formula 1. with amount of drinking water formula 2.:
Wherein,
X indicates the drinking-water time of object user;
Y indicates the amount of drinking water of object user;
N indicates characteristic attribute quantity possessed by object user, such as characteristic attribute here includes gender, age, body
High, weight and user position, time, temperature and humidity, then n here is just 8;
Xi indicates the best drinking-water time of individual features attribute;For example, x1-x8 respectively corresponds gender, age, height, body
Weight, position, time, temperature and humidity, then x2 means that the age, if the age of object user is 18, then being here exactly year
The best drinking-water time for the user that age is 18 years old;
Ki indicates the coefficient of individual features attribute, since each characteristic attribute is to the influence journey of drinking-water time and amount of drinking water
Degree is different, so each characteristic attribute corresponding best drinking-water time and amount of drinking water is made to multiply the coefficient, also, each feature category
The influence degree of property is mutually indepedent, without cross influence, so can be classified respectively with Bayes' theorem here;
Yi indicates the best amount of drinking water of individual features attribute.
By above-mentioned formula, each period can be calculated separately, best drinking-water time of corresponding object user and best
Amount of drinking water, to send reminder message to user according to calculated result to remind user in the best drinking-water time of each period
Drink the water of optimised quantity.
Further, the amount of drinking water of the drinking-water time and object user's individual features attribute of object user's individual features attribute
It is 3. 4. obtained with formula by formula respectively:
Xi=x0+ (w-per)/per*x0 is 3.
Yi=y0+ (w-per)/per*y0 is 4.
Wherein,
Xi indicates the drinking-water time of object user's individual features attribute;
X0 indicates drinking-water time centre point;
W indicates object user's individual features attribute value;
Per indicates the average value of sample of users individual features attribute;
Yi indicates the amount of drinking water of object user's individual features attribute;
Y0 indicates amount of drinking water central point.
Also, drinking-water time centre point and amount of drinking water central point here all in accordance with Euclidean distance formula 5. gained, here
Corresponding point set coordinate can be combined:
Wherein,
Dx indicates that the drinking-water time difference is anisotropic between sample of users;
Dy indicates amount of drinking water otherness between sample of users;
N indicates characteristic attribute quantity;
Xi indicates the drinking-water time of sample of users individual features attribute;
Yi indicates the amount of drinking water of sample of users individual features attribute;
Wi indicates the value of sample of users individual features attribute;
W0 indicates the value of central point individual features attribute.
In addition, the coefficient formulas of individual features attribute be formula 10.:
Ki=(w-per) * Ex+ (d1-w) * p1+ (d2-w) * p2+ ...+(dn-w) * pn is 10.
Wherein,
Ki, indicate individual features attribute coefficient, and the coefficient of all characteristic attributes and be 1;
W indicates active user's individual features attribute value, and active user refers to one of user in sample of users,
It is here primarily intended for calculating the coefficient of each characteristic attribute, so used data are all the data of sample of users, such as body
Height, the height of active user is 1.78, then w=1.78 here;
Per, indicates average value of the sample of users about individual features attribute, and equally such as height, sample of users is averaged
For;
Ex indicates accounting weight of the individual features attribute in all characteristic attributes;
P1 ... pn indicates particle scale factor of all sample of users about individual features coefficient
Wherein, the calculation formula of the particle scale factor is as follows:
Wherein, (1,2 ... n) indicates the total value of individual features attribute possessed by the corresponding period to T, for example, all samples
There is 99% sample of users to drink water in the period in 6-8 in user, then for this characteristic attribute of height, T is equal to this
The height total value of 99% sample of users.
Specifically, in step s 2, the categorized data set includes the drinking-water time of each characteristic attribute of each period
And amount of drinking water, and the bayesian algorithm include drinking-water time correlation formula 6. with amount of drinking water correlation formula 7.,
Wherein,
P (yi | x), indicate the drinking-water probability for each characteristic attribute in the i period;
P (x) indicates the drinking-water probability of each characteristic attribute;
P (yi) indicates the drinking-water probability of i period;
P (x | yi), indicate the drinking-water probability of each characteristic attribute in the i period;
Q (yi | x), indicate the amount of drinking water for each characteristic attribute in the i period;
Q (x) indicates the amount of drinking water of each characteristic attribute;
Q (yi) indicates the amount of drinking water of i period;
Q (x | yi), indicate the amount of drinking water of each characteristic attribute in the i period.
Further, categorized data set includes drinking-water time data set and amount of drinking water data set, 6. and 7. according to formula,
Obtain drinking-water time data set formula 8., amount of drinking water data set formula 9.,
Wherein,
P(x|yi), indicate the drinking-water probability of each characteristic attribute in the i period, the i period indicates each period
One of them period;
P (yi) indicates the drinking-water probability of i period;
Q (x | yi), indicate the amount of drinking water of each characteristic attribute in the i period;
Q (yi) indicates the amount of drinking water of i period;
X={ a1, a2 ... am } indicates each corresponding characteristic attribute;M indicates characteristic attribute quantity.
The present embodiment mainly pass through installation APP on the subscriber terminal to user receive user some characteristic attributes and
PUSH message is sent, each user installs corresponding drinking-water APP on the terminal devices such as mobile phone, and each cup is in the server
With distinctive number, then user need to only be bound the APP installed on the cup of oneself and oneself mobile phone, and user
The characteristic attribute of oneself can be inserted in the identity information of oneself by APP, characteristic attribute includes the height of user, the age,
These essential informations such as gender, remaining characteristic attribute, such as temperature, humidity, locating region, season, time etc., due to general
The terminal of installation drinking-water APP all has the APP such as the timer of oneself, weather software and positioning software, so server can lead to
It crosses and accesses some characteristic attributes that the APP of these installations in the terminal obtains user, certain server can also pass through its other party
Formula obtains characteristic attribute, and specific acquisition pattern not restriction is finally saved the APP account of user by server, and account is corresponding
Identity information and its cup of binding.Also, server can also irregularly or regular visit correlation APP is to update the spy of user
Levy attribute.
It is corresponding to obtain every section of period by constantly acquiring analyzing by algorithm for the regular user that drinks water for the present embodiment
Drinking-water algorithm, and collected data are more, and drinking-water algorithm accuracy is higher, are then directed to the feature category of irregular user
Property using the drinking-water algorithm carry out drinking-water time and amount of drinking water deduction, and to user send PUSH message to remind user on time
Drinking-water, to achieve the purpose that correct user's drinking habit.
Embodiment two
As shown in Fig. 2, can predict to drink water the system of time, including server 1 present embodiment discloses one kind, further include
Cup body 2 and the drinking-water APP3 being mounted on subscriber terminal equipment, server 1 are separately connected cup body 2 and the APP3 that drinks water, on cup body 2
The drinking-water amount detecting device 4 for being able to detect each amount of drinking water of user is installed, the server 1 includes sample acquisition module
11, training module 12, judgment module 13 and pushing module 14, wherein
Sample acquisition module 11 selects sample of users for acquiring the data information of user, and according to data information, by institute
The data information of sample of users is stated as training sample;
Training module 12 is carried out for the data information using sample of users based on different time sections Bayesian Classification Arithmetic
To obtain the categorized data set of each period, and the categorized data set is calculated by K- nearest neighbor algorithm, to obtain
For calculating the drinking-water algorithm of each period optimal drinking-water time and optimal amount of drinking water;
Judgment module 13, for acquiring and receiving the characteristic attribute information of object user, and according to the drinking-water algorithm base
Best drinking-water time and best amount of drinking water in characteristic attribute information computing object user each period of the object user;
Pushing module 14 is sent for sending PUSH message to the object user according to calculated result about best drinking-water
The PUSH message of time and best amount of drinking water.
Specific embodiment described herein is only to give an example to the present invention.The technical field of the invention
Technical staff can make various modifications or additions to the described embodiments or be substituted in a similar manner, but
Without departing from the spirit of the invention or going beyond the scope defined by the appended claims.
In addition, although more using server 1 herein;Sample acquisition module 11;Training module 12;Judgment module 13;
Pushing module 14;Cup body 2;The terms such as drinking-water APP3, but it does not exclude the possibility of using other terms.Only using these terms
Merely to be more convenient to describe and explain essence of the invention and be construed as any additional limitation all be and this
What spirit was disagreed.