WatermarkStatistics
Helpers & Utilities · AiDotNet.Safety.Watermarking
The detection statistics shared by the keyed watermarkers: z-scores, their one-sided p-values, and the mapping from z to the confidence a watermarker reports.
For Beginners
the z-score says how many standard deviations the evidence lies above what chance alone would give. Unmarked content scores around 0, rarely above 3; marked content scores far higher.
How It Works
A keyed detector computes a statistic that is approximately standard normal when the content carries no mark of its key (unmarked content, or content marked with another key) and grows with the evidence when it does:
Confidence maps z linearly from 0 at z = 3 (a one-sided false-positive rate of 0.135%) to 1 at z = 6.
The same mapping is used by the keyed image watermarkers, so a confidence means the same thing in every modality.
Methods
| Method | Summary |
|---|---|
double BonferroniZ(double bestZ, int tests) |
The z-score of the best of tests tests (independent or not) after a Bonferroni correction: the smallest p-value is multiplied by the number of tests, so the false-positive rate of “any test fires” stays at the single-test rate. |
double Confidence(double z) |
The detection confidence for a z-score: 0 up to ZeroConfidenceZ, rising linearly to 1 at FullConfidenceZ. |
double CorrelationZ(double numerator, double sumOfSquaredWeights) |
The correlation z-score sum(w_k * x_k) / sqrt(sum(w_k^2)) from its numerator and the sum of squared weights; 0 when the weights carry no energy. |
double CountZ(int hits, int trials, double gamma) |
The z-score of hits successes in trials trials that each succeed with probability gamma by chance; 0 when there are no trials. |
double UpperTailProbability(double z) |
The one-sided p-value P(Z >= z) of a standard normal Z, accurate to a relative error below 1.2e-7. |
double ZForUpperTail(double p) |
The z-score whose one-sided p-value is p (the inverse of UpperTailProbability), by Acklam’s rational approximation with one Newton refinement step. |
Fields
| Field | Summary |
|---|---|
double FullConfidenceZ |
The z-score from which the confidence is 1. |
double ZeroConfidenceZ |
The z-score at and below which the confidence is 0. |