1. Home
  2. Explore
  3. Computer Science
  4. Machine Learning for Beginners

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Machine Learning for Beginners

  • 29Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Machine Learning Fundamentals

What is the primary difference between machine learning and explicit programming?

29 questions

  1. 1

    What is the primary difference between machine learning and explicit programming?

    1. A

      Machine learning is only used for regression tasks, while explicit programming is used for classification.

    2. B

      Machine learning always produces more accurate results than explicit programming.

    3. C

      Explicit programming is a subset of machine learning that uses labeled data.

    4. D

      Machine learning uses data to learn without explicit instructions, while explicit programming requires predefined rules.

    Correct answer
    D

    Machine learning uses data to learn without explicit instructions, while explicit programming requires predefined rules.

    Explanation

    Machine learning algorithms learn patterns from data without being explicitly programmed for every step, unlike traditional programming where rules are hard-coded.

  2. 2

    What distinguishes supervised learning from unsupervised learning?

    1. A

      Unsupervised learning is used for prediction, while supervised learning is used for clustering.

    2. B

      Supervised learning does not require a training set, whereas unsupervised learning does.

    3. C

      Supervised learning only works with numerical data, while unsupervised learning works with categorical data.

    4. D

      Supervised learning uses labeled data to train models; unsupervised learning uses unlabeled data to find patterns.

    Correct answer
    D

    Supervised learning uses labeled data to train models; unsupervised learning uses unlabeled data to find patterns.

    Explanation

    Supervised learning relies on labeled input-output pairs, while unsupervised learning finds structure in data without labels.

  3. 3

    Which of the following is an example of a qualitative nominal feature?

    1. A

      Rating on a scale of 1 to 5

    2. B

      Age in years

    3. C

      Temperature in Celsius

    4. D

      Gender (male, female)

    Correct answer
    D

    Gender (male, female)

    Explanation

    Nominal features are categories with no inherent order, such as gender. Age and temperature are quantitative; ratings are ordinal.

  4. 4

    How are nominal features typically encoded for machine learning models?

    1. A

      Normalization scales values between 0 and 1.

    2. B

      One-hot encoding creates binary columns for each category.

    3. C

      Label encoding assigns integers 0, 1, 2, etc., preserving order.

    4. D

      Standardization subtracts the mean and divides by the standard deviation.

    Correct answer
    B

    One-hot encoding creates binary columns for each category.

    Explanation

    One-hot encoding represents each category as a binary vector, avoiding false ordinal relationships. Label encoding is for ordinal data.

  5. 5

    In the magic gamma telescope dataset, what is the goal of the classification task?

    1. A

      Predict whether a particle is a gamma particle or a hadron based on pattern features.

    2. B

      Predict the energy level of the gamma particle.

    3. C

      Cluster different types of high-energy particles.

    4. D

      Predict the time of day when gamma particles are detected.

    Correct answer
    A

    Predict whether a particle is a gamma particle or a hadron based on pattern features.

    Explanation

    The dataset is used to classify particle types (gamma or hadron) using features like length, width, asymmetry, etc.

  6. 6

    What is the purpose of splitting data into training, validation, and test sets?

    1. A

      To reduce the number of features in the dataset.

    2. B

      To increase the size of the dataset for better training.

    3. C

      To evaluate model performance on unseen data and prevent overfitting.

    4. D

      To allow the model to train on the test set for higher accuracy.

    Correct answer
    C

    To evaluate model performance on unseen data and prevent overfitting.

    Explanation

    The training set is used to learn parameters, the validation set tunes hyperparameters, and the test set provides an unbiased final evaluation of generalization.

  7. 7

    Which loss function is typically used for binary classification problems?

    1. A

      Mean squared error (MSE)

    2. B

      Hinge loss

    3. C

      L1 loss (absolute error)

    4. D

      Binary cross-entropy loss

    Correct answer
    D

    Binary cross-entropy loss

    Explanation

    Binary cross-entropy measures the difference between predicted probabilities and actual binary labels, commonly used in logistic regression and neural networks.

  8. 8

    What does the F1 score combine?

    1. A

      Precision and recall

    2. B

      Sensitivity and specificity

    3. C

      Recall and specificity

    4. D

      Accuracy and precision

    Correct answer
    A

    Precision and recall

    Explanation

    The F1 score is the harmonic mean of precision and recall, providing a single metric that balances both.

  9. 9

    In K-nearest neighbors (KNN), how is the label of a new point determined?

    1. A

      By averaging the labels of all training points.

    2. B

      By using a probability threshold from a sigmoid function.

    3. C

      By fitting a linear decision boundary.

    4. D

      By majority vote among its K nearest neighbors based on a distance metric.

    Correct answer
    D

    By majority vote among its K nearest neighbors based on a distance metric.

    Explanation

    KNN classifies a point by looking at the K closest training points and assigning the most common label among them.

  10. 10

    What is the naive assumption in Naive Bayes classifiers?

    1. A

      The model uses a linear decision boundary.

    2. B

      Features are correlated with each other.

    3. C

      The data follows a Gaussian distribution.

    4. D

      All features are conditionally independent given the class label.

    Correct answer
    D

    All features are conditionally independent given the class label.

    Explanation

    Naive Bayes assumes that each feature contributes independently to the probability of the class, simplifying the joint probability calculation.

  11. 11

    What mathematical function does logistic regression use to map linear combinations to probabilities?

    1. A

      Tanh function

    2. B

      Softmax function

    3. C

      ReLU function

    4. D

      Sigmoid function

    Correct answer
    D

    Sigmoid function

    Explanation

    Logistic regression applies the sigmoid function 11+e−z\frac{1}{1+e^{-z}}1+e−z1​ to output a probability between 0 and 1.

  12. 12

    What is the primary goal of a Support Vector Machine (SVM)?

    1. A

      Find the hyperplane that maximizes the margin between classes.

    2. B

      Cluster data points into K groups.

    3. C

      Minimize the sum of squared residuals.

    4. D

      Reduce the dimensionality of the feature space.

    Correct answer
    A

    Find the hyperplane that maximizes the margin between classes.

    Explanation

    SVM finds a hyperplane with the largest margin (distance to the nearest support vectors) to separate classes effectively.

  13. 13

    What is the role of the kernel trick in SVM?

    1. A

      To map data to a higher-dimensional space where it becomes linearly separable.

    2. B

      To reduce the number of features for faster computation.

    3. C

      To normalize the data before training.

    4. D

      To initialize the centroids in K-means clustering.

    Correct answer
    A

    To map data to a higher-dimensional space where it becomes linearly separable.

    Explanation

    The kernel trick allows SVM to implicitly compute dot products in a high-dimensional space, enabling nonlinear classification without explicitly transforming the data.

  14. 14

    What happens if a neural network has no activation function between layers?

    1. A

      The output becomes binary as in a step function.

    2. B

      The entire network becomes equivalent to a single linear transformation.

    3. C

      The network automatically normalizes the inputs.

    4. D

      The network cannot learn at all due to vanishing gradients.

    Correct answer
    B

    The entire network becomes equivalent to a single linear transformation.

    Explanation

    Without nonlinear activation functions, stacking linear layers results in a linear combination, reducing the network's capacity to learn complex patterns.

  15. 15

    What does the learning rate in gradient descent control?

    1. A

      The batch size used during training.

    2. B

      The probability of dropping out neurons.

    3. C

      The number of layers in a neural network.

    4. D

      The step size taken when updating model weights.

    Correct answer
    D

    The step size taken when updating model weights.

    Explanation

    Learning rate (alpha) determines how much the weights are adjusted during each update; too high may cause divergence, too low slows convergence.

  16. 16

    In linear regression, what does the residual represent?

    1. A

      The correlation coefficient between features and target.

    2. B

      The sum of squared errors divided by the number of points.

    3. C

      The slope of the regression line.

    4. D

      The difference between the actual value and the predicted value.

    Correct answer
    D

    The difference between the actual value and the predicted value.

    Explanation

    A residual is the vertical distance between a data point and the regression line, indicating prediction error.

  17. 17

    Which assumption of linear regression states that residuals should have constant variance across all predicted values?

    1. A

      Linearity

    2. B

      Normality

    3. C

      Independence

    4. D

      Homoscedasticity

    Correct answer
    D

    Homoscedasticity

    Explanation

    Homoscedasticity means the spread of residuals is roughly equal for all fitted values; violation (heteroscedasticity) can affect inference.

  18. 18

    What does R-squared measure in regression?

    1. A

      The proportion of variance in the target explained by the model.

    2. B

      The root mean of squared errors.

    3. C

      The correlation between predictions and actuals.

    4. D

      The average absolute error between predictions and actuals.

    Correct answer
    A

    The proportion of variance in the target explained by the model.

    Explanation

    R-squared (R2R^2R2) is 1−RSSTSS1 - \frac{RSS}{TSS}1−TSSRSS​, where RSS is sum of squared residuals and TSS is total sum of squares; higher values indicate better fit.

  19. 19

    In K-means clustering, what does the 'K' represent?

    1. A

      The number of nearest neighbors to consider.

    2. B

      The number of principal components.

    3. C

      The number of hidden layers in a neural network.

    4. D

      The number of clusters to be formed.

    Correct answer
    D

    The number of clusters to be formed.

    Explanation

    K is a user-defined parameter specifying how many clusters the algorithm should partition the data into.

  20. 20

    The iterative process in K-means alternates between which two steps?

    1. A

      Fitting a line and computing residuals.

    2. B

      Calculating loss and updating weights.

    3. C

      Forward propagation and backpropagation.

    4. D

      Assigning points to nearest centroid and recalculating centroids.

    Correct answer
    D

    Assigning points to nearest centroid and recalculating centroids.

    Explanation

    K-means uses expectation-maximization: assign points to the closest centroid (expectation) and then recompute centroids as means (maximization).

  21. 21

    What is the primary purpose of Principal Component Analysis (PCA)?

    1. A

      Clustering unlabeled data into groups.

    2. B

      Classifying data into discrete categories.

    3. C

      Predicting continuous target variables.

    4. D

      Dimensionality reduction by projecting data onto directions of maximum variance.

    Correct answer
    D

    Dimensionality reduction by projecting data onto directions of maximum variance.

    Explanation

    PCA identifies the axes (principal components) that capture the most variance, allowing reduction of feature space while retaining information.

  22. 22

    In the content, which classification model achieved the highest accuracy on the magic gamma telescope dataset?

    1. A

      Support Vector Machine (SVM)

    2. B

      K-Nearest Neighbors (KNN)

    3. C

      Logistic Regression

    4. D

      Naive Bayes

    Correct answer
    A

    Support Vector Machine (SVM)

    Explanation

    SVM achieved 87% accuracy, outperforming other models in the example.

  23. 23

    What library is used to easily build neural network models in the course?

    1. A

      NumPy

    2. B

      Matplotlib

    3. C

      TensorFlow

    4. D

      scikit-learn

    Correct answer
    C

    TensorFlow

    Explanation

    TensorFlow is an open-source library for developing and training ML models, used for defining sequential neural networks.

  24. 24

    In the Seoul bike sharing regression example, what was the target variable?

    1. A

      Solar radiation

    2. B

      Humidity

    3. C

      Rented bike count per hour

    4. D

      Temperature

    Correct answer
    C

    Rented bike count per hour

    Explanation

    The goal was to predict the number of rental bikes at each hour (bike count).

  25. 25

    What preprocessing step was applied to the training data in the magic gamma telescope example to address class imbalance?

    1. A

      Applying PCA

    2. B

      Oversampling the minority class

    3. C

      Removing outliers

    4. D

      Undersampling the majority class

    Correct answer
    B

    Oversampling the minority class

    Explanation

    Random oversampler was used to increase the number of hadron samples to match gamma samples.

  26. 26

    In the seeds dataset clustering example, what is the number of clusters (K) used?

    1. A

      210

    2. B

      2

    3. C

      3

    4. D

      7

    Correct answer
    C

    3

    Explanation

    The dataset contains three wheat varieties, so K was set to 3 for K-means clustering.

  27. 27

    What does a dropout layer do in a neural network?

    1. A

      Adds noise to the input data.

    2. B

      Randomly ignores a fraction of neurons during training to prevent overfitting.

    3. C

      Increases the number of neurons in each layer.

    4. D

      Reduces the learning rate over time.

    Correct answer
    B

    Randomly ignores a fraction of neurons during training to prevent overfitting.

    Explanation

    Dropout randomly drops out neurons with a given probability, forcing the network to learn more robust features and reducing overfitting.

  28. 28

    Which evaluation metric is defined as the sum of squared differences between predicted and actual values?

    1. A

      Mean Absolute Error (MAE)

    2. B

      Mean Squared Error (MSE)

    3. C

      R-squared

    4. D

      Root Mean Squared Error (RMSE)

    Correct answer
    B

    Mean Squared Error (MSE)

    Explanation

    MSE = 1n∑i=1n(yi−y^i)2\frac{1}{n}\sum_{i=1}^{n}(y_i - \hat{y}_i)^2n1​∑i=1n​(yi​−y^​i​)2, penalizing larger errors more heavily.

  29. 29

    In the content, what is the correct interpretation of precision?

    1. A

      Out of all actual positives, how many were correctly predicted.

    2. B

      The harmonic mean of recall and specificity.

    3. C

      Out of all positive predictions, how many are actually positive.

    4. D

      The overall proportion of correct predictions.

    Correct answer
    C

    Out of all positive predictions, how many are actually positive.

    Explanation

    Precision = TPTP+FP\frac{TP}{TP+FP}TP+FPTP​, measuring the accuracy of positive predictions.

Question 1 of 29
Question 1 of 29

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent