7. Machine Learning

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/50

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:02 PM on 10/14/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

51 Terms

1
New cards

What is Machine Learning and how is it different from planning?

  • Planning use existing model to make optimal decisions(e.g Search, Games, Bayes Nets, HMMs, MDPs)

  • Machine Learning (ML) learns model from data and experiences, including its parameters(probabilities), structure, and hidden concepts (clusters or latent features)


<ul><li><p>Planning use existing model to make optimal decisions(e.g Search, Games, Bayes Nets, HMMs, MDPs)</p></li><li><p>Machine Learning (ML) learns model from data and experiences, including its parameters(probabilities), structure, and hidden concepts (clusters or latent features)</p></li></ul><p></p>
2
New cards
<p>What is classification in Machine Learning?</p>

What is classification in Machine Learning?

Classifications predicts a predefined label(class) yy from an input xx

The process is:

Input→ Feature Extraction → ML model → Predicted label

<p>Classifications predicts a predefined label(class) $$y$$ from an input $$x$$</p><p>The process is:</p><p>Input→ Feature Extraction → ML model → Predicted label</p>
3
New cards

What are features and why are they important?

Features: characteristics of the input that help predict its label. They may be provided, manually designed, or learned from data

  • For example, an email’s feature might include sender identity, suspicious words, or capital letters


<p>Features: characteristics of the input that help predict its label. They may be provided, manually designed, or learned from data</p><ul><li><p>For example, an email’s feature might include sender identity, suspicious words, or capital letters</p></li></ul><p></p>
4
New cards

How does machine learning model learn from data?

It learns patterns between features and known labels using training data(seen examples) , then use those patterns to predict labels for new, unseen data

<p>It learns patterns between features and known labels using training data(seen examples) , then use those patterns to predict labels for new, unseen data</p>
5
New cards

What is ground truth and how is it used in classification?

Ground truth means the correct label assigned to training examples, often by humans. It tells the model what the correct output should be during learning

6
New cards

What are some examples of classification and their features?

  • Spam detection: Email → spam/safe; features include “FREE”, capital letters, dollar amounts, and known sender

  • Digital recognition: Image → 0-9; features include pixels, shape, aspect ratio and loops

  • Other examples: Symptoms → disease, transaction → fraud/no fraud, essays → grades, reviews → sentiment,images → object type


<ul><li><p>Spam detection: Email → spam/safe; features include “FREE”, capital letters, dollar amounts, and known sender</p></li><li><p>Digital recognition: Image → 0-9; features include pixels, shape, aspect ratio and loops</p></li><li><p>Other examples: Symptoms → disease, transaction → fraud/no fraud, essays → grades, reviews → sentiment,images → object type</p></li></ul><p></p>
7
New cards
<p>What is the difference between model-based and instance-based classification? </p>

What is the difference between model-based and instance-based classification?

  • Model-based (eager learning): Learns a model, such as Bayes Net, linear discriminator, or tree, and uses it to predict labels. Key challenges are using the structure and parameters

  • Instance-based (lazy learning): compares new inputs with stored examples, such as k-nearest neighbors (k-NN)


8
New cards

What is Naïve Bayes Model?

a probabilistic classifier represented by a Bayesian Network with:

  • one parent: Label YY

  • Many children: Features F1,F2,…,FnF_1, F_2, …, F_n

It uses feature probabilities to predict most likely label


<p>a probabilistic classifier represented by a Bayesian Network with:</p><ul><li><p>one parent: Label $$Y$$</p></li><li><p>Many children: Features $$F_1, F_2, …, F_n$$ </p></li></ul><p>It uses feature probabilities to predict most likely label</p><p></p>
9
New cards
<p>What probability tables must Naïve Bayes learn?</p>

What probability tables must Naïve Bayes learn?

  • P(Y)P(Y): prior probabbility of each label, before observing features

  • P(Fi∣Y)P(F_i|Y): probability of a feature given a label

There is one conditional probability table per feature

<ul><li><p>$$P(Y)$$: prior probabbility of each label, before observing features</p></li><li><p>$$P(F_i|Y)$$: probability of a feature given a label</p></li></ul><p>There is one conditional probability table per feature</p>
10
New cards
<p>From the Example of Naïve Bayes Net for Spam Filter, define features to form a Bayes’ net</p>

From the Example of Naïve Bayes Net for Spam Filter, define features to form a Bayes’ net

knowt flashcard image
11
New cards

What is the difference between training and inference in Naïve Bayes?

  • Training: Learns P(Y)P(Y) and P(Fi∣Y)P(F_i|Y) from labeled data

  • Inference: Use the observed features as evidence to calculate P(Y∣F1,…,Fn)P(Y|F_1,…,F_n) and predict a label


<ul><li><p>Training: Learns $$P(Y)$$ and $$P(F_i|Y)$$ from labeled data</p></li><li><p>Inference: Use the observed features as evidence to calculate $$P(Y|F_1,…,F_n)$$ and predict a label</p></li></ul><p></p>
12
New cards

How is Naïve Bayes used for spam detection?

The label is spam or safe

Example features:

  • F1F_1: is the sender known? (Yes/No → binary feature)

  • F2F_2: how many times does “FREE” appear? (0,1,2,… → count feature)

The model learns the probabilities of these features for spam and safe emails


<p>The label is spam or safe </p><p>Example features:</p><ul><li><p>$$F_1$$: is the sender known? (Yes/No → binary feature)</p></li><li><p>$$F_2$$: how many times does “FREE” appear? (0,1,2,… → count feature)</p></li></ul><p>The model learns the probabilities of these features for spam and safe emails</p><p></p>
13
New cards
<p>How are conditional probabilities estimated from training data?</p>

How are conditional probabilities estimated from training data?

Count how often a feature occurs within examples of a particular class, then divide by the total examples in that class

*form in pict

Example from page 17: one of two safe emails contains “FREE” zero times, so the probability is 0.5

<p>Count how often a feature occurs within examples of a particular class, then divide by the total examples in that class</p><p>*form in pict</p><p>Example from page 17: one of two safe emails contains “FREE” zero times, so the probability is 0.5</p>
14
New cards

How does Naïve Bayes classify a new email?

Extract its features, calculate a score for each label, normalize the scores, and choose the highest probability

For page 20:

Spamscore=0.4(0.1)(0.12)=0.0048Spam score= 0.4(0.1)(0.12)=0.0048

Safescore=0.6(0.7)(0.007)=0.00294Safescore=0.6(0.7)(0.007)=0.00294

After normalization: 14% spam, 86% safe → predict safe

15
New cards

What is main assumption of Naïve Bayes?

All features are conditionally independent

  • in other words, once YY is known, knowing one feature does not change the probability of another feature

    *form in pict

  • This simplifies the model and makes the number of probability-table entries grow lineraly with the number of features, rather than exponentially


<p>All features are conditionally independent</p><ul><li><p>in other words, once $$Y$$ is known, knowing one feature does not change the probability of another feature</p><p>*form in pict</p></li><li><p>This simplifies the model and makes the number of probability-table entries grow lineraly with the number of features, rather than exponentially </p></li></ul><p></p>
16
New cards

What are the 3 steps of genral Naïve Bayes inference?

  1. Calculate the joint probability for each label using the prior and feature probabilities

  2. Sum the joint probabilities to get the evidence probability

  3. Normalize each label’s score by dividing by that sum

    *form in pict


<ol><li><p>Calculate the joint probability for each label using the prior and feature probabilities</p></li><li><p>Sum the joint probabilities to get the evidence probability </p></li><li><p>Normalize each label’s score by dividing by that sum</p><p>*form in pict</p></li></ol><p></p>
17
New cards

How does Naïve Bayes recognize handwritten digits?

  • A digit image is divided into a pixel grid, such as 16×16, with a feature for each pixel.

  • Each pixel becomes on/off unsing an intensity threshold(e.g 0.5)

  • The model learns the probability of each pexel being on/off for each digit and predicts te most likely digit


<ul><li><p>A digit image is divided into a pixel grid, such as 16×16, with a feature for each pixel. </p></li><li><p>Each pixel becomes on/off unsing an intensity threshold(e.g 0.5)</p></li><li><p>The model learns the probability of each pexel being on/off for each digit and predicts te most likely digit</p></li></ul><p></p>
18
New cards

What is Bag-of-Words(BOW) in Naïve Bayes?

Bag-of-Words represent a text using its words without considering their order or context

Each word position WiW_i is treated as a feature, and the model learns how likely each word is for spam or safe emails.

<p>Bag-of-Words represent a text using its words without considering their order or context </p><p>Each word position $$W_i$$ is treated as a feature, and the model learns how likely each word is for spam or safe emails.</p>
19
New cards

What assumptions does BOW Naïve Bayes make?

Words are:

  • Conditionally independent given the label

  • Identically distributed across positions

All word positions share the same P(W∣Y)P(W|Y) , called tied distributions



<p>Words are:</p><ul><li><p>Conditionally independent given the label</p></li><li><p>Identically distributed across positions</p></li></ul><p>All word positions share the same $$P(W|Y)$$ , called tied distributions</p><p></p><p></p>
20
New cards

Why does BOW Naïve Bayes use log probabilities?

Multiplying many tiny word probabilities produces extremely small numbers. Taking logarithms converts multiplication into addition, making calculations easier and more stable

*form in pict

In the lecture’s email example, the final prediction is approximately 98.9% spam

<p>Multiplying many tiny word probabilities produces extremely small numbers. Taking logarithms converts multiplication into addition, making calculations easier and more stable</p><p>*form in pict</p><p>In the lecture’s email example, the final prediction is approximately 98.9% spam</p>
21
New cards

Why do we divide labeled dataset into 3 sets?

Each set has a different purpose:

  • Training set: seen data used to learn model parameters

  • Held-out/validation set: Data used to tune hyperparameters and features

  • Test set: unseen data used to evaluate final performance

The test set should not be used to tune the model


<p>Each set has a different purpose:</p><ul><li><p>Training set: seen data used to learn model parameters</p></li><li><p>Held-out/validation set: Data used to tune hyperparameters and features</p></li><li><p>Test set: unseen data used to evaluate final performance</p></li></ul><p>The test set should not be used to tune the model</p><p></p>
22
New cards

What are overfitting and generalization?

  • Overfitting: a model performs well on training data but poorly on new data

  • Generalization: a model learns useful patterns that also work on unseen data


23
New cards
<p>What is parameter estimation?</p>

What is parameter estimation?

Learning unknown model values, such as P(spam)P(spam) , from observed data instead of asking human expert

  • Example: If 2 of 3 training emails are spam: P^(spam)=23\hat{P}(spam)=\frac{2}{3}

→ the unknown parameter is often represented by θ\theta

<p>Learning unknown model values, such as $$P(spam)$$ , from observed data instead of asking human expert</p><ul><li><p>Example: If 2 of 3 training emails are spam: $$\hat{P}(spam)=\frac{2}{3}$$</p></li></ul><p>→ the unknown parameter is often represented by $$\theta$$ </p>
24
New cards

What is Maximum Likelihood Estimation(MLE)?

MLE chooses the parameter value that makes the observed training data most likely

θ∗=argmax⁡θP(D∣θ)\theta^* = arg\max\limits_{\theta} P(D|\theta)

For 2 spam and 1 safe email, the lecture uses:

L(θ)=θ2(1−θ)L(\theta)=\theta²(1-\theta)

the maximum occurs at θ=23\theta=\frac{2}{3} . we can also maximize the log-likelihood, which turns products into sums

<p>MLE chooses the parameter value that makes the observed training data most likely</p><p>$$\theta^* = arg\max\limits_{\theta} P(D|\theta)$$ </p><p>For 2 spam and 1 safe email, the lecture uses:</p><p>$$L(\theta)=\theta²(1-\theta)$$ </p><p>the maximum occurs at $$\theta=\frac{2}{3}$$ . we can also maximize the log-likelihood, which turns products into sums</p>
25
New cards

What is the difference between parameters and hyperparameters?

  • Parameters: Values learned from training data, such as probabilities or weight

  • Hyperparameters: Settings chosen to control the learning process , such as the Laplace smoothing factor kk


<ul><li><p>Parameters: Values learned from training data, such as probabilities or weight</p></li><li><p>Hyperparameters: Settings chosen to control the learning process , such as the Laplace smoothing factor $$k$$ </p></li></ul><p></p>
26
New cards

What is Laplace smoothing and why do we tune it?

Laplace smoothing adds a small pseudocount kk to possible outcomes so unseen outcomes do not automatically eeceive zerp probability

*form in pict

Here, NN is the sample count and ∣X∣|X| is the number of possible outcomes

  • We choose kk using validation data, not test set. Larger kk generally makes probabilities smoother


27
New cards
<p>Why might we need to tune or add features?</p>

Why might we need to tune or add features?

Existing features may miss useful information

  • For spam detection, we might add whether the sender is familira, whether the email uses ALL CAPS, whether many people received it, whether links are suspicious, or whether the message addresses the recipient by name


28
New cards
<p>How do we evaluate a classifier and why is a baseline important?</p>

How do we evaluate a classifier and why is a baseline important?

A baseline is a simple method used as a minimum performance comparison, such as always predicting the most common class

  • A confusion matrix records:

    • TP: positive correctly predicted

    • TN: negative correctly predicted

    • FP: negative incorrectly predicted as positive

    • FN: positive incorrectly predicted as negative


Common metrics: *form in pict

A high accuracy alone can be misleading when classes are imbalanced. For example, predicting everything as safe might already give 66% accuracy, so 70% may not be impressive.



<p>A baseline is a simple method used as a minimum performance comparison, such as always predicting the most common class</p><ul><li><p>A confusion matrix records:</p><ul><li><p>TP: positive correctly predicted</p></li><li><p>TN: negative correctly predicted</p></li><li><p>FP: negative incorrectly predicted as positive</p></li><li><p>FN: positive incorrectly predicted as negative</p></li></ul></li></ul><p></p><p>Common metrics: *form in pict</p><p>A high accuracy alone can be misleading when classes are <strong>imbalanced</strong>. For example, predicting everything as safe might already give 66% accuracy, so 70% may not be impressive.</p><p></p><p></p>
29
New cards
<p>What is a vector and what is a dot product?</p>

What is a vector and what is a dot product?

  • A vector is a list of numbers representing a point or direction, such as (2,7,−3,6)(2,7,-3,6), which has 4 dimensions

  • Dot product multiples matching components and adds them:

a.b=∑iaibi=∣a∣∣b∣cosθa.b=\sum\limits_{i} a_ib_i = |a||b|cos\theta

Positive: Angle less than 90°\degree

Zero: Angle equal to 90°\degree

Negative: Angle greater than 90°\degree

  • For fixed vector lengths, a smaller angle means a larger dot product.


<ul><li><p>A vector is a list of numbers representing a point or direction, such as $$(2,7,-3,6)$$, which has 4 dimensions </p></li><li><p>Dot product multiples matching components and adds them: </p></li></ul><p>$$a.b=\sum\limits_{i} a_ib_i = |a||b|cos\theta$$ </p><p>Positive: Angle less than 90$$\degree$$ </p><p>Zero: Angle equal to 90$$\degree$$ </p><p>Negative: Angle greater than 90$$\degree$$ </p><ul><li><p><span>For fixed vector lengths, a smaller angle means a larger dot product.</span></p></li></ul><p></p>
30
New cards

What is feature vector in Machine Learning?

A numerical representation of an input’s features

  • For an email, the vector might contain counts of “FREE”, misspelling, or whether the sender is known. It allows the model to calculate predictions mathematically


<p>A numerical representation of an input’s features </p><ul><li><p>For an email, the vector might contain counts of “FREE”, misspelling, or whether the sender is known. It allows the model to calculate predictions mathematically </p></li></ul><p></p>
31
New cards

What is perceptron?

A simple linear classifier inspired by a biological neuron. It multiplies input features by learned weights , adds the results, and predicts a class

<p>A simple linear classifier inspired by a biological neuron. It multiplies input features by learned weights , adds the results, and predicts a class</p>
32
New cards
<p>How does a binary perceptron make a prediction?</p>

How does a binary perceptron make a prediction?

Calculate its activation using the dot product:

x=w.f(x)=∑iwifi(x)x=w.f(x)=\sum\limits_{i} w_if_i(x)

  • z>0z>0: Predict class +1

  • z<0z<0: Predict class -1

  • For the spam example, +1 represents spam and −1 represents safe. A zero activation lies on the decision boundary and needs a tie-breaking convention.


<p>Calculate its activation using the dot product: </p><p>$$x=w.f(x)=\sum\limits_{i} w_if_i(x)$$ </p><ul><li><p>$$z&gt;0$$: Predict class +1</p></li><li><p>$$z&lt;0$$: Predict class -1</p></li><li><p><span>For the spam example, +1 represents spam and −1 represents safe. A zero activation lies on the decision boundary and needs a tie-breaking convention.</span></p></li></ul><p></p>
33
New cards

What do positive and negative weights mean in a perceptron?

A positive weight pushes the prediction toward +1, while a negative weight pushes it toward −1.

For spam filtering, a high positive weight for “FREE” may increase the spam score, while a negative weight for a familiar sender may decrease it.

<p><span>A <strong>positive weight</strong> pushes the prediction toward +1, while a <strong>negative weight</strong> pushes it toward −1.</span></p><p><span>For spam filtering, a high positive weight for “FREE” may increase the spam score, while a negative weight for a familiar sender may decrease it.</span></p>
34
New cards
<p><span><strong>What is a decision boundary or hyperplane?</strong></span></p>

What is a decision boundary or hyperplane?

The line or higher-dimensional surface that separates predicted classes.

w.f(x)=0w.f(x)=0

One side predicts +1, and the other predicts −1. A bias can shift the boundary away from the origin.

<p><span>The line or higher-dimensional surface that <strong>separates predicted classes</strong>.</span></p><p><span>$$w.f(x)=0$$ </span></p><p><span>One side predicts <strong>+1</strong>, and the other predicts <strong>−1</strong>. A <strong>bias</strong> can shift the boundary away from the origin.</span></p>
35
New cards

How does a binary perceptron learn its weights?

Start with initial weights, often zero. For each labeled example:

  • Correct prediction: Keep the weights.

  • Wrong prediction: Adjust the weights toward the correct class.

The update is:

wnew=wold+y∗f(x)w_{new}=w_{old}+y^* f(x)

where y∗y^*is the true label, either +1 or −1.

<p><span>Start with initial weights, often zero. For each labeled example:</span></p><ul><li><p><span><strong>Correct prediction:</strong> Keep the weights.</span></p></li><li><p><span><strong>Wrong prediction:</strong> Adjust the weights toward the correct class.</span></p></li></ul><p><span>The update is: </span></p><p><span>$$w_{new}=w_{old}+y^* f(x)$$ </span></p><p><span>where $$y^*$$is the true label, either +1 or −1.</span></p>
36
New cards
<p><span><strong>Why do we add or subtract the feature vector during perceptron learning?</strong></span></p>

Why do we add or subtract the feature vector during perceptron learning?

  • Predicted +1, actually −1: Subtract f(x)f(x) to lower the activation.

  • Predicted −1, actually +1: Add f(x)f(x) to increase the activation.

This works because adding f(x)f(x)increases the dot product by ∣∣f(x)∣∣2||f(x)||², while subtracting decreases it by the same amount.

<ul><li><p><span><strong>Predicted +1, actually −1:</strong> Subtract $$f(x)$$  to <strong>lower the activation</strong>.</span></p></li><li><p><span><strong>Predicted −1, actually +1:</strong> Add $$f(x)$$ to <strong>increase the activation</strong>.</span></p></li></ul><p><span>This works because adding $$f(x)$$increases the dot product by $$||f(x)||²$$, while subtracting decreases it by the same amount.</span></p>
37
New cards

How does a multiclass perceptron classify inputs?

Instead of one weight vector, it uses one weight vector per class.

For each class yy:

zy=wy.f(x)z_y=w_y.f(x)

Then choose the class with the highest activation:

y^=argmax⁡yzy\hat{y}=arg\max\limits_{y} z_y

<p><span>Instead of one weight vector, it uses <strong>one weight vector per class</strong>.</span></p><p><span>For each class $$y$$:</span></p><p><span>$$z_y=w_y.f(x)$$ </span></p><p><span>Then choose the class with the <strong>highest activation</strong>:</span></p><p><span>$$\hat{y}=arg\max\limits_{y} z_y$$ </span></p>
38
New cards

How does a multiclass perceptron update weights after a mistake?

If the predicted class is wrong:

  • Add the feature vector to the correct class's weights.

  • Subtract it from the incorrectly predicted class's weights.

  • Leave other class weights unchanged.

This raises the correct class's score and lowers the wrong class's score.

39
New cards

What are the main problems with perceptrons?

  • Noisy/non-separable data: A straight boundary cannot correctly separate all examples, so weights may keep changing.

  • Mediocre generalization: It may find a boundary that only barely separates training examples.

  • Overtraining/overfitting: Training performance improves while validation/test performance eventually worsens.


<ul><li><p><span><strong>Noisy/non-separable data:</strong> A straight boundary cannot correctly separate all examples, so weights may keep changing.</span></p></li><li><p><span><strong>Mediocre generalization:</strong> It may find a boundary that only barely separates training examples.</span></p></li><li><p><span><strong>Overtraining/overfitting:</strong> Training performance improves while validation/test performance eventually worsens.</span></p></li></ul><p></p>
40
New cards

How can perceptron learning be improved?

The lecture introduces the averaged perceptron, which averages weight vectors over training to reduce unstable changes caused by noisy examples.

It also motivates moving from hard class decisions to probabilistic decisions when data cannot be perfectly separated.

<p><span>The lecture introduces the <strong>averaged perceptron</strong>, which averages weight vectors over training to reduce unstable changes caused by noisy examples.</span></p><p><span>It also motivates moving from <strong>hard class decisions</strong> to <strong>probabilistic decisions</strong> when data cannot be perfectly separated.</span></p>
41
New cards

Why do we need probabilistic decisions instead of deterministic decisions?

  • A deterministic classifier gives only a fixed class (+1 or −1), even when the data is difficult to separate.

  • A probabilistic classifier gives a probability for each class, showing how confident the model is.

→ For example, instead of simply predicting spam, it might predict 90% spam and 10% safe.

<ul><li><p><span>A <strong>deterministic classifier</strong> gives only a fixed class (+1 or −1), even when the data is difficult to separate.</span></p></li><li><p><span>A <strong>probabilistic classifier</strong> gives a probability for each class, showing <strong>how confident</strong> the model is.</span></p></li></ul><p><span>→ For example, instead of simply predicting spam, it might predict <strong>90% spam and 10% safe</strong>.</span></p>
42
New cards

What is the difference between a step function and a sigmoid function?

  • Step function : Gives a hard decision, 0 or 1.

  • Sigmoid function : Gives a smooth probability between 0 and 1.

σ(z)=11+e−z\sigma(z)=\frac{1}{1+e^{-z}}

where z=w.f(x)z=w.f(x)


<ul><li><p><span><strong>Step function :</strong> Gives a hard decision, 0 or 1.</span></p></li><li><p><span><strong>Sigmoid function :</strong> Gives a smooth probability between 0 and 1.</span></p></li></ul><p><span>$$\sigma(z)=\frac{1}{1+e^{-z}}$$ </span></p><p><span>where $$z=w.f(x)$$ </span></p><p></p>
43
New cards

How does the sigmoid function convert activation into probability?

It converts the activation zz into the probability of class +1.

  • Large positive zz: Probability approaches 1.

  • z=0z=0 : Probability equals 0.5.

  • Large negative zz: Probability approaches 0.

For page 64, w=[−3,4,2]w=[-3,4,2] and x=[1,2,0]x=[1,2,0] :

z=−3+8+0=5z=-3+8+0=5

P(+1∣x)=σ(5)=0.9933P(+1|x)=\sigma(5)=0.9933

So the model predicts 99.33% class +1 and 0.67% class −1.

44
New cards

What is Logistic Regression?

A probabilistic classification model that uses a weighted sum of features and a sigmoid function to predict class probabilities.

Unlike a deterministic perceptron, it provides confidence through probabilities.

