Skip to content

Components

matchlab.resolvers.components

Connected-components resolver methodology.

Classes:

  • Components

    Resolver methodology that computes connected components.

Components

Bases: ResolverMethod


              flowchart TD
              matchlab.resolvers.components.Components[Components]
              matchlab.resolvers.base.ResolverMethod[ResolverMethod]

                              matchlab.resolvers.base.ResolverMethod --> matchlab.resolvers.components.Components
                


              click matchlab.resolvers.components.Components href "" "matchlab.resolvers.components.Components"
              click matchlab.resolvers.base.ResolverMethod href "" "matchlab.resolvers.base.ResolverMethod"
            

Resolver methodology that computes connected components.

A threshold defaults to 0.0 if not set.

Methods:

Attributes:

version class-attribute

version: int = 1

resolver_type class-attribute

resolver_type: ResolverType = COMPONENTS

thresholds class-attribute instance-attribute

thresholds: dict[int, Annotated[float, Field(ge=0.0, le=1.0)]] = Field(default_factory=dict, description="Minimum score for an edge to count, per input, keyed by the input's position. Write these as `{model: 0.9}`. `Resolver` takes the model object and works out the position.")

model_config class-attribute instance-attribute

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

compute_clusters

compute_clusters(model_edges: Mapping[int, DataFrame]) -> DataFrame

Compute cluster assignments from model edges.

Parameters:

  • model_edges
    (Mapping[int, DataFrame]) –

    Input position to that model's edges, conforming to SCHEMA_MODEL_EDGES. Positions index the resolver's inputs, in the order they were given, and are what per-model settings key by.

Returns:

  • DataFrame

    A Polars DataFrame which conforms to SCHEMA_CLUSTERS