classnotes RTX 4070 Ti SUPER · faster-whisper · DeepSeek

6103 - Advanced ML

← 6103 - Advanced ML

Advance Machine Learning-20260926_092631-Meeting Recording

Date 2026-09-26 Length 1h 25m Words 12,593 Segments 733
⤓ Download transcript (.txt with timestamps) ⤓ Plain transcript (.txt) ⤓ Transcript (.md)

Summary


session: "6103-advanced-ml/2026-09-26 0926 Advance Machine Learning"

title: "Advance Machine Learning"

date: "2026-09-26 09:26"

duration: "1h 24m"

language: "en"

model: "deepseek-ai/DeepSeek-V3.2"

parts: 3

transcript_chars: 62893

generated: "2026-11-23T01:56:55+05:30"


Advanced Machine Learning

Overview

This class introduced logistic regression for binary classification, distinguishing it from linear regression. It covered the mathematical formulation using the sigmoid function, explained logistic regression as a probabilistic model, and detailed the training process via gradient descent to minimize binary cross-entropy loss. The session connected theoretical concepts to practical implementation, including a from-scratch Python example and a comparison with scikit-learn's library for a customer churn prediction problem. This builds foundational knowledge for classification algorithms preceding deep learning modules.

Learning outcomes

Core concepts

Regression vs. Classification

Regression predicts a continuous dependent variable, while classification predicts a discrete label. This distinction determines the choice of algorithm (e.g., linear regression vs. logistic regression).

Logistic Regression

A classification algorithm used to predict a binary outcome. It uses a linear combination of inputs passed through a sigmoid function to output a probability between 0 and 1.

Sigmoid/Logistic Function

A mathematical function that maps any real-valued input to an S-shaped curve between 0 and 1. It is the core mechanism in logistic regression for generating probabilities.

Probabilistic Model

Logistic regression outputs the probability of an instance belonging to a class. A threshold (typically 0.5) is then applied to make a final class prediction.

Gradient Descent

An iterative optimization algorithm used to minimize the loss function (binary cross-entropy) by updating model weights in the direction opposite to the gradient of the loss.

Binary Cross-Entropy Loss

The loss function used specifically for binary classification in logistic regression. It measures the difference between the predicted probability distribution and the actual labels.

Learning Rate

A hyperparameter in gradient descent that controls the step size of each weight update. A critical value that must be tuned—too high risks divergence, too low slows convergence.

Threshold

A cutoff value (e.g., 0.5) applied to the sigmoid output probability to decide the final class prediction (0 or 1).

Formulas and maths

\( \text{sigmoid}(z) = \frac{1}{1 + e^{-z}} \)

Symbols: \( z \) is the linear input \( \beta_0 + \beta_1 x \) or \( \theta^T x \).

Use: Converts any real number to a probability between 0 and 1 in logistic regression.

\( \frac{L}{1 + e^{-k(x - x_0)}} \)

Symbols: \( L \) is the curve's maximum value, \( k \) is stiffness (slope), \( x_0 \) is the midpoint.

Use: General form; in standard logistic regression, \( L=1 \) and the midpoint is set for 0.5 probability.

\( z = \theta^T x \)

Symbols: \( \theta \) is the weight vector, \( x \) is the feature vector, \( T \) denotes transpose.

Use: Computes the weighted sum of inputs before applying the sigmoid function.

\( L = -\frac{1}{m} \sum_{i=1}^{m} [y^{(i)} \log(h^{(i)}) + (1-y^{(i)}) \log(1-h^{(i)})] \)

Symbols: \( m \) is number of samples, \( y \) is actual label (0 or 1), \( h \) is predicted probability from sigmoid.

Use: The loss function minimized during training of logistic regression.

\( \theta_{\text{new}} = \theta_{\text{old}} - \alpha \frac{dL}{d\theta} \)

Symbols: \( \alpha \) is the learning rate, \( \frac{dL}{d\theta} \) is the gradient of the loss with respect to the weights.

Use: Iteratively updates weights to reduce loss.

\( \theta_{\text{new}} = \theta_{\text{old}} + \alpha \frac{dL}{d\theta} \)

Symbols: Same as above.

Use: An alternative update rule; choice between descent and ascent depends on error behavior.

\( \text{error} = y_{\text{actual}} - y_{\text{predicted}} \)

Symbols: \( y_{\text{actual}} \) is true label, \( y_{\text{predicted}} \) is sigmoid output probability.

Use: Computes the immediate difference for a single prediction.

Worked examples

1. Probability Complement: If predicted probability for class A is 0.78, then probability for the other class is \( 1 - 0.78 = 0.22 \).

2. Threshold Application: With threshold = 0.5, a sigmoid output of 0.7 (>0.5) predicts class A (e.g., cat); an output of 0.3 (<0.5) predicts class B (e.g., dog).

3. From-Scratch Implementation Steps:

4. Churn Prediction Dataset:

Questions asked in class

A: No, the sigmoid function is for binary classification only. Multi-class problems require other methods.

A: Logistic regression is probabilistic and finds only one class probability at a time; the other is simply \(1-p\). Setting multiple thresholds isn't feasible.

A: It uses a regression line (\( \beta_0 + \beta_1 x \)) but fits it between 0 and 1 via the sigmoid, hence the name.

A: No, linear regression outputs any real value (e.g., 500, -200), not suitable for 0/1 class labels.

A: It updates weights to reduce error by following the derivative of the loss.

A: Too high: may overshoot and never converge. Too low: takes too long to converge.

A: Binary cross-entropy is standard, combining \( y \log(h) \) for the positive class and \( (1-y) \log(1-h) \) for the negative class.

A: No, Maximum Likelihood Estimation is an alternative, but gradient descent is common and extends to deep learning.

A: It decides the step size/momentum for moving towards the error minimum.

A: When matrix dimensions are incompatible for dot product (e.g., converting 3x1 to 1x3).

A: Descent uses minus sign (θ - α gradient), ascent uses plus sign (θ + α gradient). Choice depends on error behavior.

Key takeaways

Exam-style questions

1. Explain why linear regression is unsuitable for a binary classification task like spam detection, and how logistic regression addresses this limitation.

Outline: Linear regression outputs unbounded continuous values, not probabilities. Logistic regression uses the sigmoid function to map linear outputs to probabilities between 0 and 1, enabling class prediction via a threshold.

2. Given a logistic regression model with weights θ = [0.5, -1.2] and an input x = [1, 3], calculate the predicted probability. Assume an intercept is included in the weight vector.

Outline: Compute z = θ^T x = (0.5*1) + (-1.2*3) = 0.5 - 3.6 = -3.1. Apply sigmoid: p = 1 / (1 + e^(-(-3.1))) = 1 / (1 + e^3.1). Calculate numerical value.

3. Describe the role of the learning rate in gradient descent. What are the consequences of setting it too high or too low?

Outline: Learning rate (α) controls step size. Too high causes overshooting and potential divergence; too low leads to extremely slow convergence and increased training time.

4. For a binary classification problem, the sigmoid output for an instance is 0.85. Using a threshold of 0.5, what is the predicted class? What is the implied probability for the other class?

Outline: Since 0.85 > 0.5, predict class 1. Probability for the other class (class 0) is 1 - 0.85 = 0.15.

5. You are implementing logistic regression from scratch. Outline the steps in one training iteration, from computing the prediction to updating the weights.

Outline: (1) Compute z = θ^T x. (2) Apply sigmoid to get prediction h. (3) Calculate error = y - h. (4) Compute gradient of loss dL/dθ. (5) Update weights: θ = θ - α * (dL/dθ).

Glossary

Follow-ups

Transcript

One line per segment, [hh:mm:ss] timestamp first.

loading…