Fit a baseline classifier to predict whether each scored pair is a
true match (equal == 1L) or a false positive (equal == 0L).
The baseline path uses stats::glm with the logit link and no
external dependencies. The features object is the input from
match_features(); labels carry the equal column produced by
import_labels().
Arguments
- features
A
Match_Featuresobject.- labels
A
data.table/data.framewith the matches schema plus an integerequalcolumn (0L/1L). Typically produced byimport_labels().- model
Character scalar (default
"logistic") selecting the baselineglm()path. Future M6 work will accept a fitted parsnip / workflow object here.- class_weighted
Logical scalar. When
TRUE, fitglmwith inverse-class-frequencyweights =, useful for imbalanced training sets. DefaultFALSE.- na_fill
Numeric scalar used to impute predictor NAs. Default
0(sensible for aIP slot columns where NA means "no token").- ...
Reserved for future expansion.
Examples
strat <- search_strategy(
workshop ~ normalize_text() + word_tokens(min_nchar = 3),
proprietor ~ normalize_text() + word_tokens(min_nchar = 2),
block_by = c("postcode_area", "trade"),
threshold = 0.30
)
matches <- search_candidates(
workshop_listings, workshop_register,
base_id = "listing_id", target_id = "reg_no", strategy = strat
)
feats <- match_features(matches, strat,
base = workshop_listings, id = "listing_id",
target = workshop_register, target_id = "reg_no")
# match_labels_example carries the same pairs with a hand-checked `equal` flag.
model <- fit_filter(feats, match_labels_example)
model
#> <joinery::Filter_Model>
#> backend : glm
#> model_class : glm
#> predictors (42) : score, cnt, icnt, ipos, scnt, rcnt, r1, r2
#> ... +34 more
#> training_n : 442
#> class_balance : 0.756 (share of equal == 1L)
#> class_weighted : FALSE
