You are on page 1of 14

Exam: Principles of Machine Learning / Beginselen van Machine Learning

August 21, 2020, 8.00 am

This exam is bilingual. Guidelines and questions are identical in both languages.
Dit examen is tweetalig. De richtlijnen en vragen zijn identiek in beide talen.

Richtlijnen — belangrijk!
1. Dit examen is gesloten boek. Je mag enkel het materiaal gebruiken dat op het examen
voorzien wordt, en een eenvoudige wetenschappelijke rekenmachine.
2. Lees elke vraag aandachtig. Antwoord alleen op de vraag, geef geen bijkomende informatie
die niet gevraagd is (irrelevante informatie geven kan een lagere score opleveren).
3. Beantwoord elke vraag op een duidelijke, gestructureerde manier. Antwoord bondig, precies
en ter zake. Schrijf geen volzinnen als bv. een oplijsting van termen even duidelijk is,
4. Alle antwoorden moeten op deze pagina's gegeven worden. De voorziene ruimte volstaat.
Waar een antwoordkader gegeven wordt, moet het antwoord binnen dat kader opgeschreven worden.
Waar geen kader voorzien is, mag alle lege ruimte op de bladzijde gebruikt worden.
5. Waar een maximale lengte (aantal woorden) opgegeven wordt, moet je je daaraan houderr. Te
lange antwoorden kunnen tot een lagere score leiden. Tekeningen en wiskundige formules tellen
niet mee als woorden.
6. Het examen duurt 3 uurl .
Succes!
Pròfs. Blockeel, Davis, De Raedt

Guidelines important!
1. This is an closed book ecam. You can onÌy use the materials provided to YO'u at the ecam, and a basic
scientific calculdtor.
2. Read each question carefully. Just answer the question, -do not provide inforrnation that is not asked
(if you do, it may lower yotl,r score).
3. Answer each question in a clear, structured u)ay. Be concise, precise and to the point. It is not .always
necessary to write full'sentences, buneted -lists may sufte.
l. All questions should be answered on these pages only. Suffcient space is provided. When answer bores are
provided, unite the 'requested answer in the bom. When no bot is prooided, gou can use all empty space on the
page.
5. When a maŒimum length (number of words) is mentioned, do not ignore it. Too lengthy answers may
lomer you score. Drawings and mathematical formulas do not count as woNs.
6. You have 3 hours to complete the exam.

Good luck!
Profs. Blockeel, Davis, D.e Raedt

1
(1) Prof. Blockeel : 4 vragen, 9 punten e 4 questions, 8 points
Q 1 (2p) Een dierenliemebber•heeft 10 katten, waarvan 2 witte, 4 bruine, 3 grijze en 1 zwarte. Hij
heeft ook 12 honden (2 witte, 5 bruine, 2 grijze, 3 zwarte) en 8 hamsters (5 witte, 3 grijze). Als we
het soort dier zouden willen voorspellen, wat is dan de informatiewinst (information gain) voor het
attribuut "kleur"? • A pet enthusiast Otvns 10 cats, of which' 2 White, 4 brown, 3 grey, and 1 black.
He also ouns 12 dogs (2 White, 5 brown, 2 grey, 3 black) and 8 hamsters (5 white, 3 grey). 1f we
want
to predict

Antwoord • Answer.

Q 2 (lp) Beschouw onderstaande dataset. We leren twee predictieve modellen die Y voorspellen uit
X: (a) een lineair model, d.m.v. lineaire regressie; (b) een ensemble van regressiebomen (met
constante voorspellingen binnen• elk blad). We gebruiken de modellen om een voorspelling te maken
voor het punt aangeduid met "x". Toon op de stippellijn wat de voorspelde y-waarde ongeveer zal
zijn, voor model a en voor model b. • Consider the following dataset. We train two models that
predict Y from X: (a) a linear model, using linear regression; (b) an ensemble of regression trees
(with constant predictions within each leaf). We use the models to make a prediction at the point
indicated with
Indicate on the dotied line uh•at_ the predicted y-value will be, approximately,. for model a and model b.
2

Q 3 (4p) Begchouw- de volgende dataset • Consider the following data table:

1 neg

Harry en Ron willen allebei een support vector machine leren die de positieve van de negatieve
voorbeelden scheidt. Harry gebruikt deze kernel: H (x, x') = x•xt . Ron gebruikt R(x, x') =
• Harry and Ron both want to learn a support .vector machine that separates the positives from the
negatives. Harry uses as kernel: H(x, x') = x • x/. Ron uses R(k, x') = (x • x/ + 1)2 .
a) Toon de kernel-matrix die Harry en Ron bekomen. • Show the kernel matric that Harry and
Ron obtain.
Ron's matrix:

b Schets zo nauwkeurig mogelijk de scheidingslijn tussen de gebieden in de inputruimte waarin Harry's en


Ron's SVM positief / negatief voorspcllen, Sketch, as acgumtely as you can, the lines

that separates the areas in the input •space where Harry's and Ron's S VM predict positive / negative.

3
vinden?•

c) Wie verwacht
d) Harry, en Ron merken plots op dat hun dataset onvolledig was: het punt (1,1), met negatief
label, ontbrak. Als ze dit punt meegetéld hadden, hoe zou hun uitkomst veranderd zijn? e Harry and
Ron suddenly notice that •their dataset was incomplete: the point (1, 1), with negative label, was not
included. If they had included .it in the data, how would it have changed Harry's and Ron's solution?

Q 4 (2p) Bereken de Igg onder theta-subSumptie van de volgende twee clauses. Toon het resultaat voor en na
reductie. Je mag de predikaatnamen afkorten tot hun eerste letter om ruimte en schrijfwerk te sparen. • Compute
the Igg under 9-subsumption of the following two clauses. Show the persion bef07E and after 'reducing the!
resulting clause. You can abbreviate the predicate names with their frst letter to save space.

fish(nemo) has-gills(nemo), lives(nemo,ocean), contains(ocean,water).

fish(freddy) has-gills(freddy), skin(freddy,orange), lives(freddy, aquarium), contains(aquarium,water);


contains(aquarium, air).

5
Prof.. Davis: 2 vragen, 4.5 punten / 2 questions, 4.5 points
Q 5 (2.5p) Stel dat je een ensemble wil leren met bagging. Je gebruikt een perceptron als basismodel.
Verwacht je dat dit goed werkt? Waarom (niet)?. Schrijf je antwoord in het kader hieronder. Gebruik
hoogstens 60 woorden. • Suppose you decide to train an ensemble using bagging. You decide to use
a perceptron as the base model in your ensemble. Would you ecpect this to work well? or why not?
Write your answer in the boc below and limit yourself to a macimum of 60 words.

Table 1: Dataset voor kNN vraag. • Dataset for the kNN question.
F_1 F_2 F_3 Label
-0.1 Positive
5 4

10 5 -0.2 positive

20 0 0.8 negative
25 0.5 0.6 negative

Q 6 (2p) Stel, je gebruikt het k-dichtste-buren algoritme met k — 1 op de data in tabel 1. Je gebruikt
Manhattan-afstand en min-max-herschaling. •Welke voorspelling wordt gemaakt •voor het
testvoorbeeld = (25, 3, 0)? Toon de vol.ledige berekening die tot je antwoord leidt.
You are running I-Nearest neighbors where the raw training data is shown in Table 1, You are using the
Manhattan distance and decide to apply min-mac scaling. What prediction will be made for the test eiample ct
= (25, 3, 0)? You must show all your work to æceive full credit for this problem.
(3) Prof. De Raedt : 3 .vragen, 6.5 punten e 3 questions, 6.5 points
Network Independences (2 pt)
(a) Beschouw het volgende Markov netwerk. Geef de verzameling van onafhankelijkheden waarvoor dit
netwerk een perfect •map is. • Consider the following Markov. network Specify the set of
independencies•Lp for which this network is a perfect map.

(b) Beschouw het volgende•Bayesiaans netwerk en de verzameling van onafhankelijkheden LP uit


