MACHINE LEARNING

106403
Back to MACHINE LEARNING

Unit 5: Specialized Learning Theories

  1. Q7a. Explain the EM algorithm. Describe the E-step and M-step with an example of parameter estimation in a mixture model.20257m

    Unit 5: Specialized Learning Theories

    Explain the EM algorithm. Describe the E-step and M-step with an example of parameter estimation in a mixture model.

    View this question on its own page →
    Worked Solution

    EM Algorithm (Expectation-Maximization):

    Iterative method for MLE in presence of latent variables ZZ (e.g., mixture components, missing data). Maximizes log⁡p(X∣θ)=log⁡∑Zp(X,Z∣θ)\log p(X|\theta)=\log\sum_Z p(X,Z|\theta) intractable directly.

    Idea: Iteratively construct lower bound via Jensen, maximize it.

    Steps:
    Given data XX, latent ZZ, parameters θ\theta.

    • E-step (Expectation): Compute posterior q(Z)=p(Z∣X,θ(t))q(Z)=p(Z|X,\theta^{(t)}) and expected complete log-likelihood Q(θ∣θ(t))=EZ∣X,θ(t)[log⁡p(X,Z∣θ)]=∑Zp(Z∣X,θ(t))log⁡p(X,Z∣θ)Q(\theta|\theta^{(t)})=E_{Z|X,\theta^{(t)}}[\log p(X,Z|\theta)] = \sum_Z p(Z|X,\theta^{(t)})\log p(X,Z|\theta)
      Equivalent to computing responsibilities γnk=p(zk=1∣xn,θ(t))\gamma_{nk}=p(z_k=1|x_n,\theta^{(t)}).

    • M-step (Maximization): θ(t+1)=arg⁡max⁡θQ(θ∣θ(t))\theta^{(t+1)}=\arg\max_\theta Q(\theta|\theta^{(t)})

    Iterate until log⁡p(X∣θ(t+1))−log⁡p(X∣θ(t))<ϵ\log p(X|\theta^{(t+1)})-\log p(X|\theta^{(t)})<\epsilon. Guaranteed monotonic increase, converges to local optimum (not necessarily global; restart needed).

    Example — Gaussian Mixture Model (GMM) with KK components:

    Model: p(x)=∑k=1KπkN(x∣μk,Σk)p(x)=\sum_{k=1}^K \pi_k N(x|\mu_k,\Sigma_k), latent znk∈{0,1}z_{nk}\in\{0,1\} indicates component.

    E-step: γnk=πkN(xn∣μk,Σk)∑jπjN(xn∣μj,Σj)\gamma_{nk}= \frac{\pi_k N(x_n|\mu_k,\Sigma_k)}{\sum_j \pi_j N(x_n|\mu_j,\Sigma_j)}

    M-step: Nk=∑nγnkN_k=\sum_n\gamma_{nk}, πknew=Nk/N\pi_k^{new}=N_k/N, μknew=1Nk∑nγnkxn\mu_k^{new}=\frac1{N_k}\sum_n\gamma_{nk}x_n, Σknew=1Nk∑nγnk(xn−μknew)(xn−μknew)T\Sigma_k^{new}=\frac1{N_k}\sum_n\gamma_{nk}(x_n-\mu_k^{new})(x_n-\mu_k^{new})^T

    Example numbers: Data {1,2,10}, K=2K=2 init μ1=1,μ2=10\mu_1=1,\mu_2=10 → E-step assigns 1,2 to component1 (γ≈1\gamma\approx1), 10 to component2 → M-step updates μ1→1.5\mu_1\to1.5, μ2→10\mu_2\to10 → iterates.

    EM also used in HMM (Baum-Welch), k-means is hard-assignment limit of GMM-EM with spherical Σ→0\Sigma\to0.

  2. Q7b. Define the main components of reinforcement learning. Explain the exploration-exploitation tradeoff with an example.20257m

    Unit 5: Specialized Learning Theories

    Define the main components of reinforcement learning. Explain the exploration-exploitation tradeoff with an example.

    View this question on its own page →
    Worked Solution

    Main Components of Reinforcement Learning (RL):

    Agent learns policy interacting with environment via trial-reward.

    1. Agent: Learner/decision maker (robot, game player).
    2. Environment: External system agent interacts with (maze, market).
    3. State s∈Ss \in S: Snapshot of environment (position, sensor readings).
    4. Action a∈A(s)a \in A(s): Moves agent can take (up/down, buy/sell).
    5. Reward rr: Scalar feedback r(s,a,s′)r(s,a,s') after action (positive for goal, negative for penalty).
    6. Policy π(a∣s)\pi(a|s): Agent's strategy mapping states → actions (deterministic or stochastic), goal to learn optimal π∗\pi^*.
    7. Value Function: Vπ(s)=E[∑γtrt∣s0=s]V^\pi(s)=E[\sum \gamma^t r_t | s_0=s], Qπ(s,a)=E[∑γtrt∣s,a]Q^\pi(s,a)=E[\sum\gamma^t r_t | s,a] — expected cumulative discounted return. Optimal V∗,Q∗V^*, Q^* satisfy Bellman equations.
    8. Model (optional): Transition dynamics p(s′∣s,a)p(s'|s,a) and reward model; model-based vs model-free.
    9. Discount γ∈[0,1]\gamma\in[0,1]: Balances immediate vs future reward.

    Loop: s0→πa0→envr0,s1→πa1...s_0 \xrightarrow{\pi} a_0 \xrightarrow{env} r_0,s_1 \xrightarrow{\pi} a_1 ... Goal: maximize G=∑γtrtG=\sum \gamma^t r_t.

    Exploration-Exploitation Trade-off:

    • Exploitation: Use best-known action (max Q(s,a)Q(s,a)) to maximize immediate reward.
    • Exploration: Try random/new actions to discover potentially better long-term rewards.

    Too much exploitation → stuck in suboptimal policy (local optimum). Too much exploration → never converges, low reward.

    Example: Multi-Armed Bandit / Maze.

    • Robot in maze knows one path gives reward 10 (exploitation), but unexplored path may give 100. ϵ\epsilon-greedy: with prob ϵ\epsilon explore random action, else exploit best. Anneal ϵ\epsilon over time. UCB and Thompson Sampling also balance via uncertainty.

    In AlphaGo, exploitation = play best known move from QQ, exploration = try novel moves during self-play to improve.

    Solution: decay ϵ\epsilon from 1 → 0.1, optimistic initialization, intrinsic motivation.

  3. Q9c. Write short note on: Bayesian Networks20257m

    Unit 5: Specialized Learning Theories

    Write short note on: Bayesian Networks

    View this question on its own page →
    Worked Solution

    Bayesian Networks:

    Directed Acyclic Graph (DAG) representation of joint distribution P(X1..Xn)P(X_1..X_n).

    Structure: Nodes = random variables, directed edges = direct dependencies (parent → child conditional). Each node has Conditional Probability Table (CPT): P(Xi∣Parents(Xi))P(X_i|Parents(X_i)) for discrete, or density for continuous.

    Joint factorization: P(X1..Xn)=∏iP(Xi∣Pa(Xi))P(X_1..X_n)=\prod_i P(X_i|Pa(X_i)) (chain rule with d-separation conditional independencies). Example: Rain→Sprinkler→WetGrassRain → Sprinkler → Wet Grass, Rain→WetGrassRain → Wet Grass.

    Inference: Compute P(query∣evidence)P(query|evidence) via enumeration, Variable Elimination, Belief Propagation, Junction Tree (exact exponential), or approximate MCMC/Likelihood Weighting. Bayes rule propagates evidence.

    Learning:

    • Parameter learning: MLE/MAP estimate CPTs from data (P^(xi∣pa)=count(xi,pa)/count(pa)\hat P(x_i|pa)=count(x_i,pa)/count(pa)).
    • Structure learning: Search over DAGs scoring via BIC/MDL, NP-hard.

    Advantages: Compact, interpretable causal model, handles missing data, combines prior knowledge, supports both causal and diagnostic reasoning (e.g., P(Disease∣Symptom)P(Disease|Symptom)).

    Uses: Medical diagnosis (ALARM network), fault detection, speech recognition (HMM is dynamic BN), decision support (Influence Diagrams).

    Example: P(Burglary)=0.001P(Burglary)=0.001, P(Earthquake)=0.002P(Earthquake)=0.002, P(Alarm∣B,E)P(Alarm|B,E) CPT, P(JohnCalls∣Alarm)P(JohnCalls|Alarm) — can query P(B∣A)P(B|A) via Bayes net inference.

    Limitations: DAG cannot have cycles, eliciting CPTs expensive, inference NP-hard for dense nets. For undirected cyclic dependencies use Markov Random Fields.