Perceptrons and Logistic Regression
- 51Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is the primary distinction between the methods discussed in this lecture and a full probabilistic model?
What is the primary distinction between the methods discussed in this lecture and a full probabilistic model?
51 questions
- 1
What is the primary distinction between the methods discussed in this lecture and a full probabilistic model?
- A
They learn the decision from features to labels without modeling all variable distributions
- B
They require a complete Bayes net before producing any classification decision
- C
They convert labels into features but do not use numerical representations
- D
They model every variable distribution but cannot make classification decisions
Correct answer
AThey learn the decision from features to labels without modeling all variable distributions
Explanation
The methods focus directly on mapping feature vectors to class decisions rather than learning a complete probabilistic model over all variables.
- A
- 2
In an email classification system, which item is an example of a feature?
- A
The complete set of model parameters learned during training
- B
The probability assigned to the email after classification
- C
The final decision that the email is spam
- D
The number of times the word "free" appears in the email
Correct answer
DThe number of times the word "free" appears in the email
Explanation
Word counts, misspellings, and whether the sender is a friend are examples of features used to represent an email.
- A
- 3
How can a binary image commonly be represented as a feature vector?
- A
By replacing every pixel with the average intensity of the image
- B
By recording only the image's final class label
- C
By storing only the number of objects recognized in the image
- D
By recording whether each pixel is on or off
Correct answer
DBy recording whether each pixel is on or off
Explanation
A binary image can be represented with a vector containing 1 or 0 for each pixel, indicating whether that pixel is on or off.
- A
- 4
Which statement correctly describes grayscale image features?
- A
They can only represent the number of loops found in each image
- B
They cannot be used as inputs to a linear classifier
- C
They can be represented by numerical intensity values such as values from 0 to 1 or 0 to 255
- D
They must always be represented by exactly two values, 0 and 1
Correct answer
CThey can be represented by numerical intensity values such as values from 0 to 1 or 0 to 255
Explanation
Grayscale pixels may be represented using values from 0 to 1, or sometimes from 0 to 255 in a byte representation.
- A
- 5
Which statement best describes the role of feature engineering in the described classification pipeline?
- A
It determines how raw inputs are characterized before classification
- B
It converts a predicted label back into the original raw input
- C
It replaces the need to learn any classification weights
- D
It guarantees that every class will be linearly separable
Correct answer
AIt determines how raw inputs are characterized before classification
Explanation
Choosing features, such as word counts or image characteristics, determines how the raw input is transformed into a feature vector used for classification.
- A
- 6
Why might several synonymous words be combined into one text feature?
- A
To represent related meanings together rather than treating each word as unrelated
- B
To make the input independent of whether the message is an image or email
- C
To prevent the classifier from using any numerical feature values
- D
To ensure that every word receives a negative classification weight
Correct answer
ATo represent related meanings together rather than treating each word as unrelated
Explanation
Combining synonyms can make the representation better reflect the shared meaning of related words.
- A
- 7
In the biological analogy for a neuron, what is the role of the dendrites?
- A
They store the learned class labels permanently
- B
They receive signals that serve as inputs to the neuron
- C
They determine which training examples are misclassified
- D
They send the neuron's final output to other neurons
Correct answer
BThey receive signals that serve as inputs to the neuron
Explanation
Dendrites are the input channels of the biological analogy, receiving signals from sources such as the retina or other neurons.
- A
- 8
In the same analogy, what is the role of the axon?
- A
It assigns a separate weight to every input feature
- B
It carries the neuron's output signal to other neurons
- C
It computes the probability of each possible class
- D
It converts raw images into pixel-based feature vectors
Correct answer
BIt carries the neuron's output signal to other neurons
Explanation
The axon is the output channel through which a neuron sends its signal to other neurons.
- A
- 9
What do connection weights represent in the linear-neuron analogy?
- A
The relative strength or importance of different inputs
- B
The probability that an input feature is observed
- C
The number of training examples seen so far
- D
The number of classes in the classification problem
Correct answer
AThe relative strength or importance of different inputs
Explanation
A larger-magnitude weight means that the corresponding input has a stronger influence on the activation.
- A
- 10
How is the activation of a binary perceptron computed?
- A
As the dot product of the weight vector and the feature vector
- B
As the average of the class labels in the training set
- C
As the product of all feature values without using weights
- D
As the probability of the input under a generative model
Correct answer
AAs the dot product of the weight vector and the feature vector
Explanation
The activation is the weighted sum w⋅f(x), equivalently the dot product of the weights and features.
- A
- 11
How does a binary perceptron convert its activation into a class decision?
- A
It predicts the positive class when the activation is positive and the negative class when it is negative
- B
It predicts the class with the largest feature value rather than using the activation
- C
It predicts the positive class whenever any feature value is nonzero
- D
It predicts the negative class whenever the activation has a large magnitude
Correct answer
AIt predicts the positive class when the activation is positive and the negative class when it is negative
Explanation
The perceptron uses the sign of the activation: positive indicates the positive class and negative indicates the negative class.
- A
- 12
What effect does a negative weight have when its corresponding feature value is positive?
- A
It converts the feature value into a probability
- B
It decreases the total activation
- C
It always forces the final prediction to be positive
- D
It has no effect because only positive weights matter
Correct answer
BIt decreases the total activation
Explanation
A positive feature multiplied by a negative weight contributes a negative amount to the weighted sum.
- A
- 13
What is the geometric decision boundary of a binary linear classifier without a bias term?
- A
A hyperplane through the origin that is orthogonal to the weight vector
- B
A hyperplane parallel to the weight vector and unrelated to the origin
- C
A sphere centered at the origin with radius equal to the activation
- D
A nonlinear curve determined only by the number of features
Correct answer
AA hyperplane through the origin that is orthogonal to the weight vector
Explanation
The boundary occurs where w⋅f(x)=0 and is therefore a hyperplane through the origin orthogonal to w.
- A
- 14
What is the purpose of adding a bias term to a linear classifier?
- A
It allows the decision boundary to shift away from the origin
- B
It removes the need to compare the activation with zero
- C
It forces every feature to have the same weight
- D
It converts a linear decision boundary into a nonlinear one
Correct answer
AIt allows the decision boundary to shift away from the origin
Explanation
A bias can be represented by adding a feature that is always 1, allowing the hyperplane to move rather than remain fixed through the origin.
- A
- 15
What does a positive bias generally indicate in the spam example described?
- A
The classifier must predict spam only when every feature is positive
- B
The classifier requires stronger evidence before predicting the negative class
- C
The classifier assumes by default that the message is not spam
- D
The classifier ignores all evidence from the feature vector
Correct answer
BThe classifier requires stronger evidence before predicting the negative class
Explanation
A positive bias favors the positive class in the example, so stronger opposing evidence is needed to make the activation negative.
- A
- 16
What does the binary perceptron do when it classifies a training example correctly?
- A
It replaces the current weights with the feature vector
- B
It leaves the weight vector unchanged and proceeds to the next example
- C
It reverses every weight to increase the margin
- D
It adds the feature vector to the weight vector regardless of the label
Correct answer
BIt leaves the weight vector unchanged and proceeds to the next example
Explanation
A correctly classified example produces no update in the basic perceptron algorithm.
- A
- 17
What is the binary perceptron update rule for a misclassified example?
- A
It updates the weights only when the true label is positive
- B
It updates the weights by adding y∗f(x) to the current weight vector
- C
It replaces the weights with the negative of the current activation
- D
It updates the weights by subtracting the true label from every feature value
Correct answer
BIt updates the weights by adding y∗f(x) to the current weight vector
Explanation
The update is w′=w+y∗f(x), where y∗ is the correct label, typically +1 or −1.
- A
- 18
Why does the perceptron update move the activation in the desired direction?
- A
Because the classifier ignores the current activation during updating
- B
Because the update always makes every weight positive
- C
Because the change in activation includes y∗∥f(x)∥2, whose sign is determined by the true label
- D
Because every feature vector has a negative squared length
Correct answer
CBecause the change in activation includes y∗∥f(x)∥2, whose sign is determined by the true label
Explanation
After the update, the activation changes by y∗f(x)⋅f(x)=y∗∥f(x)∥2. Since the squared norm is nonnegative, the change has the desired sign.
- A
- 19
If a negative example is incorrectly assigned a positive activation, how does the perceptron update affect the weight vector?
- A
It deletes the feature vector from the training set
- B
It adds −f(x), making the weight vector less aligned with the example
- C
It adds f(x), making the positive activation even larger
- D
It changes only the bias and leaves all other weights unchanged
Correct answer
BIt adds −f(x), making the weight vector less aligned with the example
Explanation
For a negative true label, y∗=−1, so the update adds −f(x) and reduces the example's activation.
- A
- 20
Why does the basic perceptron usually process the training data repeatedly?
- A
A single training example cannot be represented by a feature vector
- B
The algorithm cannot compute a dot product in one pass
- C
Each update may fix one example while affecting the classification of others
- D
Repeated passes are required to convert labels into probabilities
Correct answer
CEach update may fix one example while affecting the classification of others
Explanation
Updates change the decision boundary, so the algorithm cycles through examples until a pass produces no needed corrections or another stopping rule is used.
- A
- 21
What guarantee does the binary perceptron have when the training data is linearly separable?
- A
It eventually converges to a decision boundary that separates the two classes
- B
It converges even when no separating boundary exists
- C
It always finds the unique maximum-margin boundary
- D
It produces calibrated class probabilities for every example
Correct answer
AIt eventually converges to a decision boundary that separates the two classes
Explanation
For linearly separable binary data, the perceptron convergence guarantee states that the algorithm eventually finds a separating boundary.
- A
- 22
What generally happens when binary training data is not linearly separable?
- A
The perceptron automatically changes into logistic regression
- B
The perceptron can continue making updates indefinitely without converging
- C
The perceptron assigns equal probability to every class
- D
The perceptron is guaranteed to find a perfect separating hyperplane
Correct answer
BThe perceptron can continue making updates indefinitely without converging
Explanation
With nonseparable data, correcting one mistake can create another, causing the perceptron to keep bouncing between weight vectors.
- A
- 23
What does the perceptron mistake bound imply about the number of features?
- A
With other factors fixed, more features can increase the number of mistakes before convergence
- B
The number of features has no relationship to the convergence behavior
- C
More features prevent convergence even when the data is separable
- D
More features guarantee fewer mistakes because they provide more information
Correct answer
AWith other factors fixed, more features can increase the number of mistakes before convergence
Explanation
The bound depends on the feature dimension k, so increasing the number of features can make convergence take longer.
- A
- 24
How does a larger separability measure δ affect the perceptron mistake bound?
- A
A larger δ makes the classes less distinguishable
- B
A larger δ eliminates the need for training examples
- C
A larger δ generally implies fewer mistakes before convergence
- D
A larger δ necessarily causes the algorithm to oscillate longer
Correct answer
CA larger δ generally implies fewer mistakes before convergence
Explanation
When the classes are farther apart, the problem is easier, and the bound decreases as the separation measure increases.
- A
- 25
How does the multiclass perceptron represent a problem with several classes?
- A
It uses one feature vector for each class but a single scalar weight
- B
It uses one binary label and discards the remaining classes
- C
It uses one weight vector for each class
- D
It uses a single weight vector whose entries are class labels
Correct answer
CIt uses one weight vector for each class
Explanation
For each class y, the multiclass perceptron maintains a separate vector wy.
- A
- 26
How does a multiclass perceptron select its predicted class?
- A
It chooses the class that appeared most often in the training data
- B
It chooses the class with the largest score wy⋅f(x)
- C
It chooses the class with the smallest feature-vector norm
- D
It chooses the class whose weight vector has the fewest nonzero entries
Correct answer
BIt chooses the class with the largest score wy⋅f(x)
Explanation
The score for class y is wy⋅f(x), and the class with the highest score is selected.
- A
- 27
What happens in a multiclass perceptron update when the predicted class y is incorrect and the true class is y∗?
- A
The algorithm changes only the feature vector and leaves all weights fixed
- B
The algorithm adds f(x) to both wy and wy∗
- C
The algorithm subtracts f(x) from both class weight vectors
- D
The algorithm subtracts f(x) from wy and adds f(x) to wy∗
Correct answer
DThe algorithm subtracts f(x) from wy and adds f(x) to wy∗
Explanation
The incorrect class is made less aligned with the example, while the true class is made more aligned: wy′=wy−f(x) and wy∗′=wy∗+f(x).
- A
- 28
What is guaranteed about the scores after a multiclass perceptron update?
- A
The true class is guaranteed to have the highest score immediately
- B
The incorrect class score decreases and the true class score increases relative to their previous scores
- C
All class scores become equal after every update
- D
Every class score increases by the same amount
Correct answer
BThe incorrect class score decreases and the true class score increases relative to their previous scores
Explanation
The update changes the incorrect score by −∥f(x)∥2 and the true score by +∥f(x)∥2. It nudges the scores in the correct direction but does not guarantee an immediate win.
- A
- 29
Why can the length of a multiclass weight vector affect the region assigned to its class?
- A
The length has no effect because only the sign of each coordinate matters
- B
A longer weight vector automatically changes the feature representation
- C
A longer weight vector always has fewer features than a shorter one
- D
A longer weight vector can produce larger inner products and therefore dominate more directions
Correct answer
DA longer weight vector can produce larger inner products and therefore dominate more directions
Explanation
Because scores are inner products, a vector with greater magnitude can achieve larger scores and occupy more of the decision space.
- A
- 30
What is the difference between separability and convergence?
- A
Separability describes the data, whereas convergence describes the behavior of an algorithm run
- B
Both terms refer only to the number of classes in the dataset
- C
Both terms describe whether a feature is positive or negative
- D
Separability describes the algorithm, whereas convergence describes the feature values
Correct answer
ASeparability describes the data, whereas convergence describes the behavior of an algorithm run
Explanation
A dataset is separable if an appropriate boundary exists; an algorithm converges if its sequence of updates eventually stops changing.
- A
- 31
Which training strategy helps detect perceptron overfitting?
- A
Continue updating until training accuracy reaches 100% regardless of holdout accuracy
- B
Stop immediately after the first training example is classified correctly
- C
Use the test data after every update to select the best weights
- D
Monitor accuracy on holdout data and stop when that accuracy begins to decline
Correct answer
DMonitor accuracy on holdout data and stop when that accuracy begins to decline
Explanation
Early stopping uses holdout accuracy as a monitoring signal and stops when it starts decreasing, indicating overfitting to the training data.
- A
- 32
What is the proper role of test data during model training?
- A
It should be used to define the feature representation before training
- B
It should replace the holdout set used for early stopping
- C
It should remain untouched until training is complete and then be used for final evaluation
- D
It should determine the weight update after every misclassified example
Correct answer
CIt should remain untouched until training is complete and then be used for final evaluation
Explanation
Test data is reserved for estimating performance on future unseen data and should not influence training decisions.
- A
- 33
Why is a perceptron decision boundary potentially undesirable even when it makes no training errors?
- A
It necessarily ignores all examples near the center of the dataset
- B
It may place the boundary very close to training examples, leaving poor margin for new data
- C
It always produces probabilities that are too close to 0.5
- D
It cannot represent any linear boundary in feature space
Correct answer
BIt may place the boundary very close to training examples, leaving poor margin for new data
Explanation
The perceptron only requires correct classification, so it may accept a boundary close to data points rather than preferring a safer margin.
- A
- 34
What problem does logistic regression address when the data is not linearly separable?
- A
It models class membership probabilistically instead of requiring every point to be perfectly separated
- B
It removes all feature values that cause classification mistakes
- C
It converts the data into a generative model over all possible inputs
- D
It guarantees that a nonlinear boundary will perfectly fit every training example
Correct answer
AIt models class membership probabilistically instead of requiring every point to be perfectly separated
Explanation
Logistic regression assigns probabilities, allowing examples to lie on the less likely side of a boundary while still optimizing the overall fit.
- A
- 35
What probability does the binary sigmoid assign when the activation z equals zero?
- A
A probability equal to the number of features
- B
A probability of 0
- C
A probability of 0.5
- D
A probability of 1
Correct answer
CA probability of 0.5
Explanation
The sigmoid is σ(z)=1+e−z1. At z=0, it equals 21.
- A
- 36
What happens to the sigmoid probability as z becomes very positive?
- A
It approaches −1
- B
It approaches 1
- C
It approaches 0.5 from below and never changes
- D
It becomes undefined because exponentials cannot take positive inputs
Correct answer
BIt approaches 1
Explanation
For σ(z)=1+e−z1, a very positive z makes e−z close to zero, so the probability approaches 1.
- A
- 37
What happens to the sigmoid probability as z becomes very negative?
- A
It approaches 1
- B
It alternates between 0 and 1 depending on the class label
- C
It becomes exactly equal to the feature-vector norm
- D
It approaches 0
Correct answer
DIt approaches 0
Explanation
A very negative z makes e−z very large, causing σ(z) to approach 0.
- A
- 38
Why is the sigmoid useful for logistic regression?
- A
It maps every activation to either −1 or 1 without intermediate values
- B
It maps any real-valued activation to a value between 0 and 1
- C
It converts a feature vector into a hyperplane directly
- D
It guarantees that all classes have equal probability
Correct answer
BIt maps any real-valued activation to a value between 0 and 1
Explanation
The sigmoid transforms the unrestricted activation z=w⋅f(x) into a probability-like value in the interval from 0 to 1.
- A
- 39
What objective does logistic regression use to choose its parameters?
- A
It maximizes the probability of the feature vectors without considering labels
- B
It chooses the first weight vector that classifies one training example correctly
- C
It maximizes the sum of log probabilities of the observed labels given their features
- D
It minimizes the number of features regardless of classification accuracy
Correct answer
CIt maximizes the sum of log probabilities of the observed labels given their features
Explanation
Logistic regression uses conditional maximum likelihood, maximizing ∑ilogP(yi∣f(xi),w).
- A
- 40
How does the logistic regression objective differ from a generative-model objective?
- A
It focuses on modeling P(y∣x) rather than also modeling the distribution of x
- B
It models only P(x) and obtains labels from an external lookup table
- C
It ignores both labels and features during parameter estimation
- D
It requires a separate probability model for every possible future input
Correct answer
AIt focuses on modeling P(y∣x) rather than also modeling the distribution of x
Explanation
Logistic regression directly optimizes the conditional label distribution, whereas a generative objective can include both P(y∣x) and P(x) through the joint distribution.
- A
- 41
Why can logistic regression prefer one perfectly separating boundary over another?
- A
It always chooses the boundary closest to the origin
- B
It prefers boundaries that make the training labels less probable
- C
It assigns higher likelihood to boundaries that place observed points farther from uncertainty
- D
It chooses randomly because all separating boundaries have identical scores
Correct answer
CIt assigns higher likelihood to boundaries that place observed points farther from uncertainty
Explanation
Points farther from the boundary receive probabilities closer to their observed labels, which can produce a higher log-likelihood and a preference for a larger effective margin.
- A
- 42
What transformation produces multiclass probabilities from class scores?
- A
The softmax transformation
- B
The binary threshold transformation
- C
The perceptron sign transformation
- D
The feature-normalization transformation
Correct answer
AThe softmax transformation
Explanation
Multiclass logistic regression applies softmax to the class activations.
- A
- 43
Which expression correctly gives the softmax probability for class y?
- A
P(y∣x)=∑y′zy′zy
- B
P(y∣x)=1+e−zy1 for every class independently
- C
P(y∣x)=e−zy without any normalization
- D
P(y∣x)=∑y′ezy′ezy
Correct answer
DP(y∣x)=∑y′ezy′ezy
Explanation
Softmax exponentiates each class score and divides by the sum of all exponentiated scores, producing a normalized distribution.
- A
- 44
Why do softmax probabilities sum to one?
- A
The softmax function assigns the same probability to every class
- B
Each exponentiated score is divided by the sum of all exponentiated scores
- C
The largest score is set to one and all other scores are discarded
- D
Every class score is forced to equal one before exponentiation
Correct answer
BEach exponentiated score is divided by the sum of all exponentiated scores
Explanation
The denominator is the sum of the numerator terms, so the normalized class probabilities sum to 1.
- A
- 45
If one class has a much larger score than the others, what happens under softmax?
- A
That class receives the smallest probability because exponentiation reverses order
- B
The probabilities become negative because the score is large
- C
All classes receive exactly the same probability
- D
That class receives most of the probability mass
Correct answer
DThat class receives most of the probability mass
Explanation
Exponentiation preserves ordering and magnifies score differences, so the largest score tends to dominate the normalized probabilities.
- A
- 46
How is multiclass logistic regression trained after applying softmax?
- A
By minimizing the number of class weight vectors to one
- B
By modeling only the distribution of input feature vectors
- C
By selecting the first class whose score is positive
- D
By maximizing the conditional log-likelihood of the observed class labels
Correct answer
DBy maximizing the conditional log-likelihood of the observed class labels
Explanation
The parameters are chosen to maximize the sum of log probabilities assigned by softmax to the correct labels.
- A
- 47
What is the main distinction between discriminative and generative classification in this context?
- A
Discriminative methods focus on P(y∣x), while generative methods model the joint data distribution
- B
Discriminative methods require a Bayes net, while generative methods use no probabilities
- C
Discriminative methods cannot classify multiple classes, while generative methods can
- D
Discriminative methods model only P(x), while generative methods ignore all feature values
Correct answer
ADiscriminative methods focus on P(y∣x), while generative methods model the joint data distribution
Explanation
Discriminative methods directly model the conditional relationship between labels and inputs, whereas generative methods model the data-generating process, often through P(x,y).
- A
- 48
Why might a generative model be useful when only classification is ultimately required?
- A
Modeling the input distribution always gives a larger classification margin
- B
Generative models avoid using any assumptions about the labels
- C
Modeling the input distribution can sometimes regularize the parameters and reduce overfitting
- D
The input distribution guarantees perfect classification on inseparable data
Correct answer
CModeling the input distribution can sometimes regularize the parameters and reduce overfitting
Explanation
The additional modeling of x can act as a form of moderation or regularization, which may help especially when data is limited.
- A
- 49
When might the generative term be especially helpful according to the lecture?
- A
When no feature representation has been constructed
- B
When every class is already perfectly separated
- C
When only a small amount of data is available
- D
When there are infinitely many labeled examples
Correct answer
CWhen only a small amount of data is available
Explanation
With limited data, modeling additional structure through the generative term can help regularize the parameter choice.
- A
- 50
Why might a discriminative approach be preferred with a very large amount of data?
- A
It can focus the available data directly on optimizing the conditional prediction task
- B
It eliminates the need to estimate any parameters
- C
It guarantees that the input distribution is modeled more accurately
- D
It prevents the model from using any class labels
Correct answer
AIt can focus the available data directly on optimizing the conditional prediction task
Explanation
With abundant data, directly optimizing the conditional distribution can focus modeling capacity on the classification decision of interest.
- A
- 51
Which issue does multiclass logistic regression address compared with the multiclass perceptron?
- A
It replaces feature vectors with class labels before scoring
- B
It can converge using probabilistic optimization even when the classes are not perfectly separable
- C
It removes the need for one weight vector per class
- D
It guarantees that every training example receives probability exactly 1
Correct answer
BIt can converge using probabilistic optimization even when the classes are not perfectly separable
Explanation
Softmax probabilities and maximum likelihood provide a stable optimization objective even when no perfect multiclass separation exists.
- A

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