de vorige vraag. Is het Bayesiaans netwerk een perfect map, een independence map, een
dependence map of geen van de voorgaande? Verklaar kort waarom.• • Consider the following
Bayesian network and reconsider the same set of independencies LP from the previous
question. Is the Bayesian network a perfect map, an independence map, a dependence map, or
.none of the previouS for Lp? Justify your answer.

7
Is dit een perfect map? Ja of nee. Leg uit in één zin. e Is this a perfect map? Yes or no. Specify in
one sentence why.

Is dit eerr independence map? Ja of nee. Leg uit in één zin. • Is this an independence map? Yes
or no. Specify in one sentence why.

Is- dit .een dependence map? Ja of nee. Leg uit in één- zin. • Is this a dependénce map? Yes or no.
Specify in one sentence why.
Data Completion (2 pt)
Twee dokters hebben onafhankelijk van elkaar twee verschillende tests gebruikt (Tl en T2) om griep
(F) vast te stellen bij patiënten. Ze beslissen samen te komen om te zien welke test het meest accuraat
is om de griep vast te stellen. Eén patiënt is slechts eenmalig getest en heeft de follow-up niet gedaan
om te bevestigen of' hij de griep effectief had. De verzamelde data is in onderstaande tabel. te zien. •
Two doctors have been independently using two different tests (Tl and T2) •to diagnose whether a
patient has the flu (F) or not. At some point, the two doctors meet to figure out which of the tests is
more accurate in measuring if someone has the flu._ One of the patients did not agree to be tested
twice, and did not attend the follow-up to confirm whether he actually had the flu or not. The collected
data are tabulated below.

a) Teken het Bayesiaans netwerk dat deze situatie modelleert. • Draw the Baye•sian network that
models the above situation.

b) Verwaarloos de onvolledige data en gebruik maximum likelihood om p(T1 = IIF— 1) te schatten.


• Discard the missing data and use maximum likelihood to estimate p(T1 = IIF = 1).

c) We krijgen nu wat prior 'informatie over de eerste test Tl en verwaarlozen nog steeds de
onvolledige data. Volgéns de prior informatie is de test Tl correct in 90% van de gevallen. Deze
informatie is gebaseerd op 5() patiënten en mag als betrouwbaar aangenomen worden. Gebruik
deze prior informatie samen met de volledige data om een schatting te krijgen van p(T1 = IIF 1).
e While still discarding the missing data, we gain some prior information on the first test Tl. This
prior information states that•we believe that the Tl correctly classifies flu patients 90% of the time.
This information is considered reliable, and corresponds to having seen 50 patients. Use this prior
information together with the non-missing data to estimate p(T1 = IIF = 1).

d) Nu houden we rekening met de onvolledige data (maar niet meer met de prior informatie). We
kennen de volgende kansen p(F = 1) = 0.5, p(T1 = 1| F = 1) = 0.80, p(T1 = 1| F= 0) = 0.20, p(T2
= 1 | F = 1) = 0.75 en p(T2 = 1 | F = 0) = 0.10. We gaan één iteratie van expectation maximization
(EM) uitvoeren om p(T1 = 1| F = 1) te schatten. Vervollédig eerst de data in de onderstaande tabel
en geef ook de kans of het gewicht van elke vervollediging aan. • Now the

9
missing data will be incorporated in the estimation (but no longer the prior
information). We have the following prior information on the probabilities p(F = 1)

0:80, p(T1 IF = O) 0.20, p(T2 = 1) = 0.75, and p(T2 = = O) = 0.10. we will execute one iteration
of expectation-maximization (EM) to éstimatew(T1 = IIF = 1). First, complete the missing data in
the table below and give for every completion. the corresponding probability or weight.

e) Geef nu de nieuwe waarde (na één iteratie) van p(T1 1). • Now specify the new value (after
one iteration) for .p(T1 = IIF = 1).

Q-Learning (2,5 pt)


Beschouw het spelbord in figuur. 1. S is de begintoestand voor de speler en de dubbel gemarkeerde
vakjes zijn eindtoestanden. In .eindtoestanden is de enige mogelijke actie exit die een beloning van r
= 1 geeft in toestand El en een beloning r = 10 in E10. In alle andére toestanden kan je enkel naar
een naburig vakje bewegen als actie. We gebruiken steeds eeri discount factor van = 1 en een
learning rate theta.

