Skip to content

Linkers

Model methodologies that link two RecordSteps.

matchlab.models.linkers.base

Base class for linkers.

Classes:

  • Linker

    A methodology that finds candidate matches between two record steps.

Linker

Bases: BaseModel, ABC


              flowchart TD
              matchlab.models.linkers.base.Linker[Linker]

              

              click matchlab.models.linkers.base.Linker href "" "matchlab.models.linkers.base.Linker"
            

A methodology that finds candidate matches between two record steps.

A Model step calls prepare() once, then link(), each time it collects. Put one-off setup in prepare() instead, for example fitting a model over both datasets, so it doesn't repeat on every call to link(). link() must return a table with left_id, right_id, and score columns. normalise_model_scores casts that table to SCHEMA_MODEL_EDGES.

Every field is a setting unless marked matchlab.resources.FromResources. A fingerprint ignores a resource, so a marked field must not change what this scores.

Methods:

  • prepare

    Run once before link(), for setup that shouldn't repeat per call.

  • link

    Score candidate matches between left and right.

Attributes:

model_config class-attribute instance-attribute

model_config = ConfigDict(extra='forbid', frozen=True)

version class-attribute

version: int | None = None

left_id class-attribute instance-attribute

left_id: Literal['id'] = Field(default='id', description='The unique ID field in the left data')

right_id class-attribute instance-attribute

right_id: Literal['id'] = Field(default='id', description='The unique ID field in the right data')

prepare abstractmethod

prepare(left: DataFrame, right: DataFrame) -> None

Run once before link(), for setup that shouldn't repeat per call.

link(left: DataFrame, right: DataFrame) -> DataFrame

Score candidate matches between left and right.