Decision Trees and Random Forests
- 61Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
61 questions
- 1A 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.
- 2The 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.
- 3In 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.
- 4In 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.
- 5A 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.
- 6The 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.
- 7At 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.
- 8Decision-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.
- 9Gini 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.
- 10Variance 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.
- 11The 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.
- 12The 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.
- 13Each 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.
- 14In 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.
- 15In 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.
- 16In 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.
- 17In 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.
- 18A 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.
- 19For 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.
- 20In 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.
- 21At 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.
- 22A 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.
- 23The 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.
- 24When 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.
- 25As 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.
- 26The 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.
- 27In 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.
- 28In 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.
- 29In 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.
- 30To 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.
- 31The 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.
- 32When 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.
- 33The 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.
- 34When 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.
- 35A 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.
- 36If 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.
- 37For 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.
- 38For 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.
- 39For 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.
- 40A 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.
- 41At 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.
- 42If 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.
- 43If 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.
- 44In 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.
- 45In 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.
- 46A 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.
- 47A 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.
- 48A 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.
- 49If 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.
- 50A 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.
- 51A 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.
- 52One 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.
- 53Another 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.
- 54If 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.
- 55For 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.
- 56If 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.
- 57If 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.
- 58Combining 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.
- 59A 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.
- 60The 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.
- 61When 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.

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