Difference between revisions of "Condition Effect Learning"

From AardRock Wiki
Jump to navigation Jump to search
(Added Kingma's Theorem)
Line 3: Line 3:
As said in [[Advisory System]], Cheetah needs a system that learns about the effect of certain conditions. As you can read in [[Advisory System]], I think there are three kinds of conditions:
As said in [[Advisory System]], Cheetah needs a system that learns about the effect of certain conditions. As you can read in [[Advisory System]], I think there are three kinds of conditions:
# Certain conditions: the effect is known and fixed.
# Certain conditions: the effect is known and fixed.
# Uncertain conditions: the effect is not certain or not known yet.
# Uncertain conditions: the effect is not certain or not known yet. These effects are to be learned by the system.


There are some comlications regarding learning about condition (e.g. food) effects. Since each human and each body is different, conditions dont always have a fixed certain effect. Food for instance has a GL (Glycamic Load) that tells about the effect of the food on BG (Blood Glucose) levels. Food effect (response) varies between individuals and between days as much as 20%. Likewise, effect of insulin and activities varies between people and temporally. Therefore, to account for individual and temporal differences, I think it is a good thing to generally express condition effect some range instead of a simple number. Such a range could be a probability distribution, or expressed as (minimum,maximum) couple. For Cheetah 'Learning' about conditions means assigning such a range or distribution to it. There are several levels of expressing such variation in terms of a range or distribution.
There are some comlications regarding learning about condition (e.g. food) effects. Since each human and each body is different, conditions dont always have a fixed certain effect. Food for instance has a GL (Glycamic Load) that tells about the effect of the food on BG (Blood Glucose) levels. Food effect (response) varies between individuals and between days as much as 20%. Likewise, effect of insulin and activities varies between people and temporally. Therefore, to account for individual and temporal differences, I think it is a good thing to generally express condition effect some range instead of a simple number. Such a range could be a probability distribution, or expressed as (minimum,maximum) couple. For Cheetah 'Learning' about conditions means assigning such a range or distribution to it. There are several levels of expressing such variation in terms of a range or distribution.
Line 15: Line 15:
When a user adds a new food type X to the database, it can add information like carbonhydrate(%), GI and such, to help the system determine X<sub>hardmin</sub> and X<sub>hardmax</sub>.
When a user adds a new food type X to the database, it can add information like carbonhydrate(%), GI and such, to help the system determine X<sub>hardmin</sub> and X<sub>hardmax</sub>.


So, all conditions have a minimum and a maximum effect:<br/>
 
suppose c is a condition, then:<br/>
So, all conditions have a minimum and a maximum effect.<br/>
Suppose c is a condition, then:<br/>
<math>c_{min}, c_{max} \in \mathbb{R}</math><br/>
<math>c_{min}, c_{max} \in \mathbb{R}</math><br/>
<math>c_{min} \le c_{max}</math><br/>
<math>c_{min} \le c_{max}</math><br/>


also, conditions can be contained in a set:<br/>
A = {e_1, e_2, ...}</br/>


Lets assume that at each blood glucose (BG) measurement, Cheetah starts its learning system. Cheetah looks at all conditions that could have an effect, and puts all type 1 conditions into group CE (certain effect) and all type 2 and 3 conditions into group UE (uncertain effect). Each group has a group effect, which is the sum of all effect of the conditions in that group.
Also, conditions can be contained in a group (set) of conditions A:<br/>
S = {c1, c2, ...}<br/>
Like conditions, such group of conditions S also has minimum and maxmimum cumulative effect. Such effect is the sum of all of the effects of its contained conditions:<br/>
S<sub>min</sub> = c1<sub>min</sub> + c2<sub>min</sub> + ...<br/>
S<sub>max</sub> = c1<sub>max</sub> + c2<sub>max</sub> + ...<br/>
 
 
Using logics, set theory, intuition and commson sense, I came up with the following theorem. Lets call it ''Kingma's Theorem'' :). I havent formally proved it yet, but this seems to be true for all cases. Its actually quite logical.<br/>
if e is a port of set S (''so S-e is set S minus condition c')<br/>
and S<sub>min</sub> and S<sub>max</sub> are known<br/>
and c<sub>hardmin</sub> and c<sub>hardmax</sub> are known<br/>
then can be said:<br/>
S-c<sub>min</sub> = S<sub>min</sub> - c<sub>hardmax</sub><br/>
S-c<sub>max</sub> = S<sub>max</sub> - c<sub>hardmin</sub><br/>
 
 
Lets assume that at each blood glucose (BG) measurement, Cheetah starts its learning system. Cheetah looks at all conditions that could have an effect, and puts all type 1 conditions into group CE (certain effect) and all type 2 into group UE (uncertain effect).  
Then, cheetah calculates the difference (min and max) between the BG<sub>measurement</sub> and predicted CE group effect. This difference should equal the UE group effect. So:<br>
Then, cheetah calculates the difference (min and max) between the BG<sub>measurement</sub> and predicted CE group effect. This difference should equal the UE group effect. So:<br>
BG<sub>measurement</sub> = UE<sub>real</sub> + CE<sub>real</sub><br>
BG<sub>measurement</sub> = UE<sub>real</sub> + CE<sub>real</sub><br/>
UE<sub>min</sub> = BG<sub>measurement</sub> - CE<sub>max</sub><br>
So:<br/>
UE<sub>max</sub> = BG<sub>measurement</sub> - CE<sub>min</sub><br>
UE<sub>min</sub> = BG<sub>measurement</sub> - CE<sub>max</sub><br/>
UE = {c1, c2, c3}
UE<sub>max</sub> = BG<sub>measurement</sub> - CE<sub>min</sub><br/>
 
 
UE is the range of the sum of the to be learned conditions. These conditions all have their own effect range, c<sub>hardmin</sub> and c<sub>hardmax</sub>. But because the sum of effects (UE) is restricted , each individual effect for each condition must be somewhat more restricted. The possible effect range for each effect can be deduced from the total effect and the hardmin and hardmax value of the other effects. Using Kingma's Theorem, one can deduce the effect range of each individual effect.


[Example is to be added]




<pre>
Then, the &Delta;G(min and max) is calculated: the difference between predicted(min and max) and measured BG levels. Also, the set C of all type 2 and 3 conditions is assembled:
Then, the &Delta;G(min and max) is calculated: the difference between predicted(min and max) and measured BG levels. Also, the set C of all type 2 and 3 conditions is assembled:


Line 41: Line 61:


If <i>C</i> contains only one condition <i>c</i>, it is quite easy for the system to directly assign &Delta;G<sub>min</sub> and &Delta;G<sub>max</sub> to <i>c</i>. The story gets less trivial when C contains multiple conditions.
If <i>C</i> contains only one condition <i>c</i>, it is quite easy for the system to directly assign &Delta;G<sub>min</sub> and &Delta;G<sub>max</sub> to <i>c</i>. The story gets less trivial when C contains multiple conditions.
Verdere notities (moeten nog verder verwerkt worden):
<pre>
Problemen bij bereken effect van conditie:
- Het precieze effect is onzeker. Onderzoek onderschrijft dit. Door middel van een 'range' kan wel worden
gezegt tussen welke waardes het effect waarschijnlijk ligt.
- Het leren van effecten is dus het opstellen van een 'range' waartussen een effect ligt. Hoe beter het
systeem een effect kent, hoe betrouwbaarder de gegeven range is. Uit de verschillendde gemeten 'ranges' voor
een conditie wordt een range berekent die wordt gebruikt bij voorspellingen.
  Elke conditie heeft ook een harde ingebakken minimaal en maximaal effect. Je lichaam kan bijvoorbeeld
niet meer koolhydraten uit voedsel benutten dan er in zit. Het systeem kan zo'n maximum dan berekenen uit
een door de gebruiker ingevoerd aantal koolhydraten.
conditietypes:
1) certain conditions.
  Range is fixed
2) predicted uncertain conditions
  Range wordt berekend uit de ranges die uit het verleden geleerd worden.
3) yet unpredicted (new) conditions
  Een lege range lijst.
gevalsonderscheid dagtypes:
1) - metingen zijn verklaarbaar
    dG(predicted)=MIN-MAX
    MIN<=dG(meting)<=MAX
  - condities: type 1 (certain)
2) - metingen zijn verklaarbaar
    dG(predicted)=MIN-MAX
    MIN<=dG(meting)<=MAX
  - condities: type 1's en één type 3 (yet unpredicted, new) condition NEWCONDITION
  => RANGES(CONDITION) = (dG(meting)-MAX) - (dG(meting)-MIN)
  => Is de nieuwe range onmogelijk (buiten minimale min maximale max)?
      => Het model is onbetrouwbaar, of er mist een conditie.
        Meld gebruiker om te controleren of hij alles ingevoerd heeft.
        - als dG(meting)>MAX dan missende voedselconditie.
        - als dG(meting)<MIN dan missende insulineconditie.
3) - metingen zijn verklaarbaar
    dG(predicted)=MIN-MAX
    MIN<=dG(meting)<=MAX
  - condities: type 1's en er is één type 2 (predicted uncertain) condition CONDITION(A-B)
  => voeg de nieuwe berekende range toe aan database van de conditie:
    RANGES(CONDITION) += (dG(meting)-MAX) - (dG(meting)-MIN)
    Bereken nieuwe gemiddelde range uit deze dataset
  => Check op mogelijheid nieuwe range
4) - metingen zijn onverklaarbaar
    dG(predicted)=MIN-MAX
    dG(meting)>MAX of dG(meting)<MIN
  - condities: type 1's
  => Het model is onbetrouwbaar, of er mist een conditie.
      Meld gebruiker om te controleren of hij alles ingevoerd heeft.
      - als dG(meting)>MAX dan missende voedselconditie.
      - als dG(meting)<MIN dan missende insulineconditie.
5) (lijkt erg op dagtype 2)
  - metingen zijn onverklaarbaar
    dG(meting)=MIN-MAX
    dG(meting)>MAX of dG(meting)<MIN
  - condities: type 1's en één type 3 (yet unpredicted, new) condition NEWCONDITION
  => RANGES(CONDITION) = (dG(meting)-MAX) - (dG(meting)-MIN)
  => Check op mogelijheid nieuwe range
6) - metingen zijn onverklaarbaar
    dG(predicted)=MIN-MAX
    dG(meting)>MAX of dG(meting)<MIN
  - condities: type 1's en er is één type 2 (predicted uncertain) condition CONDITION(A-B)
  => voeg de nieuwe berekende range toe aan database van de conditie:
    RANGES(CONDITION) += (dG(meting)-MAX) - (dG(meting)-MIN)
    Bereken nieuwe gemiddelde range uit deze dataset
  => Check op mogelijheid nieuwe range
7) -
INITIAL KNOWLEDGE BASE:
condities hebben een effect range (bv. een GI range),
met de grootse kans binnen deze range
APPEL(dG=3-4)
BROOD(dG=3-7)
DAG1:
Conditie: EET APPEL(dG=3-4)
Conditie: EET BROOD(dG=5-7)
Meting  : dG(meting)=10
LEERSYSTEEM:
1) dG(predicted)=8-11, dus dG(meting)=10 zit nog in range
  SYSTEEM VINDT NIKS ONVERKLAARBAARS
DAG2:
Conditie: EET APPEL(dG=3-4)
Meting  : dG(meting)=3
LEERSYSTEEM:
1) dG(predicted)=3-4, dus dG(meting)=3 zit nog in range
  LEERSYSTEEM VINDT NIKS NIEUWS
DAG3:
Conditie: EET APPEL(dG=3-4)
Conditie: EET VLA(dG=?-?) (NIEUWE CONDITIE, WEET EFFECT NOG NIET)
Meting  : dG(meting)=5
LEERSYSTEEM:
1) ZIET: 1 NIEUWE CONDITIE VLA(dG=?-?)
  en dG(predicted)=3+?-4+?
  en dG(meting)=5
  dus dG(onverklaarbaar)=1-2
2) KOPPELT ONVERKLAARBARE GLUCOSESTEIGING AAN DE NIEUWE CONDITIE:
  VLA(dG=1-2)
DAG4:
dG(predicted)=5-10
dG(meting)=12
dus variabele condities moeten samen voor 2-7 aan variatie hebben gezorgt
stel: conditie A met hardMIN=5 en hardMAX=10
      conditie B met hardMIN=2 en hardMAX=5
dan zou conditie in zijn eentje dus als effect (min-max) dus (5-7) toevoegen      -3->+2  of -5->0
en nu komt variabele B in het spel
om het uiteindelijke effect 2-7 te behouden,
deze zou dan voor een effect (-3->+2  of -5->0) -3 tot +2 gehad kunnen hebben, dus 2-2
nu omgekeerd toekennen van waardes
conditie B in zijn eentje een mogelijk effect van 2-5
conditie A dan een effect van 5-5 (als B=2 dan 0-5 en als B=5 dan -3 tot 2)
andere aanpak:
VOORBEELD 1:
stel: conditie A met hardMIN=5 en hardMAX=10
      conditie B met hardMIN=2 en hardMAX=5
uit meting blijkt dat variabele condities zorgen voor tussen 2-10 aan effect
STAP 1
minimaal theoretisch groepseffect is optelsom van hardMIN's (stel dit is 7)
maximaal theoretisch groepseffect is optelsom van hardMAX's (stel dit is 15)
minimaal werkelijk effect is 2
maximaal werkelijk effect is 10
minimaal mogelijk groepseffect is hoogste van de minima, dus 7
maximale mogelijk groepseffect is laagste van de maxima, dus 10
dus mogelijk groepseffect is (7-10)
STAP 2
A+B=(7-10)
hypothese 1: conditie A heeft het minimale effect, dus 5
            dan heeft conditie B een effect van 2-5 dus 2-5
hypothese 2: conditie A heeft het maximale effect, dus 10
            dan heeft conditie B een effect van -3-0 dus KAN NIET
(hypothese 3): conditie A heeft een effect van 8
            dan heeft conditie B een effect van -1-2 dus 2-2
OTEWEL:
effA + effB = 7-10 (=nieuwe kennis, evt ook voor databank)
effA(min) = effGroep(min) - effRest(max)
minimaliseer effA(min) met maximaal haalbare effRest(max)
  effA(min) = effGroep(min) - effRest(max)
  dus
  effA(min) + effRest(max) = effGroep(min)
effA(max) = effGroep(max) - effB(min)
effA(min) = effGroep(min) - effRest(max)
als effA(min) < effA(hardmin)
-> effA(min) = effA(hardmin)
  effRest(max) | [effA=effA(min)] = effGroep(min) - effA(hardmin)
effA(max) = effGroep(max) - effGroep(min) 
als effA(max) > effA(hardmax)
-> effA(max) = effA(hardmax)
  effRest(min) | [effA=effA(max)] = effGroep(max) - effA(hardmax)
effRest(min) = effGroep(min) - effA(max)
als effRest(min) < effRest(min)
-> effRest(min) = effRest(hardmin)
effRest(max) = effGroep(max) - effA(min)
als effRest(max) > effRest(hardmax)
-> effRest(max) = effRest(hardmax)
 
VOORBEELD 2:
stel: conditie A met hardMIN=10 en hardMAX=15
      conditie B met hardMIN=2  en hardMAX=5
      conditie C met hardMIN=12 en hardMAX=17
uitmeting blijkt dat variabele condities zorgen voor tussen 30-40 aan effect
STAP1:
hardminGROEP = 24
hardmaxGROEP = 37
minWERKELIJK = 30
minWERKELIJK = 40
dus mogelijk groepseffect is (30-37)
STAP2:
=> A+B+C=(30-37)
effB+C(max) = effGroep(min) - effA(min) = 30 - 10 = 20
=> B+C=(..-20)
effB+C(min) = effGroep(max) - effA(max) = 37 - 15 = 22
=> B+C=(
effA(min) = effGroep(min) - effB(max) - effB(
Conditie: EET BROOD(G>>5)
Conditie: EET VLA(G>>5)
Meting: dG(meting)
LEERSYSTEEM REGELS:
1 NIEUWE CONDITIE A(G>>?)
ONVERKLAARBARE GLUCOSESTEIGING 'dG(onverklaarbaar)'
=>
A(dG=dG(onverklaarbaar))
2 NIEUWE CONDITIES A(G>>?) EN B(G>>?)
ONVERKLAARBARE GLUCOSESTEIGING 'S'
=>
B(G>>
Stel, je hebt een verzameling variabelen V
elke v
</pre>
</pre>

Revision as of 13:27, 6 May 2006

This page reflects my idea about the Condition Effect Learning system. If you have comments, please dont delete text but add comments so I can reflect. See this as a first draft, which can be used as a basis for the Cheetah condition effect learning system.

As said in Advisory System, Cheetah needs a system that learns about the effect of certain conditions. As you can read in Advisory System, I think there are three kinds of conditions:

  1. Certain conditions: the effect is known and fixed.
  2. Uncertain conditions: the effect is not certain or not known yet. These effects are to be learned by the system.

There are some comlications regarding learning about condition (e.g. food) effects. Since each human and each body is different, conditions dont always have a fixed certain effect. Food for instance has a GL (Glycamic Load) that tells about the effect of the food on BG (Blood Glucose) levels. Food effect (response) varies between individuals and between days as much as 20%. Likewise, effect of insulin and activities varies between people and temporally. Therefore, to account for individual and temporal differences, I think it is a good thing to generally express condition effect some range instead of a simple number. Such a range could be a probability distribution, or expressed as (minimum,maximum) couple. For Cheetah 'Learning' about conditions means assigning such a range or distribution to it. There are several levels of expressing such variation in terms of a range or distribution. I solved the first one, but not yet the second and third.

  1. An effect range with a MIN and MAX value. E.g. a minimum and maximum BG effect. Therefore, to account for individual and temporal differences, I think it is a good thing to generally express condition effect by a range instead of just a single number.
  2. A discrete distributed function.
  3. A standard normal distribution (continues).

Learning an effect range with MIN and MAX value

With this system, all conditions X have a Xhardmin and Xhardmax variables which tells the system the hard minimum and maximum of effect. For example, [research] has pointed out that a can of Coca-Cola has a Glycemic Load of minimally 14 and maximally 16. So CocaColahardmin=14 and CocaColahardmax=16. So, CocaCola could be a type 1 condition because it has a certain effect. When a user adds a new food type X to the database, it can add information like carbonhydrate(%), GI and such, to help the system determine Xhardmin and Xhardmax.


So, all conditions have a minimum and a maximum effect.
Suppose c is a condition, then:
<math>c_{min}, c_{max} \in \mathbb{R}</math>
<math>c_{min} \le c_{max}</math>


Also, conditions can be contained in a group (set) of conditions A:
S = {c1, c2, ...}
Like conditions, such group of conditions S also has minimum and maxmimum cumulative effect. Such effect is the sum of all of the effects of its contained conditions:
Smin = c1min + c2min + ...
Smax = c1max + c2max + ...


Using logics, set theory, intuition and commson sense, I came up with the following theorem. Lets call it Kingma's Theorem :). I havent formally proved it yet, but this seems to be true for all cases. Its actually quite logical.
if e is a port of set S (so S-e is set S minus condition c')
and Smin and Smax are known
and chardmin and chardmax are known
then can be said:
S-cmin = Smin - chardmax
S-cmax = Smax - chardmin


Lets assume that at each blood glucose (BG) measurement, Cheetah starts its learning system. Cheetah looks at all conditions that could have an effect, and puts all type 1 conditions into group CE (certain effect) and all type 2 into group UE (uncertain effect). Then, cheetah calculates the difference (min and max) between the BGmeasurement and predicted CE group effect. This difference should equal the UE group effect. So:
BGmeasurement = UEreal + CEreal
So:
UEmin = BGmeasurement - CEmax
UEmax = BGmeasurement - CEmin


UE is the range of the sum of the to be learned conditions. These conditions all have their own effect range, chardmin and chardmax. But because the sum of effects (UE) is restricted , each individual effect for each condition must be somewhat more restricted. The possible effect range for each effect can be deduced from the total effect and the hardmin and hardmax value of the other effects. Using Kingma's Theorem, one can deduce the effect range of each individual effect.

[Example is to be added]


Then, the ΔG(min and max) is calculated: the difference between predicted(min and max) and measured BG levels. Also, the set C of all type 2 and 3 conditions is assembled:

The model tells system G<small>predicted, min</small> and G<small>predicted, max</small>

ΔG<sub>min</sub> = G<sub>measured</sub> - G<sub>predicted, max</sub><br/>
ΔG<sub>max</sub> = G<sub>measured</sub> - G<sub>predicted, min</sub><br/>
set C contains all type 2 and 3 conditions

If <i>C</i> contains only one condition <i>c</i>, it is quite easy for the system to directly assign ΔG<sub>min</sub> and ΔG<sub>max</sub> to <i>c</i>. The story gets less trivial when C contains multiple conditions.