Skip to content

InferMap

Ben Severn edited this page May 1, 2026 · 1 revision

InferMap

Schema mapping engine. Auto-aligns columns from heterogeneous source schemas to a canonical target schema using a weighted scorer pipeline + optimal 1:1 assignment via the Hungarian algorithm.

Source: packages/python/infermap · PyPI: infermap · npm: infermap

Install

pip install infermap
infermap map --source partner_export.csv --schema canonical.yaml

What it does

InferMap solves the column-alignment half of integration: when partner A calls a column fname and your canonical schema says first_name, InferMap figures out the mapping (with calibrated confidence scores). Below a confidence threshold the mapping is rejected — never a silent guess.

Component Purpose
ExactScorer Exact name match
AliasScorer Curated alias dictionary (fnamefirst_name, etc.) — extensible via config
PatternTypeScorer Regex-classified semantic types (email, phone, date, ZIP, …)
ProfileScorer Statistical profile similarity (cardinality, dtype, null rate, range)
FuzzyNameScorer Jaro-Winkler / Levenshtein on column names
Score combiner Weighted average; None = abstain, 0.0 = real negative; min 2 contributors
Assignment scipy.optimize.linear_sum_assignment — Hungarian, optimal 1:1

Programmatic API

import infermap
import polars as pl

source = pl.read_csv("partner_export.csv", encoding="utf8-lossy")
result = infermap.map(
    source=source.head(500).to_dicts(),
    schema_file="canonical.yaml",
)

for m in result.mappings:
    print(f"{m.source}{m.target}  conf={m.confidence:.2f}  reasons={m.reasoning}")

# Apply: rename source columns to canonical
mapping = {m.source: m.target for m in result.mappings if m.confidence >= 0.7}
canonical = source.select(list(mapping.keys())).rename(mapping)

infermap.from_config() lets you tune scorer weights and extend the alias dictionary via YAML.

Suite role

InferMap sits at the front of the suite for any pipeline that ingests heterogeneous sources. Use cases:

CLI

infermap map -s source.csv -t target.csv          # source-to-source
infermap map -s source.csv --schema canon.yaml    # against a canonical schema
infermap apply -s source.csv -m mapping.json      # apply a saved mapping
infermap inspect mapping.json                     # explain the mapping reasoning
infermap validate -s source.csv --schema canon.yaml --min-confidence 0.7
infermap mcp-serve --transport http --port 8400

MCP

ghcr.io/benzsevern/infermap-mcp:latest. Tools: map, apply, inspect, validate, plus resource endpoints listing supported domains and the alias dictionary. Surfaced under the goldensuite-mcp aggregator.

TypeScript port

Full feature parity, 182 tests, Hungarian assignment, parity harness vs the Python implementation locked at 4-decimal tolerance.

See also

GoldenMatch

PyPI npm

🟡 Golden Suite (Monorepo)

Suite Packages

Getting Started

Core Concepts

AI Integration

Advanced

Reference


pip install goldenmatch
npm install goldenmatch

Clone this wiki locally