CS33: Exam 2 Study Guide

Remember that you can bring a one-page, two-sided handwritten cheat sheet. You're welcome to re-use the original one, and add to the backside of it.

Issues with Data

  1. Describe and explain each of the following types of data bias:
  2. What does it mean for a feature to be a proxy for another feature? Why might this be a concern for protected characteristics (e.g. race, gender)?
  3. What is class imbalance, and why is it a concern?
  4. Consider a binary classification problem that consists of two subgroups A and B shown below. A plus sign indicates that the classifier should respond True and a minus sign indicates that the classifier should respond False. What issues might arise when trying to create a classifer for this data set? How could we address these issues?
    plots of datasets

Dimensionality Reduction

  1. What is the "curse of dimensionality?"
  2. What is the difference between feature selection and feature engineering?
  3. For Principal Component Analysis (PCA), what information does the first principal component capture?
  4. Consider the three plots A, B, C below. Draw the first principal component, and rank the datasets based on how useful you would expect PCA would be.
    plots of datasets
  5. Consdier the three scree plots A, B, C below.
    scree plots
  6. For each of these possible uses of PCA, describe what it is, why we might want to do it, and how it differs from the other two:
  7. What is the difference between a transformation and an embedding?
  8. Why might t-SNE be a better choice for visualization than PCA?
  9. Why might PCA be a better choice for pre-precessing than t-SNE?

Evaluating Models

  1. What is generalization error?
  2. Why is so much caution needed when trying to measure generalization error?
  3. Describe the difference between hold-out validation, repeated hold-out validation, and k-fold cross-validation.
  4. Of these three validation methods, which is preferred, and why?
  5. If you performed k-fold cross-validation with k=5 on a data set with 200 examples:
    1. How many examples would be used for testing in each run?
    2. How many examples would be used for training in each run?
    3. How many runs would be required?
  6. Consider the following confusion matrix, for a 3-class problem, answer the questions below:
    Predicted A Predicted B Predicted C
    True A 24 7 4
    True B 3 19 8
    True C 9 7 35
    1. What is the accuracy?
    2. If you treat class A as 'positive' and everything else as 'negative', what is the precision?
    3. If you treat class A as 'positive' and everything else as 'negative', what is the recall?
    4. If you treat class A as 'positive' and everything else as 'negative', what is the F1 score?
  7. Describe what overfitting means, when it might happen, how we could detect it, and what you might try to do in order to fix it.
  8. Describe what underfitting means, when it might happen, how we could detect it, and what you might try to do in order to fix it.
  9. Give an example of a problem where accuarcy would be a misleading performance metric; explain why the problem occurs, and what might be done about it.
  10. Consider the plots A, B, C below. Match each plot to one of the following diagnoses and give one reason.
    plots training and testing loss
  11. List the hyperparameters for Logistic Regression.
  12. List the hyperparameters for a fully-connected feed-forward neural network (aka MLP).
  13. Describe the grid search method for finding hyperparameters.
  14. Describe the pros and cons of this method compared to just manually trying out a bunch of different values.

Modeling Text

  1. If we had a neural network with five output nodes that used the softmax activation function, what would the sum (total) of the output node activities be?
  2. What makes working with text data difficult compared to things like the Iris or Titanic datasets?
  3. What is difference between tokenizing, vectorizing, encoding?
  4. What is the input to a transformer?
  5. What is a transformer predicting?
  6. What role does attention play in this process?
  7. Why do we need multiple attention heads in a module?
  8. Why do we stack attention modules?
  9. Once we've trained a transformer, what other steps are needed to turn it into a chatbot?
  10. What other steps are needed to turn it into an agent?
  11. What is compression and why is it necessary?
  12. How can compression be harmful?

Modeling Images

  1. When working with images, what are the advantages of using CNNs over MLPs?
  2. What are some of the hyperparameters that must be set for CNNs?
  3. Why do we prefer filters to be square and odd number side-lengths?
  4. What is the role of convolution?
  5. What is the role of pooling?
  6. Why are skip connections helpful in very deep networks?
  7. For the following CNN convolutional layer descriptions, calculate the number of parameters (i.e. learnable weights). The 'input' is the size of the previous layer, and 'filters' lists first the number of filters, then their size:
    1. input: 32x32 -- filters: 8 @ 5x5
    2. input: 64x64x3 -- filters: 32 @ 3x3
    3. input: 16x16x128 -- filters: 128 @ 3x3
  8. What are the tradeoffs between using a CNN vs a ViT
  9. What is the goal of CLIP training?
  10. Why is CLIP training helpful for models that use both images and text?
  11. What role does 'noise' play in models that generate images?

Ethics

  1. For each of the 4 frameworks we covered, give a one sentence summary of its main points.
  2. For each framework describe at least one strength and one weakness or drawback.
  3. Consider the following proposed actions, and apply the different ethical frameworks to it. Describe what results you get from each, and how they are similar and different. Discuss how you feel about these conclusions, whether you think the frameworks are appropriate to apply in this situation, and why.
    1. Randomly select one individual to be an organ doner; that individual will die, but 5 others will live who otherwise would not (one each for the heart, liver, lungs, and two kidneys).
    2. Increase taxes on the richest 1% to pay for increased social wellfare programs (there will be a small amount of unavoidable inefficiency due to overhead, so the money distributed will be slightly less than the money brought in).
    3. Limit campaign contributions to $1000 per individual, and do not allow political spending by outside groups.
    4. Mandate that the Swarthmore Dining Center can only have one option available for each meal, and ensure it is the cheapest of the existing options for that meal. Pass on the savings to students.
    5. Implement a course policy that students can decide their own course grades.
    6. For CS33 Exam 2, automatically remove 5 points from the highest exam score and add it to the lowest exam score.
    7. Go to a party the night before CS33 Exam 2, and enjoy yourself responsibly.
    8. Go to a party the night before CS33 Exam 2, and enjoy yourself irresponsibly.
  4. Given each proposal, apply Ethical Stakeholder Analysis (draw the stakeholder hieracrchy and analyze the impacts):
    1. Allow Amazon package delivery by flying drones.
    2. Have the Swarthmore Admissions staff use LLMs to help evaluate prospective student applications.
    3. Change the course policy for CS33 to allow unlimited use of AI systems for doing labs.