# akash-bardia/amazon-ml-challenge-2026 architecture

> Architecture diagram of the GitHub repository akash-bardia/amazon-ml-challenge-2026, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akash-bardia/amazon-ml-challenge-2026
- Repository: https://github.com/akash-bardia/amazon-ml-challenge-2026

## Overview

This repository implements a multi-source business entity resolution pipeline: it normalizes vendor records, generates likely cross-source pairs, scores them, applies calibrated thresholds and target exclusivity, and writes matching and candidate TSVs. A separate training workflow builds hard-negative examples, fits a matcher, and evaluates it. The graph includes the major README stages; some subsystem links are based on documented capabilities because their source was not sampled.

Main entry points: [`code/business_entity_resolution/src/inference.py`](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/inference.py) (Country-wise inference), [`train.py`](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/train.py) (Training workflow), [`code/business_entity_resolution/src/main.py`](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/main.py) (Inference entry point), [`code/business_entity_resolution/src/normalization.py`](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/normalization.py) (Record normalization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Matching runtime"]
  node_runner["Inference entry point<br/>[main.py]"]
  node_inference["Country-wise inference<br/>[inference.py]"]
end

subgraph group_scoring["Resolution logic"]
  node_normalization["Record normalization<br/>[normalization.py]"]
  node_blocking["Candidate blocking<br/>[blocking.py]"]
  node_features["Pair features<br/>[features.py]"]
  node_matcher["Matcher model<br/>[model.py]"]
  node_thresholds["Threshold and dedup<br/>[thresholding.py]"]
  node_metrics["Evaluation metrics<br/>[evaluation.py]"]
end

subgraph group_training["Model training"]
  node_trainer["Training workflow<br/>[train.py]"]
  node_data_loading["TSV and truth loading<br/>[data_loader.py]"]
end

subgraph group_artifacts["Models and results"]
  node_model_file["Trained matcher"]
  node_metadata["Threshold metadata"]
  node_results["Match and candidate TSVs<br/>[inference.py]"]
  node_validator["Submission validator"]
  node_output_helper["Output utilities<br/>[output.py]"]
end

node_operator(("Pipeline operator"))
node_input["Vendor TSV inputs"]

node_operator -->|"runs"| node_runner
node_input -->|"reads records"| node_inference
node_runner -->|"runs inference"| node_inference
node_inference -->|"normalizes records"| node_normalization
node_inference -->|"generates candidates"| node_blocking
node_inference -->|"extracts pair features"| node_features
node_inference -->|"scores pairs"| node_matcher
node_inference -->|"filters and deduplicates"| node_thresholds
node_inference -.->|"loads model"| node_model_file
node_inference -->|"loads thresholds"| node_metadata
node_inference -->|"writes TSVs"| node_results
node_runner -->|"runs validation"| node_validator
node_normalization -->|"provides normalized values"| node_blocking
node_normalization -->|"provides normalized values"| node_features
node_trainer -->|"mines candidates"| node_blocking
node_trainer -->|"builds training features"| node_features
node_trainer -->|"fits model"| node_matcher
node_trainer -->|"evaluates predictions"| node_metrics
node_trainer -->|"optimizes thresholds"| node_thresholds
node_trainer -.->|"saves model"| node_model_file
node_trainer -.->|"saves metadata"| node_metadata
node_thresholds -->|"evaluates thresholds"| node_metrics
node_data_loading -.->|"loads TSV data"| node_input

click node_runner "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/main.py"
click node_inference "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/inference.py"
click node_normalization "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/normalization.py"
click node_blocking "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/blocking.py"
click node_features "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/features.py"
click node_matcher "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/model.py"
click node_thresholds "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/thresholding.py"
click node_metrics "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/evaluation.py"
click node_trainer "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/train.py"
click node_data_loading "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/data_loader.py"
click node_model_file "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/models/final_entity_matcher.joblib"
click node_metadata "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/models/model_metadata.json"
click node_results "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/inference.py"
click node_validator "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/utils/validate_submission.py"
click node_output_helper "https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/output.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_runner,node_inference toneBlue
class node_normalization,node_blocking,node_features,node_matcher,node_thresholds,node_metrics toneAmber
class node_trainer,node_data_loading toneMint
class node_model_file,node_metadata,node_results,node_validator,node_output_helper toneRose
class node_operator,node_input toneIndigo
```

## Components

### Matching runtime

- [Inference entry point](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/main.py): `code/business_entity_resolution/src/main.py`
- [Country-wise inference](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/inference.py): `code/business_entity_resolution/src/inference.py`

### Resolution logic

- [Record normalization](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/normalization.py): `code/business_entity_resolution/src/normalization.py`
- [Candidate blocking](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/blocking.py): `code/business_entity_resolution/src/blocking.py`
- [Pair features](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/features.py): `code/business_entity_resolution/src/features.py`
- [Matcher model](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/model.py): `code/business_entity_resolution/src/model.py`
- [Threshold and dedup](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/thresholding.py): `code/business_entity_resolution/src/thresholding.py`
- [Evaluation metrics](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/evaluation.py): `code/business_entity_resolution/src/evaluation.py`

### Model training

- [Training workflow](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/train.py): `train.py`
- [TSV and truth loading](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/data_loader.py): `code/business_entity_resolution/src/data_loader.py`

### Models and results

- [Trained matcher](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/models/final_entity_matcher.joblib): `models/final_entity_matcher.joblib`
- [Threshold metadata](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/models/model_metadata.json): `models/model_metadata.json`
- [Match and candidate TSVs](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/inference.py): `code/business_entity_resolution/src/inference.py`
- [Submission validator](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/utils/validate_submission.py): `utils/validate_submission.py`
- [Output utilities](https://github.com/akash-bardia/amazon-ml-challenge-2026/blob/main/code/business_entity_resolution/src/output.py): `code/business_entity_resolution/src/output.py`

### Other components

- **Pipeline operator**
- **Vendor TSV inputs**

## Connections

- Pipeline operator → Inference entry point: runs (evidence: `code/business_entity_resolution/src/main.py`)
- Vendor TSV inputs → Country-wise inference: reads records (evidence: `code/business_entity_resolution/src/inference.py`)
- Inference entry point → Country-wise inference: runs inference (evidence: `code/business_entity_resolution/src/main.py`)
- Country-wise inference → Record normalization: normalizes records (evidence: `code/business_entity_resolution/src/inference.py`)
- Country-wise inference → Candidate blocking: generates candidates (evidence: `code/business_entity_resolution/src/inference.py`)
- Country-wise inference → Pair features: extracts pair features (evidence: `code/business_entity_resolution/src/inference.py`)
- Country-wise inference → Matcher model: scores pairs (evidence: `code/business_entity_resolution/src/inference.py`)
- Country-wise inference → Threshold and dedup: filters and deduplicates (evidence: `code/business_entity_resolution/src/inference.py`)
- Country-wise inference → Trained matcher: loads model
- Country-wise inference → Threshold metadata: loads thresholds (evidence: `code/business_entity_resolution/src/inference.py`)
- Country-wise inference → Match and candidate TSVs: writes TSVs (evidence: `code/business_entity_resolution/src/inference.py`)
- Inference entry point → Submission validator: runs validation (evidence: `code/business_entity_resolution/src/main.py`)
- Record normalization → Candidate blocking: provides normalized values (evidence: `code/business_entity_resolution/src/blocking.py`)
- Record normalization → Pair features: provides normalized values (evidence: `code/business_entity_resolution/src/features.py`)
- Training workflow → Candidate blocking: mines candidates (evidence: `train.py`)
- Training workflow → Pair features: builds training features (evidence: `train.py`)
- Training workflow → Matcher model: fits model (evidence: `train.py`)
- Training workflow → Evaluation metrics: evaluates predictions (evidence: `train.py`)
- Training workflow → Threshold and dedup: optimizes thresholds (evidence: `train.py`)
- Training workflow → Trained matcher: saves model
- Training workflow → Threshold metadata: saves metadata
- Threshold and dedup → Evaluation metrics: evaluates thresholds (evidence: `code/business_entity_resolution/src/thresholding.py`)
- TSV and truth loading → Vendor TSV inputs: loads TSV data
