1. Home
  2. Explore
  3. Computer Science
  4. Decision Trees and Random Forests

Study methods

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

Decision Trees and Random Forests

  • 61Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Tree Foundations
A tree-like structure generated from data to make predictions or classifications is called a
.

61 questions

  1. 1
    A tree-like structure generated from data to make predictions or classifications is called a
    _____
    .
    Hint

    Its name describes both its branching structure and its role in making choices.

    Answer

    decision tree

    Explanation

    A decision tree is a tree-like structure generated from data to perform machine learning tasks such as classification or regression.

  2. 2
    The two common machine learning task types that decision trees can address are classification and
    _____
    .
    Hint

    One task predicts a target value rather than selecting a predefined class.

    Answer

    regression

    Explanation

    Decision trees can be built for both classification problems and regression problems.

  3. 3
    In a classification problem, the goal is to assign an example to one of the
    _____
    .
    Hint

    These are the categories established before classifying the new example.

    Answer

    predefined classes

    Explanation

    Classification uses data to assign an example to one of a set of predefined classes.

  4. 4
    In a regression problem, the goal is to predict an output or
    _____
    .
    Hint

    This is the value the model is trying to estimate.

    Answer

    target feature value

    Explanation

    Regression predicts an output or target feature value for given data.

  5. 5
    A decision tree makes its final prediction by following decisions from its starting node until reaching a
    _____
    .
    Hint

    This is the point where the tree gives its result for the example.

    Answer

    final decision

    Explanation

    A data point traverses the tree through decisions until reaching a point where the tree provides a final decision.

  6. 6
    The first node of a decision tree, containing all data points in the problem before any split, is the
    _____
    .
    Hint

    It is the tree's starting point.

    Answer

    root node

    Explanation

    The root node contains all the data points before the tree partitions them.

  7. 7
    At a decision-tree node, the data points are partitioned according to a feature value and a
    _____
    .
    Hint

    The feature value is evaluated to determine which branch to follow.

    Answer

    decision

    Explanation

    Each decision point uses a feature and a condition or comparison to direct data into a branch.

  8. 8
    Decision-tree software may offer different algorithms and metrics as options for
    _____
    .
    Hint

    These choices determine how the tree is formed from data.

    Answer

    building these trees

    Explanation

    Different algorithms and metrics can be available in software packages for constructing decision trees.

  9. 9
    Gini impurity and information entropy are typically used for
    _____
    .
    Hint

    These metrics assess how classes are distributed in a node.

    Answer

    classification problems

    Explanation

    The lecture identifies Gini impurity and information entropy as typical metrics for classification problems.

  10. 10
    Variance reduction is a metric used when modeling
    _____
    .
    Hint

    This task predicts a numerical target rather than a class label.

    Answer

    regression problems

    Explanation

    Variance reduction is used as a metric for regression problems.

  11. 11
    The Iris example aims to classify a new flower into one of three species: setosa, versicolor, or
    _____
    .
    Hint

    Name the third species in the example.

    Answer

    virginica

    Explanation

    The Iris classification example considers setosa, versicolor, and virginica.

  12. 12
    The Iris data set in the example has a total of
    _____
    samples.
    Hint

    Add the class counts: 49, 50, and 50.

    Answer

    149

    Explanation

    The example uses 149 samples: 49 setosa, 50 versicolor, and 50 virginica.

  13. 13
    Each Iris sample is described using four measured features, including sepal length, sepal width, and petal length, plus
    _____
    .
    Hint

    It is the remaining geometric feature in the list.

    Answer

    petal width

    Explanation

    The four features are sepal length, sepal width, petal length, and petal width.

  14. 14
    In the example data, setosa sepal lengths range from 4.3 to
    _____
    .
    Hint

    The lecture gives a lower and upper value for this class's sepal length.

    Answer

    5.8

    Explanation

    The stated setosa sepal length range is 4.3 to 5.8.

  15. 15
    In the example data, versicolor sepal lengths range from 4.9 to
    _____
    .
    Hint

    The range begins at 4.9.

    Answer

    7

    Explanation

    The stated versicolor sepal length range is 4.9 to 7.

  16. 16
    In the example data, virginica sepal lengths range from 4.9 to
    _____
    .
    Hint

    This class has the largest upper sepal-length value in the stated ranges.

    Answer

    7.9

    Explanation

    The stated virginica sepal length range is 4.9 to 7.9.

  17. 17
    In the example, setosa petal lengths range from 1 to
    _____
    .
    Hint

    The setosa range ends before the other two species' petal-length ranges begin.

    Answer

    1.9

    Explanation

    The stated setosa petal length range is 1 to 1.9.

  18. 18
    A petal-length split at 2.4 separates all setosa samples from versicolor and virginica in the example's training data; the setosa samples go to the branch with petal length
    _____
    .
    Hint

    The branch condition sends the shorter petal lengths to the pure setosa node.

    Answer

    less than 2.4

    Explanation

    With the example split, all 49 setosa samples have petal length less than 2.4 and enter a pure node.

  19. 19
    For a node, Gini impurity is calculated by subtracting the sum of squared class fractions from
    _____
    .
    Hint

    The calculation starts with the whole, then subtracts the squared fractions.

    Answer

    1

    Explanation

    Gini impurity is one minus the sum of the squared fractions of samples from each class in the node.

  20. 20
    In the Gini impurity calculation, each class fraction is the number of samples from that class divided by the node's
    _____
    .
    Hint

    The denominator counts all samples currently in that node.

    Answer

    total set

    Explanation

    A class fraction is the number of samples in a particular class divided by the total number of samples in the node.

  21. 21
    At the Iris root node, the class fractions are based on counts of 50 versicolor, 50 virginica, and
    _____
    setosa samples.
    Hint

    The two other class counts are both 50.

    Answer

    49

    Explanation

    The root node contains 49 setosa samples, 50 versicolor samples, and 50 virginica samples.

  22. 22
    A node containing samples from only one class is called a
    _____
    .
    Hint

    Its class composition is not mixed.

    Answer

    pure node

    Explanation

    A pure node contains samples corresponding to only one class, with the other classes excluded.

  23. 23
    The Gini impurity of a pure node is
    _____
    .
    Hint

    A pure node has one class fraction equal to 1 and all other fractions equal to 0.

    Answer

    0

    Explanation

    Substituting the fractions for a pure node into the Gini formula gives an impurity of 0.

  24. 24
    When a node contains 50 samples of one class and no samples from other classes, the fraction for that class is
    _____
    .
    Hint

    All samples in the node belong to that class.

    Answer

    1

    Explanation

    The class fraction is 50 divided by 50, which equals 1; the other class fractions are 0.

  25. 25
    As a decision tree partitions data into nodes, the Gini impurity can change because the class composition of each node
    _____
    .
    Hint

    Each split may distribute the classes differently across the branches.

    Answer

    changes

    Explanation

    Different partitions produce nodes with different class counts and therefore different Gini impurity values.

  26. 26
    The goal of growing a classification tree using Gini impurity is to reduce impurity toward
    _____
    .
    Hint

    This is the Gini impurity of a pure node.

    Answer

    0

    Explanation

    The tree aims to reduce Gini impurity as it grows, ideally producing pure nodes with impurity 0.

  27. 27
    In a Gini split calculation, each child node's impurity is weighted by the fraction of the parent data that
    _____
    .
    Hint

    The weight reflects how many of the original samples entered that child.

    Answer

    came to this node

    Explanation

    The Gini split index accounts for each child's impurity weighted by the fraction of parent samples assigned to that child.

  28. 28
    In the example split using petal length 2.4, the node containing 49 setosa samples has Gini impurity
    _____
    .
    Hint

    All samples in that node belong to a single class.

    Answer

    0

    Explanation

    The node is pure because it contains only setosa samples, so its Gini impurity is 0.

  29. 29
    In the example split using petal length 2.4, the node with 50 versicolor and 50 virginica samples has Gini impurity
    _____
    .
    Hint

    The two classes have equal fractions, and setosa is absent from this node.

    Answer

    0.5

    Explanation

    The class fractions are 0, 0.5, and 0.5, giving a Gini impurity of 0.5.

  30. 30
    To create a split, a decision tree chooses a feature and a threshold, then assigns examples to branches according to whether the feature is below or above the
    _____
    .
    Hint

    For example, the lecture compares a feature value with a chosen number.

    Answer

    threshold

    Explanation

    A split uses a feature and a value such as 5 to determine which branch an example follows.

  31. 31
    The Iris example has four candidate features for a split: sepal length, sepal width, petal length, and
    _____
    .
    Hint

    It is the fourth measured feature.

    Answer

    petal width

    Explanation

    A decision tree can choose among the four measured Iris features when considering a split.

  32. 32
    When a feature and threshold are selected, the data points that satisfy the branch condition are collected into a
    _____
    .
    Hint

    It is one of the child parts formed by partitioning the data.

    Answer

    node

    Explanation

    A split distributes samples into child nodes according to the selected feature condition.

  33. 33
    The Gini split index compares the original node's impurity with the weighted impurities of its
    _____
    .
    Hint

    These are the nodes formed by the proposed split.

    Answer

    child nodes

    Explanation

    The split index is the parent impurity minus the weighted Gini impurities of the resulting child nodes.

  34. 34
    When comparing possible splits, the lecture says to choose the option with the
    _____
    Gini split index.
    Hint

    A larger index means a greater reduction in impurity.

    Answer

    maximum

    Explanation

    The split with the maximum Gini split index is selected because it produces the largest reduction in weighted impurity.

  35. 35
    A high Gini split index indicates that the child nodes have relatively
    _____
    .
    Hint

    A good split moves the children closer to pure sets.

    Answer

    low impurity

    Explanation

    A larger split index corresponds to lower impurity in the child nodes relative to the parent.

  36. 36
    If a proposed split makes both child nodes pure, their Gini impurities are both
    _____
    .
    Hint

    Pure nodes have no class mixing.

    Answer

    0

    Explanation

    Each pure child has Gini impurity 0, so the split achieves the ideal reduction in impurity.

  37. 37
    For the petal-length split at 2.4, 49 of the 149 samples enter the setosa node and
    _____
    enter the other node.
    Hint

    The two child counts must add up to the full data set.

    Answer

    100

    Explanation

    The split sends 49 setosa samples to one node and the remaining 100 versicolor and virginica samples to the other.

  38. 38
    For the petal-length split at 2.4, the Gini impurity of the original root node is approximately
    _____
    .
    Hint

    This value comes from the root class fractions 49/149, 50/149, and 50/149.

    Answer

    0.66

    Explanation

    Applying the Gini formula to the root's 49, 50, and 50 class counts gives an impurity of about 0.66.

  39. 39
    For the petal-length split at 2.4, the lecture gives a Gini split index of
    _____
    .
    Hint

    This value is obtained by subtracting the weighted child impurities from the root impurity.

    Answer

    0.324

    Explanation

    The pure 49-sample child has impurity 0, and the 100-sample child has impurity 0.5; the resulting split index is 0.324.

  40. 40
    A split using sepal length at 5.8 gives a Gini split index of approximately
    _____
    .
    Hint

    The lecture contrasts this value with the petal-length split index.

    Answer

    0.1915

    Explanation

    For the described sepal-length split at 5.8, the Gini split index is stated as 0.1915.

  41. 41
    At a node, the tree's class prediction is generally the class with the greatest number of samples, or the class that is
    _____
    .
    Hint

    This means the class that is most represented in the node.

    Answer

    preponderant

    Explanation

    The tree labels a node according to the class with the largest sample count in that node.

  42. 42
    If a new Iris flower has petal length less than 2.4 in the example tree, the predicted class is
    _____
    .
    Hint

    That branch leads to the node containing all 49 setosa training samples.

    Answer

    setosa

    Explanation

    The petal-length condition routes the sample to the pure setosa node.

  43. 43
    If a new Iris flower has petal length greater than 2.4, the example tree next examines its
    _____
    .
    Hint

    This is the feature used for the next split in the illustrated tree.

    Answer

    petal width

    Explanation

    The branch for petal length greater than 2.4 is split using petal width.

  44. 44
    In the example, when petal length is greater than 2.4, petal width less than 1.8 leads to the prediction
    _____
    .
    Hint

    The corresponding node contains more versicolor than virginica samples.

    Answer

    versicolor

    Explanation

    The tree predicts versicolor for the branch with petal width less than 1.8.

  45. 45
    In the example, when petal length is greater than 2.4, petal width greater than 1.8 leads to the prediction
    _____
    .
    Hint

    The corresponding node contains more virginica than versicolor samples.

    Answer

    virginica

    Explanation

    The tree predicts virginica for the branch with petal width greater than 1.8.

  46. 46
    A regression model that makes no splits might predict a new example's target using the training data's
    _____
    .
    Hint

    It is a single summary value of all training targets.

    Answer

    average

    Explanation

    Without developing a regression tree, one simple prediction is the average target value across the training data.

  47. 47
    A decision tree that perfectly separates the training data may perform poorly on new data because it has
    _____
    .
    Hint

    The model has fit the training examples too closely to generalize well.

    Answer

    over learning the training set

    Explanation

    Complete separation of training data can reduce the ability to generalize to new data, a problem described as over learning the training set.

  48. 48
    A separate set of data used to evaluate how well a decision tree classifies unseen examples is called
    _____
    .
    Hint

    It is used after training to check the tree's performance on examples not used to build it.

    Answer

    test data

    Explanation

    Test data is used to check how often the decision tree predicts the correct class for new examples.

  49. 49
    If further splitting would make a tree very complex, one may stop and accept some training errors to improve
    _____
    .
    Hint

    This is the ability to perform well on data beyond the training set.

    Answer

    generalization capability

    Explanation

    Stopping growth can avoid a very deep tree that memorizes training data and has poor performance on new examples.

  50. 50
    A decision tree may be sensitive to small changes or errors in the data; in other words, it may not be very
    _____
    .
    Hint

    This describes a model that remains stable when its input data changes slightly.

    Answer

    robust

    Explanation

    The lecture notes that small data changes can produce quite different decision trees, so decision trees may not be robust to data errors.

  51. 51
    A random forest is a collection of
    _____
    .
    Hint

    The name refers to an ensemble made from many tree models.

    Answer

    decision trees

    Explanation

    A random forest combines multiple decision trees rather than relying on only one.

  52. 52
    One way to create different data sets for a random forest is to select only a portion of the original
    _____
    .
    Hint

    This method uses fewer than all of the original examples.

    Answer

    data

    Explanation

    A random forest can build trees using subsets of the original data points.

  53. 53
    Another way to create different data sets for a random forest is to select only some of the original
    _____
    .
    Hint

    This changes which measured attributes are available to a tree.

    Answer

    features

    Explanation

    A random forest can build trees from subsets of the features, such as by dropping one or more features.

  54. 54
    If 10 different data sets are generated from the original data, they can be used to build
    _____
    decision trees.
    Hint

    The example builds one tree for each generated data set.

    Answer

    10

    Explanation

    The lecture illustrates that making 10 data sets allows the construction of 10 decision trees.

  55. 55
    For a new example, a random forest collects predictions from its trees and uses the
    _____
    .
    Hint

    The most common prediction among the trees determines the result.

    Answer

    majority decision

    Explanation

    The random forest's prediction is the class selected by the majority of its decision trees.

  56. 56
    If two trees predict setosa and one predicts virginica, the random forest predicts
    _____
    .
    Hint

    The class with more votes wins.

    Answer

    setosa

    Explanation

    Setosa receives two of the three votes, so it is the majority decision.

  57. 57
    If the trees split their predictions equally among different classes, the random forest must
    _____
    .
    Hint

    There is no single class with a majority in this situation.

    Answer

    break the tie

    Explanation

    When the trees provide no majority decision, a tie-breaking method is needed to produce a result.

  58. 58
    Combining the predictions of multiple trees is intended to make the result less affected by fluctuations in the
    _____
    .
    Hint

    The forest reduces dependence on any one training sample or tree.

    Answer

    data

    Explanation

    Using multiple data subsets and trees can help address stochasticity and data fluctuations compared with relying on one tree.

  59. 59
    A random forest may create variation among its trees by dropping data points, dropping features, or both; this process produces multiple
    _____
    .
    Hint

    Each tree can be trained on a different version or subset of the original input.

    Answer

    data sets

    Explanation

    Subsampling examples or features creates multiple modified data sets from which separate trees can be built.

  60. 60
    The lecture's central contrast is that a decision tree gives a prediction from one tree, while a random forest combines predictions from
    _____
    .
    Hint

    The forest uses a group rather than a single model.

    Answer

    multiple trees

    Explanation

    A random forest aggregates the decisions of its component trees, typically by majority vote for classification.

  61. 61
    When interpreting a decision tree, knowing the feature conditions at its nodes helps explain how the tree makes a
    _____
    .
    Hint

    Following the conditions reveals why an example reaches a particular class outcome.

    Answer

    classification

    Explanation

    The feature-based decisions at each node determine the path through the tree and the final predicted class.

1 of 61
Question 1 of 61

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent