ГоловнаШІ та Машинне навчанняДетектор шахрайських кліків у рекламі — закон Бенфорда наживо

🖱️ Детектор шахрайських кліків у рекламі — закон Бенфорда наживо

Спостерігайте, як справжній статистичний тест за законом Бенфорда порівнює наживо частоти перших цифр у симульованих кількостях кліків реклами з дійсним очікуваним логарифмічним розподілом, щоб виявляти шахрайські джерела трафіку.

ШІ та Машинне навчання3DПомірно60 FPS
ai-ad-click-fraud-detection ↗ Відкрити окремо

About the Benford's Law Ad Click Fraud Detector

This simulation runs a genuine Benford's Law digit-analysis pipeline over several simulated ad-traffic sources. Each source generates a stream of click-count values across many campaigns or reporting periods; the leading (first) digit of every value is extracted and tabulated into an observed frequency histogram, which is then compared against the real Benford expected distribution P(d) = log₁₀(1 + 1/d) using a live chi-squared goodness-of-fit statistic. Nothing about the fit statistic is hardcoded — it is recomputed from the actual generated data set every time you resample or toggle a source.

🔬 What it shows

Nine 3D bars per traffic source, one for each possible leading digit 1–9: a solid bar shows the source's observed frequency, a translucent wireframe bar behind it shows the expected Benford frequency. "Genuine" sources are generated by a log-uniform multiplicative process spanning several orders of magnitude — the classic condition under which real click counts obey Benford's Law. "Fraud" sources instead draw counts uniformly from a narrow numeric band, which provably fails to reproduce a logarithmic leading-digit distribution.

🎮 How to use

Toggle any source between Genuine and Fraud with the buttons in the left panel, adjust the sample size (periods per source) with the slider, and hit Resample to draw a fresh batch of click data. Drag to orbit the 3D scene, scroll to zoom, and click any bar or source card to inspect its exact χ² statistic, approximate p-value, and mean absolute deviation (MAD) in the detail panel. The ranking list re-sorts live by fraud-likelihood score (χ²) as the data changes.

💡 Did you know?

Benford's Law was first noted by astronomer Simon Newcomb in 1881, who observed that the front pages of logarithm tables were far more worn than the back pages — meaning people looked up numbers starting with 1 much more often than numbers starting with 9. It's now a standard forensic-accounting and fraud-detection tool, used to screen tax filings, election vote counts, scientific data and — as demonstrated here — digital ad-traffic reports for signs of fabrication.

Frequently asked questions

What is Benford's Law and why does it apply to ad-click data?

Benford's Law states that for many naturally occurring, multi-scale numerical datasets, the first (leading) digit d is not uniformly distributed across 1–9 but instead follows P(d) = log₁₀(1 + 1/d) — so about 30.1% of values start with 1, 17.6% with 2, down to only 4.6% starting with 9. It emerges whenever the underlying quantity spans several orders of magnitude and its logarithm is roughly uniformly distributed, which is exactly what happens with organic ad-click counts aggregated across campaigns of wildly different sizes, budgets and reach. Fabricated data — generated by picking numbers in a narrow range to look plausible — does not have this multi-scale structure, so it fails to reproduce the log-uniform property and its leading digits deviate from Benford's expected curve.

How does the chi-squared goodness-of-fit test work here?

For each traffic source we tabulate how many of its N click-count values have each leading digit 1 through 9, giving observed counts O(d). We compute the expected count under Benford's Law as E(d) = N × log₁₀(1 + 1/d). The chi-squared statistic is χ² = Σ (O(d) − E(d))² / E(d), computed live from the actual simulated data on every regeneration — nothing is hardcoded. With 9 digit categories there are 8 degrees of freedom, and the standard critical value for a 5% significance level is 15.507; sources whose chi-squared statistic exceeds that threshold are flagged as statistically inconsistent with genuine, naturally-scaled traffic.

What generates the "genuine" versus "fraudulent" traffic in the simulation?

Genuine sources draw click counts from a log-uniform multiplicative process: the base scale is 10 raised to a uniformly random exponent between 1 and about 5.2 (so magnitudes range from tens to hundreds of thousands), multiplied by lognormal noise representing day-to-day campaign variation. Because the exponent is uniform, the resulting leading digits closely follow Benford's Law, mirroring how real aggregated web traffic behaves. Fraudulent sources instead draw counts uniformly from a narrow numeric band, such as 500 to 900 clicks — a pattern typical of click farms or bots trying to look like a steady, plausible volume, which mathematically cannot reproduce a logarithmic leading-digit distribution.

What does the mean absolute deviation (MAD) add beyond chi-squared?

Chi-squared is sensitive to sample size N — with enough data, even tiny, practically unimportant deviations become statistically significant. The mean absolute deviation, MAD = (1/9) × Σ |observed fraction(d) − P(d)|, measures the average size of the deviation itself, independent of N. Digit-analysis practitioners (following Nigrini's forensic-accounting conventions) treat MAD below about 0.006 as close conformity, 0.006–0.012 as acceptable, 0.012–0.015 as marginal, and above 0.015 as nonconformity. Reporting both statistics together — chi-squared for statistical significance and MAD for effect size — gives a more complete picture than either alone.

Can Benford's Law analysis alone prove that a traffic source is fraudulent?

No — Benford's Law is a screening heuristic, not proof. Some genuine datasets fail to conform because they are constrained to a narrow range for legitimate reasons (for example, a small fixed-budget campaign that always buys close to the same number of clicks), and some fabricated data can be built to mimic a logarithmic distribution deliberately. In real ad-fraud detection, a significant chi-squared result on click counts is one signal among many — alongside click-timing patterns, device fingerprints, IP reputation and conversion-rate anomalies — that analysts use to prioritise which traffic sources deserve deeper investigation.

Why do the observed digit-frequency bars keep moving even without changing settings?

The observed bars animate smoothly toward their new target height any time the underlying data changes — for example when you toggle a source between genuine and fraudulent, change the sample size, or click Resample. This is purely a visual easing effect for readability; the chi-squared statistic and p-value shown in the side panel are always computed directly from the final, settled data, not from the in-between animated frame.

⚙ Під капотом

Дев'ятизначні гістограми перших цифр складаються наживо для кожного джерела та порівнюються з P(d) = log₁₀(1 + 1/d) за допомогою справжньої статистики хі-квадрат критерію узгодженості й середнього абсолютного відхилення, що перераховуються при кожній повторній вибірці.

Закон БенфордаХі-квадрат тестВиявлення шахрайстваСтатистикаАналіз цифр

3D · рушій Three.js / WebGL · ціль 60 FPS · працює повністю на клієнті, без встановлення

Що ви знайшли?

Додати кроки відтворення (необов'язково)