1. Home
  2. Explore
  3. Computer Science
  4. Perceptrons and Logistic Regression

Study methods

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

Perceptrons and Logistic Regression

  • 66Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Classification Foundations

What is the main difference between a full probabilistic model and a linear classifier?

66 questions

  1. 1

    What is the main difference between a full probabilistic model and a linear classifier?

    Model answer

    A full probabilistic model represents the distribution of all relevant variables, whereas a linear classifier focuses directly on mapping feature vectors to class decisions.

    Explanation

    A linear classifier does not provide a complete probabilistic model, but it concentrates its parameters on the classification decision.

  2. 2

    Describe the general pipeline from an input such as an email to a class label.

    Model answer

    The input is converted into a feature vector, and a classifier maps that feature vector to a class label such as spam or non-spam.

    Explanation

    The lecture separates feature extraction from classification: the classifier receives features rather than raw emails or images.

  3. 3

    Give two possible features for classifying an email as spam or non-spam.

    Model answer

    Possible features include the frequency of the word "free," whether the sender is a friend, the presence of misspellings, or the frequency of the recipient's name.

    Explanation

    Feature design may encode word occurrences, sender information, spelling patterns, or related properties of the email.

  4. 4

    Why is feature extraction sometimes described as an art?

    Model answer

    It requires designing useful representations, such as deciding which words to count, which terms to combine as synonyms, and which special properties to include.

    Explanation

    Good features must capture distinctions relevant to the classification task, and choosing them traditionally requires careful human judgment.

  5. 5

    How can an image be represented as a feature vector?

    Model answer

    An image can be represented by pixel values, such as binary values for on/off pixels or numerical grayscale values, and it can also include higher-level features such as the number of loops.

    Explanation

    Pixel values may range from 000 to 111 or from 000 to 255255255, depending on the representation.

  6. 6

    What does a neuron's dendrite do, and what does its axon do?

    Model answer

    Dendrites receive input signals, while the axon carries the neuron's output signal to other neurons.

    Explanation

    The biological neuron provides a loose inspiration for combining inputs and producing an output signal.

  7. 7

    How does the perceptron analogy use connection strengths?

    Model answer

    Each input feature has a weight representing the strength or importance of its connection, and the weighted inputs are combined to produce an activation.

    Explanation

    A larger positive or negative weight makes the corresponding feature have a stronger influence on the activation.

  8. 8

    What is the activation of a linear classifier?

    Model answer

    The activation is the weighted sum of the feature values, written as the inner product w⋅f(x)w \cdot f(x)w⋅f(x).

    Explanation

    Each feature contributes its value multiplied by its corresponding weight.

  9. 9

    How does the binary perceptron convert an activation into a class prediction?

    Model answer

    A positive activation predicts the positive class, and a negative activation predicts the negative class.

    Explanation

    The decision is based on whether the weighted sum lies above or below zero.

  10. 10

    What does the sign of a weight mean in a binary classifier?

    Model answer

    A positive weight makes a feature support the positive class, while a negative weight makes the feature support the negative class.

    Explanation

    For example, a positive weight for the word "free" may support spam, while a negative weight for messages from a friend may oppose spam.

  11. 11

    What is the purpose of a bias term in a linear classifier?

    Model answer

    A bias term represents a default preference for one class and shifts the decision boundary away from the origin.

    Explanation

    The bias can be implemented as an additional feature whose value is always 111.

  12. 12

    How does a positive or negative bias affect binary classification?

    Model answer

    A positive bias favors the positive class by making a larger opposing activation necessary, while a negative bias favors the negative class.

    Explanation

    The bias changes the threshold required for the weighted feature evidence to produce a positive prediction.

  13. 13

    What geometric object does a binary weight vector define?

    Model answer

    It defines a decision hyperplane orthogonal to the weight vector, with the two sides corresponding to the two classes.

    Explanation

    In two dimensions the hyperplane is a line; without a bias it passes through the origin, while a bias shifts it.

  14. 14

    Why does the decision boundary depend on both the weight vector and the bias?

    Model answer

    The weight vector determines the orientation of the boundary, while the bias determines its position.

    Explanation

    Together they determine which feature vectors produce positive or negative scores.

  15. 15

    What is the geometric interpretation of a positive inner product between a weight vector and a feature vector?

    Model answer

    The feature vector points sufficiently in the direction favored by the weight vector, so it is classified as positive.

    Explanation

    A negative inner product indicates that the feature vector lies on the opposing side of the decision boundary.

  16. 16

    Describe the basic training procedure for a binary perceptron.

    Model answer

    Initialize the weights, classify training examples one at a time, update the weights when a prediction is wrong, and repeatedly cycle through the data until no further updates are needed.

    Explanation

    The method is iterative rather than a one-time calculation from the training data.

  17. 17

    When does the binary perceptron leave its weights unchanged?

    Model answer

    It makes no update when the predicted label matches the true label.

    Explanation

    A correctly classified example provides no correction under the basic perceptron rule.

  18. 18

    Why is the feature vector not changed during a perceptron update?

    Model answer

    The feature vector describes the input, whereas the weight vector represents the classifier's decision rule and is the part that can be learned.

    Explanation

    Learning changes how the classifier interprets the fixed representation of an example.

  19. 19

    State the binary perceptron update rule.

    Model answer

    For a misclassified example, update the weights using w′=w+y∗f(x)w' = w + y^* f(x)w′=w+y∗f(x), where y∗y^*y∗ is the true label.

    Explanation

    The update adds the feature vector for a positive mistake and subtracts it for a negative mistake.

  20. 20

    Why does the binary perceptron update move the activation in the desired direction?

    Model answer

    After the update, the new activation is w′⋅f(x)=w⋅f(x)+y∗(f(x)⋅f(x))w' \cdot f(x) = w \cdot f(x) + y^*\left(f(x) \cdot f(x)\right)w′⋅f(x)=w⋅f(x)+y∗(f(x)⋅f(x)); since f(x)⋅f(x)>0f(x) \cdot f(x) > 0f(x)⋅f(x)>0, the activation increases for a positive label and decreases for a negative label.

    Explanation

    The self-inner-product term is positive, so the correction always pushes the current example toward its true class.

  21. 21

    What is the geometric effect of a perceptron update for a negative example?

    Model answer

    The update adds a negative multiple of the feature vector, making the weight vector less aligned with that example.

    Explanation

    This decreases the example's activation and makes a negative prediction more likely.

  22. 22

    How is the perceptron related to feature-based Q-learning?

    Model answer

    Both use an inner product between a weight vector and a feature vector, but Q-learning interprets the result as a value while the perceptron uses its sign or class scores for classification.

    Explanation

    Their learning signals differ: Q-learning bootstraps from estimated future values, whereas the perceptron receives a supervised target label.

  23. 23

    What role could a learning rate play in perceptron training?

    Model answer

    A learning rate can scale the update so that the weights change more gradually rather than moving by the full feature vector.

    Explanation

    A scaled update can reduce overly large changes caused by individual examples.

  24. 24

    What does it mean for binary training data to be linearly separable?

    Model answer

    The data is linearly separable if a hyperplane exists that places all examples of one class on one side and all examples of the other class on the other side.

    Explanation

    In two dimensions, the separating hyperplane is a line.

  25. 25

    What convergence guarantee does the binary perceptron have for linearly separable data?

    Model answer

    If the data is linearly separable, the binary perceptron is guaranteed eventually to converge to a separating decision boundary.

    Explanation

    The particular boundary found need not be unique, but it will separate the training examples.

  26. 26

    What happens when the data is not linearly separable and the basic perceptron is run indefinitely?

    Model answer

    The perceptron can continue making mistakes and updating its weights without converging.

    Explanation

    Correcting one misclassified point can cause another point to become misclassified, producing repeated changes.

  27. 27

    State the qualitative perceptron mistake-bound relationship involving the number of features and separability.

    Model answer

    The mistake bound grows with the number of features and decreases as the separation measure becomes larger; it has the form proportional to kδ2\frac{k}{\delta^2}δ2k​.

    Explanation

    Here kkk is the number of features and δ\deltaδ measures the separation between the classes.

  28. 28

    Why does increasing the number of features generally make perceptron convergence slower?

    Model answer

    More features create more dimensions and more information for the classifier to learn, so more updates may be required before it finds a suitable boundary.

    Explanation

    This is reflected in a mistake bound that increases with the feature dimension.

  29. 29

    Why does greater separation between classes make perceptron learning easier?

    Model answer

    A larger separation measure means the classes are farther apart, so fewer corrections are needed to find a separating boundary.

    Explanation

    The mistake bound decreases as δ\deltaδ increases.

  30. 30

    Distinguish separability from convergence.

    Model answer

    Separability is a property of the data indicating whether a suitable boundary exists, while convergence is a property of an algorithm run indicating whether its updates eventually stop.

    Explanation

    A binary perceptron converges for separable data, but it is not guaranteed to converge for arbitrary data.

  31. 31

    Why can a perceptron boundary be undesirable even when it makes no training mistakes?

    Model answer

    It may place the boundary very close to training points, making the classifier sensitive to small changes or new examples.

    Explanation

    The perceptron only seeks a separating boundary and does not prefer one with a larger margin.

  32. 32

    How can early stopping help prevent perceptron overfitting?

    Model answer

    Training is stopped when accuracy on a holdout set begins to decrease, because further updates are likely memorizing the training data rather than improving generalization.

    Explanation

    Training accuracy may continue increasing even after performance on unseen-like holdout data begins to decline.

  33. 33

    What are the roles of training, holdout, and test data?

    Model answer

    Training data updates the model, holdout data monitors training and helps select when to stop, and test data is kept untouched until final evaluation.

    Explanation

    Keeping test data separate provides a more reliable estimate of future performance.

  34. 34

    How does a multiclass perceptron represent multiple classes?

    Model answer

    It uses one weight vector wyw_ywy​ for each class and assigns an example to the class with the largest score wy⋅f(x)w_y \cdot f(x)wy​⋅f(x).

    Explanation

    Each class weight vector represents the direction associated with that class.

  35. 35

    Why can a binary classifier use one weight vector, whereas a multiclass classifier generally uses one per class?

    Model answer

    In the binary case, one vector can distinguish positive from negative using the sign of its score, but multiple classes require comparing separate scores for the possible classes.

    Explanation

    For two classes, two class-specific vectors can be simplified to a single relative decision vector.

  36. 36

    Describe the multiclass perceptron update when the predicted class is yyy but the true class is y∗y^*y∗.

    Model answer

    Subtract the feature vector from the incorrectly predicted class vector and add it to the true class vector: wy′=wy−f(x)w_y' = w_y - f(x)wy′​=wy​−f(x) and wy∗′=wy∗+f(x)w_{y^*}' = w_{y^*} + f(x)wy∗′​=wy∗​+f(x).

    Explanation

    The update lowers the incorrect class's score and raises the correct class's score for the current example.

  37. 37

    Why does the multiclass update lower the incorrect class's score?

    Model answer

    The updated score becomes (wy−f(x))⋅f(x)=wy⋅f(x)−f(x)⋅f(x)(w_y - f(x)) \cdot f(x) = w_y \cdot f(x) - f(x) \cdot f(x)(wy​−f(x))⋅f(x)=wy​⋅f(x)−f(x)⋅f(x), and the subtracted self-inner product is positive.

    Explanation

    Therefore the incorrect class becomes less aligned with the example.

  38. 38

    Why does the multiclass update raise the true class's score?

    Model answer

    Adding f(x)f(x)f(x) to the true class vector increases its score by the positive quantity f(x)⋅f(x)f(x) \cdot f(x)f(x)⋅f(x).

    Explanation

    The true class becomes more aligned with the current feature vector.

  39. 39

    Does a multiclass perceptron update guarantee that the correct class becomes the winner immediately?

    Model answer

    No. It guarantees only that the correct class's score increases and the incorrect class's score decreases for that example; the correct class may still not have the highest score.

    Explanation

    The update nudges the scores in the right direction but does not guarantee a large enough change.

  40. 40

    What does multiclass separability mean geometrically?

    Model answer

    There must be class-specific weight vectors whose score regions contain all examples belonging to their respective classes.

    Explanation

    The feature space is divided into regions according to which class weight vector gives the highest inner product.

  41. 41

    How do the lengths of multiclass weight vectors affect classification regions?

    Model answer

    A longer weight vector can produce larger inner products and therefore dominate more of the feature space, while a shorter vector generally controls a smaller region.

    Explanation

    If all weight vectors have equal length, the regions are determined mainly by their directions or angles.

  42. 42

    How does the multiclass perceptron training loop differ from the binary loop?

    Model answer

    It still processes examples one at a time and updates only on mistakes, but each mistake changes two class-specific weight vectors instead of one shared binary vector.

    Explanation

    The incorrect class is pushed away from the example and the true class is pulled toward it.

  43. 43

    What is the stopping condition commonly used for perceptron training?

    Model answer

    Training can stop after a complete pass through the training data produces no updates.

    Explanation

    If every example is already classified correctly, another pass will also make no updates under the same conditions.

  44. 44

    Why does logistic regression use a probabilistic rather than a hard decision?

    Model answer

    It assigns probabilities to classes, allowing uncertain or imperfectly separable examples instead of requiring every example to lie on the correct side of a hard boundary.

    Explanation

    A point near the boundary can receive a probability near 0.50.50.5, while points farther away receive more confident probabilities.

  45. 45

    What problem does logistic regression address when perceptron data is not separable?

    Model answer

    It provides a stable probabilistic objective that can be optimized even when no perfect linear boundary exists, avoiding the perceptron's continual bouncing.

    Explanation

    The model can assign a nonzero probability to an example being on the unexpected side of the boundary.

  46. 46

    What is the sigmoid function used in binary logistic regression?

    Model answer

    The sigmoid function is σ(z)=11+e−z\sigma(z) = \frac{1}{1 + e^{-z}}σ(z)=1+e−z1​.

    Explanation

    It maps any real-valued score to a value between 000 and 111.

  47. 47

    What happens to the sigmoid output as zzz approaches negative or positive infinity?

    Model answer

    As zzz approaches negative infinity, the sigmoid approaches 000; as zzz approaches positive infinity, it approaches 111.

    Explanation

    At z=0z = 0z=0, the sigmoid gives a probability of 0.50.50.5.

  48. 48

    How is the logistic regression score computed from the features?

    Model answer

    The score is z=w⋅f(x)z = w \cdot f(x)z=w⋅f(x), and the score is passed through the sigmoid to obtain the probability of the positive class.

    Explanation

    The weight vector determines the direction of the boundary, while the sigmoid converts the signed score into a probability.

  49. 49

    How is the probability of the negative class obtained in binary logistic regression?

    Model answer

    It is the complement of the positive-class probability: P(y=−1∣x)=1−P(y=1∣x)P(y=-1 \mid x) = 1 - P(y=1 \mid x)P(y=−1∣x)=1−P(y=1∣x).

    Explanation

    The two class probabilities must sum to 111.

  50. 50

    What objective does maximum-likelihood logistic regression optimize?

    Model answer

    It chooses the weights that maximize the sum of log probabilities of the observed labels given their inputs: ∑ilog⁡P(yi∣xi;w)\sum_i \log P(y_i \mid x_i; w)∑i​logP(yi​∣xi​;w).

    Explanation

    The objective focuses on predicting labels from inputs rather than modeling how the inputs themselves are distributed.

  51. 51

    Why are logarithms used in the logistic regression likelihood objective?

    Model answer

    Taking logarithms converts products of example probabilities into sums, producing a more convenient objective while preserving the maximizing parameter choice.

    Explanation

    The resulting sum of log probabilities is easier to evaluate and optimize than the product of probabilities.

  52. 52

    Why can logistic regression prefer a boundary with a larger margin than the perceptron?

    Model answer

    Examples farther from the boundary receive more confident probabilities, so a boundary that leaves greater distance from the data can achieve a higher log likelihood.

    Explanation

    The perceptron treats any perfectly separating boundary as acceptable, whereas logistic regression distinguishes between their confidence levels.

  53. 53

    How does logistic regression behave when a data point lies on the decision boundary?

    Model answer

    Its score is near 000, so the sigmoid assigns approximately equal probabilities to the two classes.

    Explanation

    This represents uncertainty rather than forcing an absolute class decision.

  54. 54

    What is the difference between generative and discriminative training?

    Model answer

    Generative training models the joint distribution of inputs and labels, while discriminative training directly models or optimizes the conditional distribution of labels given inputs.

    Explanation

    Logistic regression is discriminative because it focuses on P(y∣x)P(y \mid x)P(y∣x).

  55. 55

    What two terms are present when a joint log likelihood is decomposed?

    Model answer

    The joint objective can be written as a label-given-input term plus an input-distribution term: log⁡P(y,x)=log⁡P(y∣x)+log⁡P(x)\log P(y,x) = \log P(y \mid x) + \log P(x)logP(y,x)=logP(y∣x)+logP(x).

    Explanation

    Generative models optimize both terms, while discriminative models focus only on the conditional label term.

  56. 56

    Why might discriminative training be preferred when classification is the only goal?

    Model answer

    It concentrates the model's capacity on predicting labels from inputs instead of allowing the input-distribution term to influence the parameters.

    Explanation

    If only P(y∣x)P(y \mid x)P(y∣x) matters, optimizing P(x)P(x)P(x) can introduce an unnecessary trade-off.

  57. 57

    Why might a generative model still be useful, especially with limited data?

    Model answer

    Modeling the input distribution can regularize the parameters and reduce overfitting, which may help when only a small amount of labeled data is available.

    Explanation

    The additional term can moderate the choice of weights rather than letting them focus exclusively on fitting the conditional labels.

  58. 58

    Why can discriminative training be especially attractive with large amounts of data?

    Model answer

    With abundant data, directly optimizing the conditional classification objective can focus strongly on the prediction task without needing the additional regularizing effect of modeling the inputs.

    Explanation

    The large data set provides enough evidence to estimate the decision relationship directly.

  59. 59

    How does multiclass logistic regression convert class scores into probabilities?

    Model answer

    It applies the softmax function, assigning class yyy the probability P(y∣x)=ezy∑y′ezy′P(y \mid x) = \frac{e^{z_y}}{\sum_{y'} e^{z_{y'}}}P(y∣x)=∑y′​ezy′​ezy​​, where zy=wy⋅f(x)z_y = w_y \cdot f(x)zy​=wy​⋅f(x).

    Explanation

    Exponentiation makes every class score positive, and division by the total makes the probabilities sum to 111.

  60. 60

    Why does softmax produce a valid probability distribution?

    Model answer

    Each ezye^{z_y}ezy​ is positive, and dividing each one by the sum of all exponentiated scores makes the probabilities sum to 111.

    Explanation

    The normalization step converts arbitrary real-valued scores into nonnegative normalized values.

  61. 61

    How does a class's score affect its softmax probability relative to other classes?

    Model answer

    A class with the highest score receives the highest probability, and increasing its score relative to the others increases its share of the probability.

    Explanation

    Because exponentials grow rapidly, even a moderate score advantage can strongly increase the corresponding probability.

  62. 62

    What happens to softmax probabilities when two class scores are equal?

    Model answer

    Those classes receive equal probability contributions, assuming their scores are equal.

    Explanation

    Softmax depends on the relative scores, so equal scores produce equal exponentiated values.

  63. 63

    How does multiclass logistic regression train its parameters?

    Model answer

    It chooses the class weight vectors that maximize the sum of log probabilities assigned to the observed labels given their feature vectors.

    Explanation

    This is maximum-likelihood estimation applied to the softmax conditional distribution.

  64. 64

    What two perceptron problems does multiclass logistic regression address?

    Model answer

    It avoids endless updates on nonseparable data and prefers boundaries that place data farther from the boundary rather than stopping at any zero-error boundary.

    Explanation

    Its probabilistic likelihood objective supports convergence and rewards confident, higher-margin predictions.

  65. 65

    Why can softmax classification represent uncertainty among several classes?

    Model answer

    It assigns a probability to every class, such as a high probability for one class and smaller probabilities for competing classes.

    Explanation

    Unlike a hard winner-take-all decision, softmax expresses relative confidence across all possible labels.

  66. 66

    What is the key difference between a multiclass perceptron score and a softmax activation?

    Model answer

    A multiclass perceptron uses raw class scores to choose the largest one, while softmax converts those scores into normalized probabilities before classification.

    Explanation

    The raw scores can be any real numbers, whereas softmax outputs values between 000 and 111 that sum to 111.

1 of 66
Question 1 of 66

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent