🔹 Classification Overview

Definition: Classification is a Supervised Learning technique used to predict the categorical label of new observations based on a training dataset.

Examples of classification tasks:

Rule: The model learns from labeled training data and assigns unseen data to one of the predefined classes.

# Example: Simple Binary Classification Labeling
label = 1 if observation == "Spam" else 0

🔹 Logistic Regression

📌 Logistic Function (Sigmoid)

Definition: The sigmoid function maps any real number to a value between 0 and 1.

Formula:

\$\$ \sigma(z) = \frac{1}{1 + e^{-z}} \$\$

Rule: Converts linear values to probabilities between 0 and 1.

import numpy as np

def sigmoid(z):
    return 1 / (1 + np.exp(-z))
print(sigmoid(0))  # Output: 0.5

📌 Logistic Regression Algorithm

Definition: A supervised ML algorithm for binary classification. It predicts the probability of a sample belonging to class 1.