<p><span>A <strong>probabilistic classification model</strong> that uses a weighted sum of features and a <strong>sigmoid function</strong> to predict class probabilities.</span></p><p><span>Unlike a deterministic perceptron, it provides <strong>confidence through probabilities</strong>.</span></p>
45
New cards

How does Maximum Likelihood Estimation train Logistic Regression?

It learns weights that maximize the probability of the correct training labels.

w∗=argmax⁡w∏iP(yi∣xi,w)w^*=arg\max\limits_{w} \prod\limits_{i} P(y_i|x_i,w)

Usually, we maximize the log-likelihood instead:

w∗=argmax⁡w∑ilogP(yi∣xi,w)w^*=arg\max\limits_{w} \sum\limits_{i} logP(y_i|x_i,w)

This makes multiplication easier to handle and allows numerical optimization.

<p><span>It learns weights that <strong>maximize the probability of the correct training labels</strong>.</span></p><p><span>$$w^*=arg\max\limits_{w} \prod\limits_{i} P(y_i|x_i,w)$$ </span></p><p><span>Usually, we maximize the <strong>log-likelihood</strong> instead:</span></p><p>$$w^*=arg\max\limits_{w} \sum\limits_{i} logP(y_i|x_i,w)$$ </p><p><span>This makes multiplication easier to handle and allows numerical optimization.</span></p>
46
New cards

Why are probabilistic decisions useful when several decision boundaries are possible?

Different boundaries may classify all training points correctly, but some separate the classes more confidently than others.

Probabilistic models can distinguish between these solutions using the probabilities assigned to correct labels, instead of checking only whether predictions are right or wrong.

<p><span>Different boundaries may classify all training points correctly, but some separate the classes <strong>more confidently</strong> than others.</span></p><p><span>Probabilistic models can distinguish between these solutions using the <strong>probabilities assigned to correct labels</strong>, instead of checking only whether predictions are right or wrong.</span></p>
47
New cards

What is Multiclass Logistic Regression?

An extension of Logistic Regression for more than two classes.

It assigns a weight vector to each class, calculates each class's activation, then converts the activations into probabilities using softmax.

<p><span>An extension of Logistic Regression for <strong>more than two classes</strong>.</span></p><p><span>It assigns a <strong>weight vector to each class</strong>, calculates each class's activation, then converts the activations into probabilities using <strong>softmax</strong>.</span></p>
48
New cards
<p><span><strong>What is the softmax function?</strong></span></p>

What is the softmax function?

Softmax converts several class activations into probabilities that sum to 1.

*form in pict

A class with a higher activation receives a higher probability.

<p><span><strong>Softmax</strong> converts several class activations into probabilities that <strong>sum to 1</strong>.</span></p><p><span>*form in pict</span></p><p><span>A class with a higher activation receives a <strong>higher probability</strong>.</span></p>
49
New cards

How do we calculate multiclass probabilities using softmax?

First calculate the activation for each class, then exponentiate and normalize.

On page 73: z1=5,z2=6,z3=−2z_1=5, z_2=6, z_3=-2

The softmax probabilities are approximately:

  • Class 1: 0.2689

  • Class 2: 0.7310

  • Class 3: 0.0002

Therefore, Class 2 is predicted because it has the highest probability.

50
New cards

How is Multiclass Logistic Regression trained using MLE?

It learns a separate weight vector for each class by maximizing the likelihood of the correct labels.

For each training example, calculate the correct class's softmax probability, take its logarithm, and maximize the total log-likelihood.

The slide's example uses Red, Green, and Blue classes, each with its own weight vector.

51
New cards

What is the relationship between sigmoid and softmax?

Sigmoid is a special case of softmax for binary classification.

If there are two classes, Red and Blue, and we set Blue's weight vector to zero:

P(Red∣x)=ewred.xewred.x+e0P(Red|x)= \frac{e^{w_{red}.x}}{e^{w_{red}.x}+e^0}

This simplifies to:

P(Red∣x)=σ(wred.x)P(Red|x)=\sigma(w_{red}.x)

So sigmoid handles binary probabilities, while softmax generalizes to multiple classes.