Machine Learning Basics

Learn machine learning with multiple-choice questions, including calculations: supervised, unsupervised and reinforcement learning, classification and regression, k-means and principal component analysis, cross-validation, overfitting and regularization, confusion matrices with precision, recall and F1 score, models such as decision trees, SVMs and naive Bayes, the forward pass and activation functions of neural networks, gradient descent and backpropagation, CNNs, RNNs and the Transformer, transfer learning and generative models.

Practice 10 questionsRandom questions from this topic · about 5 minutes Practice this topicAll questions in this topic, in random order Weak questionsRetry only the questions you last got wrong

Confusion matrix calculator →

CNN output size calculator →

Machine Learning Basics: key points

Machine learning is the technology of learning rules automatically from data in order to make predictions and classifications. There is supervised learning, which uses correct-answer labels; unsupervised learning, which finds structure in unlabeled data; and reinforcement learning, which learns actions from rewards. Whatever the method, what matters is how accurately the model predicts on data not used for training (generalization performance).

This topic covers, mainly through calculation questions, splitting data into training, validation and test sets and cross-validation, overfitting and the bias–variance trade-off, regularization and dropout, precision, recall and the F1 score computed from a confusion matrix, the ROC curve and the mean squared error. After representative models such as linear regression, logistic regression, decision trees, random forests, k-nearest neighbors, SVMs and naive Bayes, it goes on to the forward pass of neural networks, activation functions, loss functions, gradient descent and backpropagation, mini-batches and epochs, output sizes in CNNs, RNNs and the Transformer, transfer learning, generative models and the tokens of LLMs. It also helps with the AI sections of IT certification exams such as Japan's Fundamental and Applied Information Technology Engineer Examinations, and with the JDLA Deep Learning for GENERAL (G-kentei) certificate.

All Machine Learning Basics questions (40)

  1. Which of the following supervised learning tasks is a regression task?
  2. Which of the following is an example of unsupervised learning?
  3. Which of the following describes reinforcement learning?
  4. Which of the following describes the procedure of clustering with k-means (k-means clustering)?
  5. Which of the following describes principal component analysis (PCA)?
  6. When data is split into training, validation and test sets, which of the following is the main use of the validation set?
  7. When 5-fold cross-validation (k-fold cross-validation with k = 5) is performed on 1000 data points, how many data points are used for each round of training?
  8. Which of the following is seen when overfitting is occurring?
  9. Which of the following is correct when a model's error is considered in terms of bias and variance?
  10. Which of the following correctly describes regularization and related methods for reducing overfitting?
  11. Which of the following steps in building a machine learning model causes data leakage (information from the evaluation data slipping into training)?
  12. A two-class classification model was evaluated on 200 test samples, and its confusion matrix shows 45 true positives (TP), 5 false positives (FP), 45 false negatives (FN) and 105 true negatives (TN). Which pair of precision and recall is correct?
  13. A two-class classification model was evaluated on 200 test samples, giving TP = 20, FP = 5, FN = 30 and TN = 145. Which is closest to the F1 score?
  14. Which of the following correctly describes the ROC curve and AUC used to evaluate two-class classification models?
  15. For data of 1000 items of which only 10 are positive, what is the accuracy of a model that predicts every item as negative?
  16. Four data points have actual values 3, 5, 2 and 6, and the model predicts 2, 5, 4 and 4 for them. What is the mean squared error (MSE)?
  17. A straight line y = ax + b is fitted by least squares to the three data points (x, y) = (1, 3), (2, 4) and (3, 8). What is the predicted value at x = 4?
  18. In logistic regression, z = 2x − 4 is passed through the sigmoid function σ(z) = 1 ÷ (1 + e^(−z)) and the result is output as the probability of being positive. What is the output when x = 2?
  19. A node of a decision tree holds 6 data points of class A and 4 of class B. What is the Gini impurity of this node?
  20. Which of the following correctly describes the difference between bagging (random forests and the like) and boosting in ensemble learning?
  21. The class of the 2D point (0, 0) is predicted with k-nearest neighbors. The training data consists of red points (1, 0), (3, 0) and (0, −3) and blue points (0, 2) and (−2, 1). Using Euclidean distance, which pair of predictions for k = 3 and k = 5 is correct?
  22. Which of the following describes a support vector machine (SVM)?
  23. 20% of all emails are spam. A certain word appears in 50% of spam emails and in 5% of non-spam emails. Which is closest to the probability that an email containing this word is spam?
  24. Which logic function cannot be represented by a simple perceptron consisting only of input and output layers (a single neuron that outputs 0 or 1 with a threshold)?
  25. In a three-class classification, the values input to the softmax function (logits) are 3, 1 and 0. About how many times the second class's output (probability) is the first class's output? Which is closest?
  26. A small neural network with inputs x₁ = 1 and x₂ = 2 has two hidden neurons h₁ = ReLU(x₁ + x₂ − 1) and h₂ = ReLU(x₁ − 2x₂ + 1), and output y = 2h₁ + 3h₂ + 1. What is the value of y?
  27. Let p be the probability that a model outputs for the correct class. Which of the following describes the cross-entropy loss −log p used to train classifiers?
  28. In gradient descent, the gradient of the loss ∂L/∂w at weight w = 2.0 is 0.5 and the learning rate is 0.1. What is the weight after one update?
  29. When the derivative dy/dx of y = (2x + 1)² at x = 1 is found by the chain rule with u = 2x + 1 and y = u², which value is correct?
  30. In a neural network with many stacked layers, which of the following is the reason that using the sigmoid function as the activation function makes the layers near the input hard to train?
  31. A model is trained on 10,000 training samples with a mini-batch size (batch size) of 50. How many weight updates are there in one epoch?
  32. How many trainable parameters does a fully connected layer with 64 inputs and 32 outputs (one bias per output) have?
  33. A 28×28 single-channel image is convolved with a 5×5 filter (stride 1, no padding), followed by 2×2 max pooling (stride 2). What are the height and width of the output?
  34. Which of the following correctly describes recurrent neural networks (RNNs) and LSTMs?
  35. Which of the following describes the self-attention used in the Transformer?
  36. Which of the following describes transfer learning, in which a model trained on a large amount of data is used for a different task with little data?
  37. Which of the following correctly describes models that generate images and similar data?
  38. Which of the following describes how a large language model (LLM) processes text?
  39. When building a model that predicts hiring decisions from application documents, using past hiring outcomes as the correct answers, which of the following should be kept in mind?
  40. Which of the following describes explainable AI (XAI)?

Books on Machine Learning Basics Ad

As an Amazon Associate I earn from qualifying purchases.

Other topics in Computer systems