CS256 Fall 2021 Practice Midterm

Studying for one of my tests does involve some memorization. I believe this is an important skill. Often people waste a lot of time and fail to remember the things they are trying to memorize. Please use a technique that has been shown to work such as the method of loci. Other memorization techniques can be found off the Wiki Page for Moonwalking with Einstein. Given this, to study for the midterm I would suggest you:

  • Know how to do (by heart) all the practice problems.
  • Go over your notes at least three times. Second and third time try to see how much you can remember from the first time.
  • Go over the homework problems.
  • Try to create your own problems similar to the ones I have given and solve them.
  • Skim the relevant sections from the book.
  • If you want to study in groups, at this point you are ready to quiz each other.

The practice midterm is below. Here are some facts about the actual midterm: (a) It is closed book, closed notes. Nothing will be permitted on your desk except your pen (pencil) and test. (b) You should bring photo ID. (c) There will be more than one version of the test. Each version will be of comparable difficulty. (d) One problem (less typos) on the actual test will be from the practice test.

Work in your assigned groups to solve your assigned problems below. Post your solutions to the Practice Midterm Solution Thread.

  1. Briefly describe the following machine learning tasks: (a)Classification with Missing Inputs, (b) Anomaly Detection, (c) Synthesis and Sampling, (d) Density Estimation.
  2. Suppose we roll a 6-sided dice three times, (a) what is the expected value of the sum of the values of the dice? (b) Using Markov's inequality, give an upper bound on the probability of this sum being greater than 12. (c) Give an example of a pair of 3x3 matrices such that AB!=BA.
  3. Let `alpha=1.5`. Suppose our current weight vector is [6,4,2] and `theta=1`. The training example `x=[0.5,1,1]` is a false positive. How would the perceptron rule update `vec w` and `theta`? How would the Winnow rule update`vec w` and `theta`?
  4. Let `f` be the Nested Boolean Function `x_1 vv neg x_2 vv neg x_3 vv cdots vv neg x_n` (only the first input is unnegated). Explictly compute the `w_i`'s needed to show that `f` can be represented by a boolean threshold function
    `w_1x_1 + cdots w_nx_n geq theta_n`,
    with `theta_n = k +1/2` for some integer `k`, `w_i = \pm 2^{i-1}`, and `sum_{w_i<0}w_i < theta_n < sum_{w_i>0}w_i`.
  5. Write a Python function num_examples(n, k, epsilon, delta) which computes the number of training examples needed to PAC-learn an n-bit threshold function from a class of gradual threshold functions to within `epsilon`-error at least `1-delta` fraction of the time.
  6. Prove a two input perceptron cannot compute the XOR function.
  7. Argue every polynomial time 1-tape Turing Machine algorithm can be computed by a threshold circuit of size at most `O(p(n)^2)`.
  8. Briefly explain the update rule used in the S-K algorithm.
  9. Explain how to read in an image foo.png using Pillow, rotate 90 degrees, convert it to 1-byte grayscale, and then get the bytes into a 2D numpy array of the same dimensions as the original image.
  10. Briefly define cross-validation and give one example exhaustive and one example inexhaustive cross-validation technique.