EXAMPLE Machine Learning (C395) Exam Questions
EXAMPLE Machine Learning (C395) Exam Questions
(1) Question: Explain the principle of the gradient descent algorithm. Accompany
your explanation with a diagram. Explain the use of all the terms and constants
that you introduce and comment on the range of values that they can take.
(2) Question: Derive the gradient descent training rule assuming that the target
function representation is:
od = w0 + w1x1 + … + wnxn.
∑d D 2(td – od) (–∂od / ∂wi) = –∑d D 2(td – od) (∂(w0 + … + wixid + … + wnxnd) /
∈ ∈
From (2) à (∂E / ∂wi) = –∑d D 2(td – od)xid à –(1/2xid)(∂E / ∂wi) = (td – od)
∈
Instance Classification a1 a2
1 + T T
2 + T T
3 - T F
4 + F F
5 - F T
6 - F T
Solution:
Entropy E(S) = E([3+, 3-]) = -(3/6) log2 (3/6) - (3/6) log2 (3/6) = 1.
Gain (S, a2) = E(S) – (4/6)E(T) – (2/6)E(F) = 1 – 4/6 – 2/6 ≈ 0.
E(T) = E([2+, 2-]) = 1.
E(F) = E([1+, 1-]) = 1.
(5) Question: Suppose that we want to build a neural network that classifies two
dimensional data (i.e., X = [x1, x2]) into two classes: diamonds and crosses. We
have a set of training data that is plotted as follows:
X2
X1
Draw a network that can solve this classification problem. Justify your choice of
the number of nodes and the architecture. Draw the decision boundary that your
network can find on the diagram.
Solution:
A solution is a multilayer FFNN with 2 inputs, one hidden layer with 4 neurons
and 1 output layer with 1 neuron. The network should be fully connected, that is
there should be connections between all nodes in one layer with all the nodes in
the previous (and next) layer. We have to use two inputs because the input data
is two dimensional. We use an output layer with one neuron because we have 2
classes. One hidden layer is enough because there is a single compact region
that contains the data from the crosses-class and does not contain data from the
diamonds-class. This region can have 4 lines as borders, therefore it suffices if
there are 4 neurons at the hidden layer. The 4 neurons in the hidden layer
describe 4 separating lines and the neuron at the output layer describes the
square that is contained between these 4 lines.
(6) Question: Suppose that we want to solve the problem of finding out what a
good car is by using genetic algorithms. Suppose further that the solution to the
problem can be represented by a decision tree as follows:
size
large small
mid
brand no sport
yes
Volvo BMW SUV engine no
no yes no
F12 V10 V8
no yes no
What is the appropriate chromosome design for the given problem? Which
Genetic Algorithm parameters need to be defined? What would be the suitable
values of those parameters for the given problem? Provide a short explanation
for each.
What is the result of applying a single round of the prototypical Genetic
Algorithm? Explain your answer in a clear and compact manner by providing
the pseudo code of the algorithm.
Solution:
size = {large, mid, small} → 100, 010, 001, 011, …, 111, 000
brand = {Volvo, BMW, SUV} → 100, 010, 001, 011, …, 111, 000
sport = {yes, no} → 10, 01, 11, 00
engine = {F12, V12, V8} → 100, 010, 001, 011, …, 111, 000
GoodCar = {yes, no} → 10, 01, 11, 00
→ chromosome design:
size brand sport engine GoodCar
100 100 11 111 01
Fitness function for the given problem can be defined as a Sigmoid function f(x)
= 1 / (1+ e-x), where x is the percentage of all training examples correctly
classified by a specific solution (chromosome).
Selection method – e.g., rank selection method can be used;
Crossover technique – 2-point crossover can be used for the given problem with
a crossover mask 1111110000011; the reason is that either size + brand or
sport + engine define the solution
Crossover rate – usually k = 60%
Mutation rate – usually 1%
Termination condition – e.g., all training examples are correctly classified
GA pseudo code:
Step 1: Choose initial population.
Step 2: Evaluate the fitness of individuals in the population.
Step 3: Select k individuals to reproduce; breed new generation through
crossover and mutation; evaluate the individual fitness of offspring; replace k
worse ranked part of population with offspring.
Step 4: Repeat step 3 until the termination condition is reached.