S14 Machine learning · Practice
Anomaly detection
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
0 solved
0 in a row
0 of 8 kinds solid
Check
A Gaussian variable is flagged when it's more than 3 standard deviations from its mean. What percentage of normal readings are flagged?
Check
A detector with recall 0.9 and false-alarm rate 0.002 watches events where a fraction 0.01 are anomalous. What percentage of its alarms are real?
Check
For two-dimensional Gaussian data, what threshold on the squared Mahalanobis distance gives a 1% false-alarm rate?
Check
Two standardized variables with correlation 0.8 take the values 1.5 and −1.
(a)
What is the squared Mahalanobis distance?
(b)
What percentage of normal points lie at least that far out?
Check
A system monitors 100 independent variables, each with a false-alarm rate of 0.001 per check. What percentage of checks raise at least one false alarm?
Check
Build a Gaussian anomaly detector. Generate 5000 normal training points and 5000 normal test points from a 2D Gaussian with unit variances and correlation rho = 0.5, then 500 anomalies: fresh normal points plus the vector [shift/2, -shift/2], with shift = 2. Use rng = numpy.random.default_rng(seed) and rng.multivariate_normal in that order (train, test, anomalies). Fit the mean and covariance on the training set, flag points with squared Mahalanobis distance above , and set far (false-alarm rate on the normal test set) and tpr (detection rate on the anomalies).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
What precision does a detector with recall 0.95 and false-alarm rate 0.002 reach at prevalence 0.05?
Check
What threshold gives a 1% false-alarm rate in two dimensions?
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in S14