Introduction to Machine Learning - Mock Exam 4
Questa pagina non ha ancora la versione ripasso: qui sotto c'è il testo completo.
In questa pagina 14
The written tests of this course are not public. This mock exam is therefore built only on the notes of the course (learning and data, perceptron and its convergence bound, ADALINE, logistic regression, nearest neighbour, linear regression, Bernoulli likelihood, classification metrics, model selection, and the Python notebooks). The questions and the data are new: it is not a copy of any real test. The official format, from the course description, is continuous activities on the course platform and a final closed-book written test. The format used here is a proposal of this site, not declared by the course: 10 multiple-choice questions worth 1.5 points each and 3 problems worth 5 points each, for a total of 30 points, in 90 minutes, with four options per question and exactly one correct option.
Conventions used in the whole test: every input vector used with a weight vector contains the constant coordinate , so and ; labels are for ADALINE and for logistic regression; in the multi-class problem the classes are ; and are the natural logarithm.
How to use it: work with a timer, write each formula in letters before putting the numbers in, and look at the "Result" only when a question is finished.
Question 1
The first lecture quotes the definition of learning as "an adaptive change in behaviour caused by experience". How do the notes read machine learning in the light of this definition?
- A) The experience is the hypothesis set, and the change in behaviour is the collection of the historical data.
- B) The lecture says that the best way to build intelligent systems at present seems to be writing the rules by hand, so learning is only a side tool.
- C) The experience is a set of data, and the change in behaviour is the choice of a function (the hypothesis) that will be used on new inputs.
- D) The lecture says that adaptive behaviour comes from evolution only, so learning from experience plays no role.
Show the result
C
Show the full solution
C is correct: in Introduction to Machine Learning - Learning, Data and TasksMachine learning builds a hypothesis g that approximates an unknown target function f using only a set of historical examples (input, output). The course lecture frames learning as adaptive behaviour, shows through the credit-approval example the components of learning (input x, output y, target f, data, hypothesis g, hypothesis set, learning algorithm) and warns that a model is only as unbiased as its data. Tasks named in the course are classification and regression, supervised and non-supervised problems.Introduction to Machine Learning - Learning, Data and Tasks → machine learning is "the second definition made concrete": the experience is a set of data, and the change in behaviour is the choice of the hypothesis that is used on new inputs. A swaps the two roles. B is false: the slide states that the best way to build intelligent systems at present seems to be learning and inference. D is false: the note says that biological systems developed adaptive behaviour through learning and evolution, and that the capstone of adaptive behaviour is learning and intelligence.
Question 2
Which statement about the tasks named in the course is correct?
- A) Deciding whether credit is approved (good or bad customer) is a regression task, because the decision is stored as a number.
- B) In classification the output is a class label and in regression it is a real number; every example of the course material comes with its output , so the material is supervised.
- C) The perceptron notes use , so the perceptron solves a regression task.
- D) The lectures of the course develop clustering and the other non-supervised methods in detail, with worked examples.
Show the result
B
Show the full solution
B is correct: in Introduction to Machine Learning - Learning, Data and TasksMachine learning builds a hypothesis g that approximates an unknown target function f using only a set of historical examples (input, output). The course lecture frames learning as adaptive behaviour, shows through the credit-approval example the components of learning (input x, output y, target f, data, hypothesis g, hypothesis set, learning algorithm) and warns that a model is only as unbiased as its data. Tasks named in the course are classification and regression, supervised and non-supervised problems.Introduction to Machine Learning - Learning, Data and Tasks → classification has a class label as output (in the perceptron notes ) and regression a real number, and all the material of the course source is supervised, since every example comes with its output . A is false: the output of the credit example is a good or bad customer, a class. C is false: labels and are class labels, so the perceptron is a classifier. D is false: clustering and the other non-supervised methods are in the official program, but the notes state that there is no lecture material on them.
Question 3
All the points of a data set satisfy with . There is a unit vector with for every point, with . The Perceptron Learning Algorithm starts from . Which statement is guaranteed by the theorem of the course?
- A) The algorithm makes at most updates.
- B) The algorithm makes at most updates.
- C) The algorithm makes exactly updates.
- D) The algorithm makes at most passes over the data.
Show the result
A
Show the full solution
The theorem of Perceptron Convergence and the Margin BoundThe distance of a point x from the hyperplane w^T x + b = 0 is |w^T x + b| / sqrt(w^T w), obtained by writing x = x_p + gamma with gamma parallel to w. If the data are linearly separable with margin gamma (a unit vector w* with y_i w*^T x_i >= gamma for all i) and every point lies in a ball of radius R, the Perceptron Learning Algorithm makes at most K <= R^2 / gamma^2 updates. Proof: after K updates w_{K+1}^T w* >= K gamma, hence norm of w_{K+1} >= K gamma; and norm of w_{K+1} squared <= K R^2; combine.Perceptron Convergence and the Margin Bound → says , with the number of updates. Here , so A is correct. B is : the squares are missing. C is false: the bound is only an upper limit, the algorithm may stop much earlier. D is false: the bound counts updates, not passes over the data (a pass may contain many updates or none).
Question 4
In the first notebook, NumPy arrays are defined as x = np.array([ [2, 1, 0], [-1, 3, 2] ]) and y = np.array([1, 2, -1]). Which statement is correct?
- A)
np.dot(x, y)returns[4, 7]. - B)
np.dot(x, y)returns[4, 3], butnp.inner(x, y)signals an error, becausexis not square. - C)
np.dot(x, y)returns the single number7, the sum of all the products. - D)
np.dot(x, y)returns[4, 3], andnp.inner(x, y)returns the same vector.
Show the result
D
Show the full solution
In Python Notebooks - Random Samples, Plots and Linear Algebra with NumPyThe first course notebook draws random samples with NumPy (uniform with np.random.rand, normal and exponential), plots them with matplotlib (line and scatter plots, histograms compared with the theoretical density from scipy.stats), and shows the NumPy products used later: np.dot and np.inner between a matrix and a vector and between two matrices, with the transpose. This note reproduces the code of the notebook "matplotlib, random numbers and statistics" with the meaning of each call.Python Notebooks - Random Samples, Plots and Linear Algebra with NumPy → a matrix times a vector multiplies each row of the matrix by the vector: row gives and row gives , so np.dot(x, y) is [4, 3]; in the notebook np.inner(x, y) gives the same result for a matrix and a vector. So D is correct. A has the sign of the last product wrong in the second row (). B is false: np.inner works on these shapes, and no squareness is required. C is false: the result has one entry for each row of x, it is not a single number.
Question 5
For an object, the probability of the positive class given by a logistic-regression model is . Which statement is correct?
- A) The odds are and the logit is , which is negative: the object goes to class .
- B) The odds are and the logit is : the object goes to class .
- C) The odds are and the logit is .
- D) The odds are and the logit is , because the logit is a positive number.
Show the result
A
Show the full solution
In Logistic RegressionLogistic regression models the probability p of the positive class: the logit (log of the odds p/(1-p)) is assumed linear in the input, logit(p) = w^T x = z. Inverting it gives p = 1/(1 + e^(-z)), the logistic sigmoid; an object goes to class 1 when the sigmoid exceeds 0.5, i.e. when z > 0. The parameters are learned by maximising the Bernoulli log-likelihood, equivalently minimising the cost J = -y log(yhat) - (1 - y) log(1 - yhat), by gradient descent with gradient (1/m) X^T (h(x) - y).Logistic Regression → the odds are and the logit is the logarithm of the odds, . The logit is negative for , so and the object is assigned to class (class needs ): A is correct. B inverts the ratio (positive over negative class is , not ). C takes the probability itself as the odds. D is false: the logit maps onto the whole real line, negative below and positive above.
Question 6
A data set has objects, each described by two features and belonging to one of three classes . Which description of the setting of nearest neighbour in the notes is correct?
- A) The data matrix is , with one column per object, and the class of a test point is decided by the classes of the training points around it.
- B) The data matrix is , with one column for each class, and the class of a test point is read from the column with the largest entry.
- C) The data matrix is , with one row per object and one column per feature, and the class of a test point is decided by the classes of the training points close to it.
- D) The data matrix is , and the class of a test point is decided by a weight vector found in a long training phase.
Show the result
C
Show the full solution
C is correct, as in Nearest NeighbourK-nearest neighbours (KNN) has an almost empty training phase (the data are just stored) and does all the work at test time: given a point, compute its distance from all training points, sort the distances, keep the K shortest and predict the (weighted) majority class among them. The course source has one handwritten page on it; the notebooks use it as one of six scikit-learn classifiers, and the model-comparison example contrasts KNN with K=1 and K=5.Nearest Neighbour →: the objects are collected in a data matrix with columns and one row per object (here ), and the class of a test point is decided by the classes of the training points around it (the nearest ones). A transposes the matrix: the notes put one row per object. B is false: the columns are the features , not the classes. D is false: the training phase does almost nothing (the data are stored), no weight vector is learned, and the work is done at test time.
Question 7
A linear hypothesis is fitted to the four samples : , , , , with the closed form and the first column of made of ones. What is ?
- A)
- B)
- C)
- D)
Show the result
B
Show the full solution
The normal equations are and . The first gives ; in the second, , so and : B is correct. A swaps the two weights. C solves each equation as if were diagonal ( and ), ignoring the off-diagonal entries . D comes from a wrong sign in the off-diagonal entries of the inverse matrix.
Question 8
In tosses of a coin, heads came up times. The log-likelihood of the Bernoulli parameter is . Which statement is correct?
- A) The maximum likelihood estimate is and the derivative is .
- B) The maximum likelihood estimate is and the derivative is .
- C) The maximum likelihood estimate is and the derivative is .
- D) The maximum likelihood estimate is and the derivative is , so is still increasing at .
Show the result
D
Show the full solution
In Bernoulli Distribution and Maximum Likelihood EstimationA binary outcome (heads = 1, tails = 0) is modelled by a Bernoulli distribution with parameter theta: P(x | theta) = theta^x (1 - theta)^(1 - x). For independent identically distributed observations the likelihood is the product of the single probabilities; with K heads in n tosses it is L(theta) = theta^K (1 - theta)^(n - K). Maximising the log-likelihood l(theta) = K log theta + (n - K) log(1 - theta) (maximum likelihood estimation) gives theta = K / n.Bernoulli Distribution and Maximum Likelihood Estimation → the derivative is (the factor comes from the chain rule on ), and setting it to zero gives . At : : the log-likelihood is still increasing there, consistently with a maximum at . So D is correct. A uses the fraction of tails. B forgets the factor and adds . C would need ( is false): the estimate is the observed fraction of heads, not .
Question 9
Which statement about the comparison of two models with a statistical test, as in the notes, is correct?
- A) The null hypothesis is that the two models perform equally; the t-test is parametric (it assumes a distribution for the scores) and the Wilcoxon test is non-parametric (it does not).
- B) The null hypothesis is that the two models perform differently, and the test tries to confirm it.
- C) The t-test is non-parametric and the Wilcoxon test is parametric.
- D) Both the t-test and the Wilcoxon test assume a distribution for the scores, the bell curves drawn in the notes.
Show the result
A
Show the full solution
A is correct: Model Selection and Validation - Hold-Out, k-Fold and Statistical TestsTo decide which of two models is better, fix their hyper-parameters, train each on a training set (this fits the parameters, the vector w or theta) and measure a performance score such as F1 on a separate test set; one split is too fragile, so the hold-out is repeated K times (or K-fold cross-validation is used) and the paired scores of the two models are compared with a statistical test. The null hypothesis H0 is that the two models perform equally; the significance level alpha is fixed before the experiment, and the p-value is the probability of observing the obtained differences under H0. Parametric test: t-test; non-parametric: Wilcoxon.Model Selection and Validation - Hold-Out, k-Fold and Statistical Tests → states that the null hypothesis (, the initial one) is that the two models perform equally and that the test asks whether the data are compatible with it; the t-test is the parametric test (the sketch draws two assumed bell curves) and the Wilcoxon test is the non-parametric one, which does not assume a distribution. B is false: is equivalence, not difference. C swaps the two tests. D is false: the bell curves belong to the parametric test, while the Wilcoxon test does not assume a distribution (it is the one used in Python Notebooks - scikit-learn Model Comparison and Wilcoxon TestTwo example notebooks compare six scikit-learn classifiers (logistic regression, perceptron, KNN, decision tree, SVC, random forest) on a real data set loaded from the UCI repository: hold-out split with train_test_split, F1 score, k-fold cross-validation with cross_validate and scoring f1_macro, box plots of the fold scores, and the Wilcoxon signed-rank test (scipy.stats.wilcoxon) on the paired fold scores; the second notebook adds a stratified test set, more folds on the best models and the final training and test of the chosen model. A separate short notebook draws two normal samples to see how often the Wilcoxon test rejects at the 0.05 level.Python Notebooks - scikit-learn Model Comparison and Wilcoxon Test →).
Question 10
With line = 'a quick red fox, a quick red hare', which statement about the string methods of the course notebook is correct?
- A)
line.find('quick')returns1. - B)
line.startswith('quick')returnsTrue. - C)
line.replace('quick', 'slow', 1)returns'a slow red fox, a quick red hare'. - D)
line.partition('xyz')returns('a quick red fox, a quick red hare',), a tuple with one element.
Show the result
C
Show the full solution
In Python Notebooks - Strings and Regular ExpressionsNotebook on Python strings: quoting (single, double, triple quotes), case methods (upper, lower, title, capitalize, swapcase), removing characters at the ends (strip), searching and replacing (find, startswith, endswith, replace, partition), splitting (split, splitlines), and a first use of regular expressions with the re module (search, findall, sub) with the anchors for start and end of string, the dot, the star, the plus and character classes.Python Notebooks - Strings and Regular Expressions → the third argument of replace is the maximum number of replacements, so only the first quick is replaced and C is correct. A is false: find returns the index where the substring starts, and 'quick' starts at index 2 ('a' is at 0 and the space at 1). B is false: the string starts with 'a ', so startswith('quick') is False. D is false: when the separator is not found partition returns a tuple of three elements, the whole string followed by two empty strings.
Problem 1 (points 5)
A node has four binary inputs and weights . The rule is: the node fires (output ) when is greater than the threshold, and does not fire (output ) when the sum is less than or equal to the threshold. The threshold is .
a) For the inputs , and compute the weighted sum and say whether the node fires (1 point).
b) Write the bias trick: the weight vector , the three input vectors and the three values . What is the rule in terms of (1 point)?
c) Among the binary inputs, list those on which the node fires. How many fire if the threshold is and how many if it is ? Explain the result for (1.5 points).
d) With two inputs and weights , for which thresholds does the node compute "at least one input is " and for which thresholds "both inputs are "? For the threshold write the boundary as and say which of the four corners lie on the firing side (1.5 points).
Show the result
a) Sums , , : the node does not fire on (the sum equals the threshold), fires on , does not fire on .
b) ; the values are , , . The node fires when .
c) It fires on , , , , : inputs. Threshold : inputs (the three with sum are added). Threshold : the same inputs, because every sum is an integer and "greater than " is the same as "greater than ".
d) "At least one input is " (the sums are ): threshold in . "Both inputs are ": threshold in . For the boundary is and only the corner is on the firing side.
Show the full solution
a) Sums. The weighted sum is .
- : . The sum equals the threshold, and the rule says the node fires only when the sum is greater than the threshold: it does not fire ().
- : : it fires ().
- : : it does not fire.
b) Bias trick. The part and the term are merged by adding a constant input with weight , so . The input vectors are , , , and
- ,
- ,
- .
Each value is the weighted sum minus (, , ). The node fires when the sum is greater than the threshold, that is when ; for the value (first input) it does not fire, in agreement with part a.
c) All the inputs. The sum is greater than only if (without it the largest sum is , not greater than ). With the sum is , greater than when . The value of on the eight triples is: , , , , , , , . The positive ones give the inputs that fire: , , , , : five inputs out of sixteen.
With threshold the inputs with sum exactly fire too: , , , so inputs. With threshold the set does not change: the sums are integers, so no sum lies between and , and "greater than " selects the same five inputs as "greater than " (the sums of those five are ).
d) Two inputs. The sums over the four corners are . "At least one input is " means the node fires on the sums and but not on : the threshold must satisfy (greater than the sum fails, smaller than fires). "Both inputs are " means it fires only on the sum : . With threshold the weight is and the boundary is
The firing side is : of the four corners only (sum ) is on it; and have sum .
Typical mistakes: firing when the sum equals the threshold; using ; forgetting the constant input in the vector; reading a threshold of as a different function from when the sums are integers.
Problem 2 (points 5)
The unknown target is and the inputs are drawn with the probabilities
Six independent samples with are drawn: . The hypothesis is the line with the weights of the closed form on the six samples. The squared error is used: on the samples, and on the input distribution.
a) Write the data matrix, and and solve for (1.5 points).
b) Compute (0.5 points).
c) Compute , writing the contribution of each input (1.5 points).
d) How much of comes from the inputs and , and what is the probability that none of the six samples falls there? If the six inputs had the same probability , what would be? What do the numbers show about as a measure of the error on new inputs (1.5 points)?
Show the result
a) , , : .
b) .
c) Contributions for : .
d) The inputs contribute , about 70% of , although . The probability that no sample falls there is . With the uniform probability : . says nothing about the regions without samples, and depends on the input distribution.
Show the full solution
Setting: Linear RegressionIn linear regression the hypothesis is h(x) = w^T x and the in-sample error is E_in(w) = (1/N) sum (w^T x_i - y_i)^2 = (1/N) times the squared norm of (Xw - Y), with X the N-row data matrix. Setting the gradient (2/N) X^T (Xw - Y) to zero gives the normal equations X^T X w = X^T Y and the closed-form solution w = (X^T X)^{-1} X^T Y, where (X^T X)^{-1} X^T is the pseudo-inverse of X; only a small square matrix (number of features) has to be inverted. Polynomial regression is the same formula on a data matrix with columns 1, x, x^2, ...Linear Regression → for the closed form, The Statistical Learning Framework and Empirical Risk MinimizationA hypothesis is judged by an error function computed pointwise on the data and averaged: the in-sample (empirical) error E_in(h) = (1/N) sum of e(f(x_i), h(x_i)); with squared differences it is the sum of squared errors. The learning algorithms of the course all search the hypothesis set for the h with small in-sample error, but what matters is the error on new inputs drawn from the same input distribution, so the data must cover the regions where the inputs live, and part of the data must be held back to check the result.The Statistical Learning Framework and Empirical Risk Minimization → for , the input distribution and .
a) Closed form. The data matrix has the column of ones and the column of the inputs, and the outputs are :
The sums are , , , , so
The normal equations are and . Subtracting the first from the second, , so and . The matrix is invertible (determinant ). Hence .
b) Error on the samples. The values of on the samples are , so the residuals are . Their squares sum to and
c) Error on the whole input distribution. For each input compute , the value of , and :
The terms are , with sum .
d) What the numbers show. but : the error on new inputs is more than three times the error on the samples. The inputs and give , that is (about 70%) of , although they have probability . Each sample falls in with probability , and the samples are independent, so no sample falls in with probability : most of the time the line is built without ever seeing that region. With the same probability for the six inputs the squared differences are and : the same line, with the same , has a very different error on new inputs when the inputs come from a different distribution. This is the point of the notes on the input distribution: the samples crowd where is large, the hypothesis follows there (the contributions of add up to ) and in the regions without samples it is not constrained at all, so the error on the samples is only a proxy for the error on the inputs that will really be seen.
Typical mistakes: dividing by when computing instead of weighting by ; weighting the six squared errors of the table with the same factor; forgetting that the sample contains the input twice and the input three times when building .
Problem 3 (points 5)
An ADALINE unit is trained by stochastic gradient descent on three examples with labels . The data matrix and the labels are
the initial weights are and the learning rate is . The update after each example is the notebook rule , with computed with the current . The in-sample error is .
a) Compute at the initial weights. Then run one epoch with the examples in the order : for each example write the output, the error and the weights after the update, and compute at the end of the epoch (2 points).
b) Starting again from the initial weights, run one epoch with the order and compute at its end (1.5 points).
c) Compare the two epochs. For the example just used, the error after its own update is : compute the factor for the three examples and use it to explain why the first epoch lowers and the second one raises it (1 point).
d) The notebook shuffles the data at every epoch with rand_perm = np.random.permutation(range(y.shape[0])) and loops over zip(X[rand_perm, :], y[rand_perm]). Which rand_perm gives the order of part a)? How many updates does an epoch make here, and how many would a batch epoch make? Why are X and y indexed with the same permutation? (0.5 points)
Show the result
a) . Example 3: output , error , . Example 2: output , error , . Example 1: output , error , . At the end: outputs , .
b) Example 1: output , error , . Example 2: output , error , . Example 3: output , error , . At the end: outputs , .
c) The factors are , , for examples . The example (large ) multiplies its own error by : it overshoots. If it comes first its error is small () and the later updates correct the result; if it comes last with a large error () nothing corrects it, and ends at , above the starting . The final weights depend on the order.
d) rand_perm = [2, 1, 0] (indices start from ). updates in the stochastic epoch, in a batch epoch. The same permutation keeps every row of X paired with its label.
Show the full solution
Setting: ADALINE and Gradient DescentADALINE is a perceptron whose activation function is the identity: during training the unit outputs w^T x and the in-sample error E_in = (1/N) sum (y_i - w^T x_i)^2 is minimised by gradient descent, w_new = w_old - eta * grad E_in, with partial derivatives dE_in/dw_j = (2/N) sum (y_i - w^T x_i)(-x_i^j) and matrix form grad E_in proportional to -X^T (Y - X w). The prediction is still the sign of w^T x. Learning rate eta sets the step size and a stopping rule ends the iteration.ADALINE and Gradient Descent → for the error and the update, Python Notebooks - Perceptron and ADALINE from ScratchCode of the course notebooks that implement the Perceptron Learning Algorithm first with Python lists, then with plots of the successive lines, then with NumPy arrays (data matrix X with a column of ones, update w + eta * y * x on mistakes, epoch counter), and finally ADALINE: batch gradient descent with delta_w = eta * 2 * X^T (y - X w) / N and the stochastic version that shuffles the data and updates after every example. Differences between the versions (condition for a mistake, learning rate, stopping rule) are pointed out.Python Notebooks - Perceptron and ADALINE from Scratch → for the stochastic version (shuffling and the update with one example at a time), Python Notebooks - Random Samples, Plots and Linear Algebra with NumPyThe first course notebook draws random samples with NumPy (uniform with np.random.rand, normal and exponential), plots them with matplotlib (line and scatter plots, histograms compared with the theoretical density from scipy.stats), and shows the NumPy products used later: np.dot and np.inner between a matrix and a vector and between two matrices, with the transpose. This note reproduces the code of the notebook "matplotlib, random numbers and statistics" with the meaning of each call.Python Notebooks - Random Samples, Plots and Linear Algebra with NumPy → for np.dot and the shapes.
a) The epoch . At the start only is not zero and every row has , so all the outputs are and the errors are , , , with squares , , :
The update is (since ), and each error uses the weights as they are at that moment.
- Example , , : output , error , correction , so .
- Example , , : output , error , correction , so .
- Example , , : output , error , correction , so .
At the end the outputs are , and . The errors are , , , with squares , , , so : down from .
b) The epoch .
- Example , , : output , error , correction , so .
- Example , , : output , error , correction , so .
- Example , , : output , error , correction , so .
At the end the outputs are , and . The errors are , , , with squares , , (sum ), so : much larger than at the start.
c) Why the two epochs differ. After the update on example , the output on that example is , so its new error is (computed here, it follows from the update rule). With and the factors are , and . For examples and the error shrinks or vanishes; for example the factor has absolute value larger than : the update overshoots and its error is multiplied by (check: , the output goes from to ). In the order this happens at the start with a small error () and the two later updates, with factors and , bring the errors back down. In the order example is last, with an error of that has grown during the epoch, and the overshoot is not corrected within the epoch: the three errors end up between and . So one epoch of SGD does not always lower : the result depends on the order of the examples and on the size of compared with (the notes: the learning rate sets the step size, the result depends on where the steps start and how long they are). This is why the notebook shuffles the data at every epoch, and why a smaller is used there.
d) NumPy. The order is the permutation of the indices (counting from ): X[rand_perm, :] is the matrix with the rows in the order and y[rand_perm] the labels in the same order. With X of shape and y, w of shape , each step is error = yi - np.dot(xi, w) (a number, with xi of shape ) and delta_w = eta * 2 * xi * error (shape ). The loop makes updates per epoch; the batch version, delta_w = eta * 2 * np.dot(np.transpose(X), errors) / X.shape[0], makes one. The same permutation is applied to X and to y so that every row stays paired with its own label: shuffling only the rows would attach the labels to the wrong examples.
Typical mistakes: computing all three errors with the initial weights (the weights change after every example); forgetting the factor of the derivative; using the weights of the end of the epoch in the errors; reading a larger after an epoch as an arithmetic error instead of a too large step; shuffling the rows without the labels.
Self-assessment grid
| item | points | what must be there for full points | typical mistakes |
|---|---|---|---|
| Question 1 | 1.5 | C: experience is the data, change in behaviour is the choice of the hypothesis | swapping the roles; attributing adaptive behaviour to evolution only |
| Question 2 | 1.5 | B: classification gives a class label, regression a real number, the material is supervised | credit approval as regression; perceptron as regression; clustering developed in the lectures |
| Question 3 | 1.5 | A: updates at most | ; reading the bound as exact; counting passes |
| Question 4 | 1.5 | D: row by row products, [4, 3], same result for np.inner |
sign slip; thinking np.inner needs a square matrix; a single number |
| Question 5 | 1.5 | A: odds , logit , class | inverted ratio; probability used as odds; positive logit |
| Question 6 | 1.5 | C: , one row per object, classes of the nearby training points | transposed matrix; one column per class; learned weight vector |
| Question 7 | 1.5 | B: and , normal equations, | swapped weights; ignoring the off-diagonal entries; wrong sign in the inverse |
| Question 8 | 1.5 | D: , derivative at | fraction of tails; missing factor ; fair-coin estimate |
| Question 9 | 1.5 | A: equal performance, t-test parametric, Wilcoxon non-parametric | swapping the tests; as difference |
| Question 10 | 1.5 | C: third argument of replace is the maximum number of replacements |
index of find; startswith; partition without separator |
| Problem 1 | 5 | sums and the firing decisions (1); and values (1); the five firing inputs and the counts and for thresholds and (1.5); thresholds of the two logic functions and the boundary (1.5) | firing when the sum equals the threshold; ; missing constant input |
| Problem 2 | 5 | , , (1.5); (0.5); with the contribution of each input (1.5); the 70% share of the inputs , probability , for the uniform probability and the comment (1.5) | without the weights ; wrong counts in ; the same weight for every input |
| Problem 3 | 5 | , the three updates with the weights , , and (2); the order with (1.5); factors , , and the explanation (1); permutation , updates against , same permutation (0.5) | errors with the initial weights; missing factor ; a larger read as an arithmetic error; shuffling rows without labels |
| Total | 30 |