Homework 5: Detection and learning a probability

EE 520: Random Processes (Fall 2026). Due: November 20, 2026, 11:59 PM PT. Instructor: John Lipor.

Instructions

Submit your work as a PDF through the course submission system. If you need an accommodation or an alternate format, contact the instructor.

Note: For all questions asked in this course, unless the question is simply asking about definitions, please justify all answers. Stating the correct answer without justification will earn no credit. For example, if you write down a string of equations, each successive equation should be accompanied by some justification such as “by the additivity axiom” or “because the outcomes are equally likely” or “by the distributive property of set operations.” You do not need to justify algebra.

Problem 1: Counting photons [5 pts each]

A lidar receiver counts photons in a gate. With no target present, the count is Y∼Poisson(λ0=2)Y \sim \text{Poisson}(\lambda_0 = 2) (dark counts plus background). With a target present, Y∼Poisson(λ1=10)Y \sim \text{Poisson}(\lambda_1 = 10).

  1. Write the likelihood ratio L(y)L(y) and show it is monotone increasing in yy. Conclude that both the ML and the MAP rules are threshold rules: decide “target” if and only if y≥γy \geq \gamma.

  2. Find the ML threshold explicitly. With prior ℙ(target)=0.1\mathbb{P}(\text{target}) = 0.1, find the MAP threshold. Which direction did the prior move it, and why does that make sense?

  3. Compute ℙ(false alarm)\mathbb{P}(\text{false alarm}) and ℙ(miss)\mathbb{P}(\text{miss}) for the MAP rule (finite sums; give numbers).

  4. The gate is lengthened so that both means double (λ0=4\lambda_0 = 4, λ1=20\lambda_1 = 20). Recompute the error probabilities. In one sentence: what did the extra integration time buy, in the language of separating the likelihoods?

  5. Instead of one long gate, the receiver records two back-to-back gates of the original length. Their counts Y1,Y2Y_1, Y_2 are independent given the hypothesis, each Poisson(2)\text{Poisson}(2) with no target and Poisson(10)\text{Poisson}(10) with one. Show that the MAP rule (prior 0.10.1) depends on (y1,y2)(y_1, y_2) only through the total y1+y2y_1 + y_2, and that it is the rule you found in part (d). Then prove that, under either hypothesis, Y1+Y2Y_1 + Y_2 is Poisson with twice the mean (sum the joint PMF over the line y1+y2=ky_1 + y_2 = k and use the binomial theorem), so the two receivers make exactly the same errors. In one sentence: where does the evidence in a photon count live?

Problem 2: Set up the test [5 pts]

A hydrophone either records ambient noise or noise plus a known weak tone. Without computing anything, define the latent variable, the observation, the two likelihoods (state your modeling assumptions and what would justify them), the prior, and the decision rule you would use. Three of these five choices are modeling decisions, not mathematics. Identify which three.

Problem 3: Learning a click rate [5 pts each]

A relay link succeeds on each transmission independently with unknown probability θ\theta: given θ\theta, the outcomes X1,X2,…X_1, X_2, \dots (with Xi=1X_i = 1 for a success) are independent Bernoulli(θ)\text{Bernoulli}(\theta). Adopt the prior θ∼Beta(a,b)\theta \sim \text{Beta}(a, b). By Session 11’s conjugacy result, after ss successes in nn transmissions the posterior is Beta(a+s,b+n−s)\text{Beta}(a + s,\ b + n - s); use it freely.

  1. Show that the probability that the next transmission succeeds is the posterior mean: ℙ(Xn+1=1|data)=𝔼[θ|data]=a+sa+b+n.\mathbb{P}(X_{n+1} = 1 \,|\,\text{data}) = \mathbb{E}[\theta \,|\,\text{data}] = \frac{a + s}{a + b + n}. Condition on θ\theta, and say exactly where the independence assumption enters. Then take the flat prior Beta(1,1)\text{Beta}(1, 1) and a link that has succeeded on all 1010 of its first 1010 transmissions: what probability do you quote for the eleventh, and why is it not 11?

  2. Before any data are seen, show that Cov(X1,X2)=Var(θ)\mathrm{Cov}(X_1, X_2) = \mathrm{Var}(\theta), so two transmissions are positively correlated even though they are independent given θ\theta. Under Beta(1,1)\text{Beta}(1, 1), compare ℙ(X2=1|X1=1)\mathbb{P}(X_2 = 1 \,|\,X_1 = 1) with ℙ(X2=1)\mathbb{P}(X_2 = 1). In one sentence each: why must the transmissions be dependent for learning to be possible at all, and what kind of prior would make them independent?

  3. With prior Beta(1,1)\text{Beta}(1, 1) and observations (n=10,s=7)(n = 10,\ s = 7), compute ℙ(θ>0.5∣data)\mathbb{P}(\theta > 0.5 \mid \text{data}) numerically (one line of scipy). Would you make a one-sentence recommendation to deploy the relay?

Problem 4: Thompson sampling [20 pts]

Two relay links have unknown success rates θ1=0.6\theta_1 = 0.6 and θ2=0.65\theta_2 = 0.65 (unknown to the algorithm). At each of 20002000 rounds you must pick one link. Implement and compare three strategies:

  1. greedy on the empirical means (after 1010 forced pulls of each arm);

  2. ε\varepsilon-greedy with ε=0.1\varepsilon = 0.1;

  3. Thompson sampling with Beta(1,1)\text{Beta}(1,1) priors on each arm.

Before running: predict which strategy suffers most from “premature commitment,” and why. Then put a number on it for greedy:

Turn in: cumulative regret curves (averaged over 200200 runs), your predictions versus the outcome, and your code. For greedy, also report the fraction of runs that spend most of the last 500500 rounds on the worse link: overall, among the runs in which the worse link led after the forced pulls, and among the rest. In two sentences: how can a run escape the first-order story, and how can a run be trapped against it? In one sentence: where exactly in your Thompson-sampling code does “posterior →\rightarrow action” happen?

Problem 5: Callback [5 pts]

(Callback to Homework 3, Problem 5.) In the buy-a-measurement problem of Homework 3, replace the binary sensor with the photon counter of Problem 1 (priors and utilities unchanged; measurement cost 33). Is the photon counter worth buying? (You may sum the relevant Poisson terms numerically.)

Problem 6: Audit the TA-bot [5 pts]

The assistant was asked: “An optical link’s gate count is Poisson(1)\text{Poisson}(1) with no pulse present and Poisson(6)\text{Poisson}(6) with a pulse; the prior probability of a pulse is 0.250.25. Find the MAP detection rule and its false-alarm probability.” It answered:

This solution contains zero, one, or two errors.

  1. Identify the first line that goes wrong, or certify the solution correct.

  2. Name the violated result or modeling rule in one sentence, citing the session. (Apply to each error you find.)

  3. Fix it: give the corrected detection rule and false-alarm probability, and state the Session-10 sanity check that flags each wrong line before any recomputation. (Apply to each error you find.)

  4. One sentence: why is this a mistake a language model plausibly makes?

Flagging a correct step as an error costs credit; certifying correctness is part of the skill.