1. Home
  2. Explore
  3. Computer Science
  4. Classical Machine Learning Classification

Study methods

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

Classical Machine Learning Classification

  • 53Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Classification Workflow

How does the goal of classification differ from the goal of regression?

53 questions

  1. 1

    How does the goal of classification differ from the goal of regression?

    Model answer

    Regression predicts a numeric value; classification predicts a category or class.

    Explanation

    Regression estimates a value for a new point, whereas classification assigns a point to a category.

  2. 2

    What does a classification model learn, and what does it predict for a new data row?

    Model answer

    It learns from labeled training data and assigns a class to new data using their features.

    Explanation

    A classification model learns from labeled examples, then predicts labels for examples it has not seen.

  3. 3

    Why split a dataset into training and testing portions?

    Model answer

    Training data is used to fit the model; test data is held back to assess its performance.

    Explanation

    The held-out test set provides an evaluation on data that was not used to fit the model.

  4. 4

    What training–testing split was presented as a common choice?

    Model answer

    A common split is about 80% for training and 20% for testing.

    Explanation

    The workshop used an approximate 80/20 split when there was sufficient data.

  5. 5

    Why set a random state or seed when splitting data?

    Model answer

    Setting a random seed makes randomized operations, such as splitting the data, reproducible.

    Explanation

    A fixed random seed makes the random split repeatable, so repeated runs can yield the same partition.

  6. 6

    What kinds of information are represented in the Palmer penguins dataset used in the example?

    Model answer

    It includes three penguin species from three Antarctic islands, with physical measurements and categorical information such as island and sex.

    Explanation

    The Palmer penguins dataset contains three species living on three Antarctic islands, along with measurements and categorical attributes.

  7. 7

    Describe the initial size and data-quality issue found in the penguins dataset.

    Model answer

    The original dataset had 344 rows and seven columns, and some rows had missing values.

    Explanation

    The raw data included 344 rows and seven columns, with missing entries in several fields.

  8. 8

    Name the measurements and categorical fields described for the penguins dataset.

    Model answer

    The dataset had four physical measurements—culmen length, culmen depth, flipper length, and body mass—and three categorical fields: species, island, and sex.

    Explanation

    The measurements were culmen length, culmen depth, flipper length, and body mass; the other fields included species, island, and sex.

  9. 9

    How were missing values identified and handled in the example?

    Model answer

    The missing values were identified with a null check, and rows containing missing values were removed.

    Explanation

    Missing entries were detected with null-value checks and removed using a missing-row deletion operation.

  10. 10

    How many rows remained after the missing-value cleanup, and what did that indicate?

    Model answer

    Dropping rows with missing values left 334 complete rows.

    Explanation

    Removing rows with missing entries reduced the dataset from 344 to 334 rows, leaving each column with 334 entries.

  11. 11

    What additional invalid entry was removed after handling missing values?

    Model answer

    The row with a dot in the sex field was removed because it did not provide a valid sex value.

    Explanation

    After that cleanup, a dot in the sex field was treated as an unusable value and its row was filtered out.

  12. 12

    What was the final row count and sex distribution after cleaning?

    Model answer

    The cleaned dataset had 333 rows: 168 males and 165 females.

    Explanation

    The final cleaned frame had 333 rows, with 168 males and 165 females.

  13. 13

    What species and island counts were reported for the cleaned penguins data?

    Model answer

    There were 146 Adelie, 120 Gentoo, and 68 Chinstrap penguins; island counts were 164 from Biscoe, 123 from Dream, and 47 from Torgersen.

    Explanation

    The reported counts were Adelie 146, Gentoo 120, and Chinstrap 68; island counts were Biscoe 164, Dream 123, and Torgersen 47.

  14. 14

    How did label encoding represent the species, island, and sex categories?

    Model answer

    Label encoding represented categories numerically: species and island used three codes, while sex used two.

    Explanation

    Label encoding changed category labels into numeric codes: three-category fields received codes 0–2, and sex received codes 0–1.

  15. 15

    Why were the categorical variables converted to numeric values before model training?

    Model answer

    The variables supplied to the model need numeric values, so categorical variables must be encoded.

    Explanation

    Machine-learning inputs in this workflow were made numeric; label encoding was used for categorical fields.

  16. 16

    What does standard scaling do, and why was it applied to the numerical features?

    Model answer

    Standard scaling centers each feature at zero and scales it to a standard deviation of one, reducing scale differences between features.

    Explanation

    Standard scaling centers values at a mean of zero and scales them to a standard deviation of one, putting measurements on comparable scales.

  17. 17

    How does one-hot encoding differ from assigning categories integer labels?

    Model answer

    One-hot encoding represents categories using binary 0/1 indicators instead of assigning each category one integer label.

    Explanation

    One-hot encoding was mentioned as another encoding approach, producing binary indicators rather than a single integer code for a category.

  18. 18

    What is an outlier, and why should its cause be investigated before deciding how to handle it?

    Model answer

    An outlier is an unusually extreme value; it may be erroneous or meaningful, so its cause should be checked.

    Explanation

    Outliers are unusually extreme values that may be errors or may reflect meaningful observations, so their cause should be investigated.

  19. 19

    What do quartiles and the interquartile range describe?

    Model answer

    Quartiles divide the data into four equal-proportion parts, and the interquartile range is Q3−Q1Q_3-Q_1Q3​−Q1​.

    Explanation

    Quartiles divide ordered data into four parts, each containing about 25% of the observations; the interquartile range is Q3−Q1Q_3-Q_1Q3​−Q1​.

  20. 20

    How are the inner fences for identifying outliers calculated?

    Model answer

    The inner fences are Q1−1.5 IQRQ_1-1.5\,IQRQ1​−1.5IQR and Q3+1.5 IQRQ_3+1.5\,IQRQ3​+1.5IQR.

    Explanation

    The inner lower and upper fences are based on extending 1.51.51.5 interquartile ranges below Q1Q_1Q1​ and above Q3Q_3Q3​.

  21. 21

    How are the outer fences for identifying unusually extreme values calculated?

    Model answer

    The outer fences are Q1−3 IQRQ_1-3\,IQRQ1​−3IQR and Q3+3 IQRQ_3+3\,IQRQ3​+3IQR.

    Explanation

    The outer fences extend three interquartile ranges below the first quartile and above the third quartile.

  22. 22

    What did the outlier checks find for the four penguin measurements?

    Model answer

    No outliers were found in culmen length, culmen depth, flipper length, or body mass.

    Explanation

    The example checked the four numerical measurements against the fences and found no outliers in any of them.

  23. 23

    How were visualizations used to examine the penguin measurements and their distributions by species?

    Model answer

    Histograms and kernel density estimates showed feature distributions, and plots separated by species allowed those distributions to be compared across species.

    Explanation

    Histograms and kernel density estimates were used to inspect distributions; seaborn plots could also compare measurements across species.

  24. 24

    What prediction task was constructed from the penguins dataset?

    Model answer

    The model used measurements, species, and island to predict whether a penguin was male or female.

    Explanation

    The modeling objective was to infer a penguin's sex from its measurements, species, and island.

  25. 25

    Which variables were used as features, and which variable was the target?

    Model answer

    XXX contained culmen length, culmen depth, flipper length, body mass, island, and species; yyy was encoded sex.

    Explanation

    The input matrix XXX contained six predictors: four measurements, island, and species; the encoded sex field was the target yyy.

  26. 26

    How many training and testing rows resulted from the example's split?

    Model answer

    The split produced 266 training rows and 67 testing rows, each with six feature columns.

    Explanation

    With 333 rows and an 80/20 split, the example had 266 training rows and 67 testing rows; each feature row had six columns.

  27. 27

    Which data were scaled before fitting the models, and why was the target not scaled?

    Model answer

    The features were standardized, but the encoded target labels were not scaled.

    Explanation

    The input features were scaled for training and testing, while the target was a category code rather than a numerical feature to be scaled.

  28. 28

    Which three classification algorithms were compared in the example?

    Model answer

    The models were K-nearest neighbors, decision tree, and support vector classification.

    Explanation

    The three tested classifiers were K-nearest neighbors, a decision tree, and a support vector classifier.

  29. 29

    What settings were used for the three classifiers?

    Model answer

    KNN used three neighbors, the decision tree had maximum depth three, and the SVC used a linear kernel with probability estimates enabled.

    Explanation

    The K-nearest neighbors model used three neighbors; the tree was limited to depth three; the support vector classifier used a linear kernel and enabled probability estimates.

  30. 30

    Describe the sequence of fitting and predicting in the classification workflow.

    Model answer

    Fit the model on training features and labels, then use it to predict labels for the held-out test features.

    Explanation

    Fitting uses the training features and their known target labels; prediction then applies the fitted model to the test features.

  31. 31

    What is the purpose of adjusting classifier parameters during model development?

    Model answer

    Model parameters control aspects of an algorithm; adjusting them can fine-tune its behavior and performance.

    Explanation

    Changing an algorithm's parameter values can alter its behavior and results, allowing the model to be tuned.

  32. 32

    What information does a confusion matrix provide?

    Model answer

    A confusion matrix compares predicted labels with actual labels and summarizes correct and incorrect classifications.

    Explanation

    A confusion matrix cross-tabulates predicted classes against actual classes, showing correct classifications and errors.

  33. 33

    Define a true positive and a true negative.

    Model answer

    A true positive is correctly predicted positive, and a true negative is correctly predicted negative.

    Explanation

    A true positive is an actual positive predicted positive; a true negative is an actual negative predicted negative.

  34. 34

    Define a false negative and a false positive.

    Model answer

    A false negative misses an actual positive, while a false positive labels an actual negative as positive.

    Explanation

    A false negative is an actual positive predicted negative; a false positive is an actual negative predicted positive.

  35. 35

    What four confusion-matrix counts were reported for the K-nearest neighbors classifier?

    Model answer

    For KNN, the counts were 32 true positives, 5 false negatives, 2 false positives, and 28 true negatives.

    Explanation

    The KNN matrix contained 32 true positives, 5 false negatives, 2 false positives, and 28 true negatives.

  36. 36

    What four confusion-matrix counts were reported for the decision-tree classifier?

    Model answer

    For the decision tree, the counts were 31 true positives, 6 false negatives, 5 false positives, and 25 true negatives.

    Explanation

    The decision-tree matrix contained 31 true positives, 6 false negatives, 5 false positives, and 25 true negatives.

  37. 37

    What four confusion-matrix counts were reported for the support vector classifier?

    Model answer

    For the support vector classifier, the counts were 33 true positives, 4 false negatives, 3 false positives, and 27 true negatives.

    Explanation

    The support-vector model's matrix contained 33 true positives, 4 false negatives, 3 false positives, and 27 true negatives.

  38. 38

    How are precision and recall calculated, and what does each measure?

    Model answer

    Precision is TP/(TP+FP)TP/(TP+FP)TP/(TP+FP), while recall is TP/(TP+FN)TP/(TP+FN)TP/(TP+FN).

    Explanation

    Precision measures the proportion of predicted positives that are truly positive; recall measures the proportion of actual positives that are detected.

  39. 39

    What role does the F1 score play in evaluating a classifier?

    Model answer

    The F1 score is a classification metric used to summarize performance in relation to precision and recall.

    Explanation

    The F1 score is one of the metrics used alongside precision and recall to summarize classification performance.

  40. 40

    What does support represent in a classification report, and what averages can such a report provide?

    Model answer

    Support counts actual examples in each class; macro and weighted averages aggregate class-level metrics.

    Explanation

    Support is the number of actual examples for a class; macro and weighted averages summarize per-class metrics in different ways.

  41. 41

    What accuracy was reported for the K-nearest neighbors model?

    Model answer

    The KNN model's reported accuracy was 0.900.900.90.

    Explanation

    The example's KNN classification report gave overall accuracy of 0.900.900.90 on the 67 test rows.

  42. 42

    Why might researchers choose different classification metrics for different applications?

    Model answer

    Choose metrics that fit the application and the performance questions important to the field; different groups may prioritize different measures.

    Explanation

    Metric choice depends on what aspect of performance matters for the application or research field; there is no single metric that is always preferred.

  43. 43

    What quantities are plotted on a receiver operating characteristic curve?

    Model answer

    An ROC curve plots true-positive rate against false-positive rate.

    Explanation

    The ROC curve displays true-positive rate against false-positive rate as the classifier's decision threshold varies.

  44. 44

    How are the true-positive rate and false-positive rate calculated?

    Model answer

    The true-positive rate is TP/(TP+FN)TP/(TP+FN)TP/(TP+FN), and the false-positive rate is FP/(FP+TN)FP/(FP+TN)FP/(FP+TN).

    Explanation

    The true-positive rate is the fraction of actual positives correctly identified; the false-positive rate is the fraction of actual negatives incorrectly predicted positive.

  45. 45

    What do ROC areas of 0.50.50.5 and 111 signify?

    Model answer

    An AUC of 0.50.50.5 indicates random performance, while an AUC of 111 indicates perfect classification.

    Explanation

    An ROC AUC of 0.50.50.5 represents random-classifier performance, while an area of 111 represents perfect separation in the example's interpretation.

  46. 46

    What ROC AUC values were reported for the three classifiers?

    Model answer

    The AUCs were 0.940.940.94 for KNN, 0.930.930.93 for the tree, and 0.910.910.91 for the support vector classifier.

    Explanation

    The reported AUCs were 0.940.940.94 for KNN, 0.930.930.93 for the decision tree, and 0.910.910.91 for the support vector classifier.

  47. 47

    Which classifier was best according to the reported ROC AUC values, and why?

    Model answer

    KNN was selected because its AUC of 0.940.940.94 was higher than the other models' AUCs.

    Explanation

    Among the three tested models, KNN had the highest AUC, so it was selected by the stated comparison criterion.

  48. 48

    How would classifying the three penguin species change the confusion-matrix dimensions compared with binary sex classification?

    Model answer

    Predicting three species is a multiclass task and uses a 3×33\times33×3 confusion matrix.

    Explanation

    For three species, the classification problem has three classes, so its confusion matrix has one actual-class row and predicted-class column for each species.

  49. 49

    What is the goal of dimensionality reduction?

    Model answer

    Dimensionality reduction transforms data with many variables into a representation with fewer dimensions to simplify analysis.

    Explanation

    Dimensionality reduction seeks a simpler representation with fewer dimensions while retaining useful structure in the data.

  50. 50

    What question does dimensionality reduction raise about the penguins classification features?

    Model answer

    It asks whether all six variables are needed or whether a simpler representation, perhaps with two dimensions, could be used.

    Explanation

    The example considered whether all six input variables were relevant and whether a lower-dimensional representation, such as two dimensions, could simplify the problem.

  51. 51

    How can data be transformed into a lower-dimensional representation?

    Model answer

    It can use linear-algebra transformations to map the original data space into a lower-dimensional vector space.

    Explanation

    The discussion proposed using linear-algebra transformations of vector spaces to map data into a simpler space.

  52. 52

    How was unsupervised learning distinguished from the supervised classification task?

    Model answer

    In unsupervised learning, the algorithm works with data without being given target labels to predict.

    Explanation

    Unsupervised learning was described as allowing an algorithm to carry out its intended analysis without a supplied target label for each example.

  53. 53

    Why might island be questioned as a useful feature in the penguins example?

    Model answer

    Island could be less informative if penguins move freely between islands, so its relevance as a feature should be considered.

    Explanation

    The discussion suggested that island might be less useful for prediction if penguins move freely between islands, illustrating the need to assess feature relevance.

1 of 53
Question 1 of 53

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent