Skip to contents

The sum of [score_idf()] over `targets`: the total rarity weight of the columns on which the two records disagree. Equivalently (up to a per-ANON record constant, which cannot change that record's ranking) the total rarity weight of the columns on which they agree.

Usage

score_idf_match(
  dat_raw_anon,
  targets,
  row_number = "ROW_NUMBER",
  source = c("anon", "raw", "pooled"),
  weight = c("idf", "inv_log", "inv", "none"),
  generalized = c("stop", "warn", "ignore"),
  .fn_name = "score_idf_match"
)

Arguments

dat_raw_anon

dataframe of raw_anon form

targets

character vector of column names, *before* the RAW_/ANON_ prefixing done by [join_raw_anon_data()]

row_number

name of the row-number column *before* the RAW_/ANON_ prefixing done by [join_raw_anon_data()] (default: "ROW_NUMBER")

source

which side to count: `"anon"` (default), `"raw"` or `"pooled"`. The default is `"anon"` because the released table is available to any attacker – estimating rarity from it needs no knowledge the adversary does not already have, which is what makes this weighting cheap to justify.

weight

rarity weighting scheme; see [idf_weight()]. `"none"` gives plain unweighted exact matching.

generalized

what to do when `target` turns out to hold generalised values on the ANON side: `"stop"` (default), `"warn"` or `"ignore"`.

.fn_name

name used in error messages; a function that wraps this one passes its own name so the message points at the function the user actually called

Value

a "reid_scores" table (a distance: smaller is a better match)

Details

The columns are summed at their own scale, deliberately without the per-column normalisation [score_multi()] applies: the relative size of the weights across values *and* across columns is the method itself, so rescaling each column to a common range would throw away exactly what is being computed. The finished block can then be normalised against other attributes, which is what `score_multi()` does with `"idf"` targets.

See also

[score_containment()] for generalised columns. The guard [score_idf()] carries is applied to every column named in `targets`.

Examples

d <- create_dummy_qi_data(people = 30, seed = 1)
j <- join_raw_anon_data(d, d)
match_greedy(score_idf_match(j, c("ZIP", "SEX")))
#>    ANON_ROW_NUMBER RAW_ROW_NUMBER CONFIDENCE RESULT
#> 1                1              1  0.0000000   TRUE
#> 2                2             12  0.0000000  FALSE
#> 3                3              3  0.0000000   TRUE
#> 4                4             27  0.0000000  FALSE
#> 5                5              9  0.0000000  FALSE
#> 6                6             15  0.0000000  FALSE
#> 7                7             30  0.0000000  FALSE
#> 8                8             14  0.0000000  FALSE
#> 9                9             23  0.0000000  FALSE
#> 10              10             10  0.0000000   TRUE
#> 11              11             11  0.6603312   TRUE
#> 12              12              2  0.0000000  FALSE
#> 13              13             19  0.0000000  FALSE
#> 14              14             20  0.0000000  FALSE
#> 15              15              6  0.0000000  FALSE
#> 16              16             22  0.0000000  FALSE
#> 17              17             25  0.0000000  FALSE
#> 18              18             18  0.0000000   TRUE
#> 19              19             19  0.0000000   TRUE
#> 20              20             20  0.0000000   TRUE
#> 21              21             21  0.0000000   TRUE
#> 22              22             26  0.0000000  FALSE
#> 23              23             23  0.0000000   TRUE
#> 24              24              5  0.0000000  FALSE
#> 25              25             28  0.0000000  FALSE
#> 26              26             19  0.0000000  FALSE
#> 27              27             27  0.0000000   TRUE
#> 28              28             28  0.0000000   TRUE
#> 29              29             29  0.0000000   TRUE
#> 30              30             30  0.0000000   TRUE