• Consider the playing grid in figure 1. S is the starting state for the player and the double squares
are exit states. At exit states the only action available is exit, which .earns a reward of r = 1 in state
El and a reward of r in EIO. In the other states the available actions are to move to a neighbouring
square: We will always assume a discount factor of T' = 1 and the learning rate rl throughout this
question.
We gebruiken de volgende formule voor Q-learning. • We use the following formula for Q-learning

El
S A E10

Figure 1: Het spelbord waarin de speler acties kan nemen. The grid in which the player can move by
taking actions.

10
a) Wat zijn de optimale waardes voor S en A? • What are the optimal values of S and A?

.40
b) We gaan Q-learning met een learning rate = 0.5 gebruiken om een strategie te vihden voor dit
bordspel, Initieel stellen we alle Q-waardes gelijk aan nul. We spelen voor twee episodes ei
verkrijgen de opeenvolging van transities weergegeven in tabel 2. e We will use Q-learning with
a learning rate = 0.5 to obtain a playing strategy on this grid. Initially all the Q-values are set to
zero. We play for two episodes and obtain the following sequence of transitions in table 2.

Table 2: Sequenties van transities voor twee episodes in Q-learning. • Sequence of transitions for two
episodes of Q-learning.

Omcirkel de Q-waardes die verschillend zijn van nul na deze episodes. e Circle the Q-values that will be
non-zero after these episodes.

c) Waar convergeren deze Q-waardes naartoe indien we deze episodes steeds blijven herhalen met
een donstante learning rate van r) = 0.5? Antwoord none indieri ze niet Convergeren. • What do
the Q-values converge to if these episodes are repeated infinitely often with a constant learning
rate of = 0.5? Write none if they do not converge.
Q(S, →)

d) Beschouw nu hetzelfde spelbord, met het verschil dat er nu een wervelwind is verschenen op
vakje A. In de wervelwind is de enige mogelijke actie escape, die de speler naar een
willekeurig naburig vakje brengt met gelijke waarschijnlijkheid. • Now consider the same grid
except a vortex has appeared at square A. When inside the vortex the only available action is
escape, which brings the player to a neighbouring square chosen uniformly at random.
Wat zijn nu de optimale waardes voor S en A met de toevoeging van de wervelwind? • What
are now the optimal values of S and A with the vortex added to the grid?

e) Beschouw nu de volgende twee opeenvolgingen van transities in tabel 3. c Now consider the
following two sequences of transitions in table 3.

11
Table 3: Two sequences of transitions, with two and three episodes respectively, for the vortex grid.

'Waar convergeren de volgende Q-waardes naartoe indien de opeenvolging Tl steeds herhaald

wordt en de learning .ràte op een gepaste manier afneemt? Antwoord none indien een waarde
niet convergeert. e What do the Q-values converge to if .the sequence Tl is repeated infinitely
often with appropriately decreasing learning rate? Write none if a value does not converge.

QTI (S, -4)


QTI (A, escape) =

f) Wat als de opeenvolging T2 steeds herhaald wordt? • What if the sequence T2 is repeated
infinitely often instead?

QT2( S, →)

QT2 (A, escape)

12
g) Wat is het. werkelijke optimum Q* (S, →) voor het spelbord met de wervelwind? Omcirkel het
juiste antwoord. • What is the true optimum Q* (S,→) for the vortexgrid? Circle the correct
answer.
QTI (S, →) QT2(S, →) other

h) Convergeren de Q-waardes in het Q-learning algoritme indien toestand-actie paren arbitrair vaak
worden tegengekomen en een constarite learning rate van theta = 1 gehanteerd wordt? Omcirkel
het juiste antwoord in het geval met en zonder de wervelwind. • Does the Q-learning algorithm
with constant learning rate theta = 1 converge when visiting state-actions infinitely often for the
grid with and without the vortex? Circle the right answer for both cases.

No vortex:

With vortex

13

You might also like