README
Open on GitHub ↗Amazon-ML-
Business Entity Resolution Challenge
An end-to-end machine learning pipeline for large-scale Business Entity Resolution (ER) developed for the Amazon ML Challenge. The system resolves noisy, fragmented business identity records from three heterogeneous data sources into unified real-world entities without relying on external web search, geocoding APIs, or proprietary databases.
Table of Contents
- Problem Overview
- Pipeline Architecture
- Repository Structure
- Setup & Installation
- Usage & Pipeline Execution
- Testing & Validation
- Data & Submission Files
Problem Overview
In enterprise data platforms, business records arrive from multiple independent sources with inconsistent naming, abbreviations, typos, and incomplete address fragments:
- Source 1 (
S1-): The deduplicated reference source. - Source 2 (
S2-) & Source 3 (S3-): Target sources with partial, noisy records. - Goal: For each Source 1 record, accurately identify zero, one, or multiple matching entities from Source 2 and Source 3.
- Coverage: Multi-country datasets across
US,India, andFrance(open string domain). - Constraints: Fully self-contained local ML solution; no external lookups or APIs.
Pipeline Architecture
-
Text Normalization (
src/normalization.py)- Unicode NFKD normalization, lowercasing, punctuation stripping.
- Legal suffix expansion (e.g.,
Pvt Ltd->private limited,Corp->corporation,SARL,GmbH). - Address standardizations (e.g.,
Rd->road,St->street, unit numbers).
-
Blocking & Candidate Pair Generation (
src/blocking.py)- Country-filtered candidate partitioning to reduce $O(N \times M)$ search space.
- Multi-channel blocking: Exact token matches, high-information token keys, and dense embedding retrieval (Sentence-Transformers / Multilingual MiniLM + FAISS nearest neighbor search).
-
Feature Engineering (
src/features.py)- Fuzzy string matching: Levenshtein distance, token sort ratio, token set ratio.
- Token-level overlap: Jaccard similarity, containment ratios, length ratios.
- Embedding similarity: Cosine similarity between dense representation vectors.
-
Reranking & Decision Model (
src/model.py)- Gradient boosted trees (XGBoost) trained on pairwise feature vectors against ground truth matches.
- Dynamic thresholding to determine positive matching entity pairs while preserving zero-match cases.
-
Submission Generation & Verification (
src/utils.py,validate_submission.py)- Produces tab-separated format (
matching_results.tsvandcandidate_pairs.tsv). - Verifies column structure, entity ID formatting, and non-empty rows.
- Produces tab-separated format (
Repository Structure
Amazon-ML-/
├── README.md # Project documentation
├── .gitignore # Ignored datasets, binaries, and virtualenvs
├── embedding+nearest neighbour.ipynb # Exploratory vector search and FAISS retrieval
├── .validation/
│ └── test_notebook_pipeline.py # Offline integration unit tests
├── student_resource/
│ ├── Documentation_template.md # Competition documentation template
│ ├── README.md # Official problem statement & specifications
│ └── utils/
│ └── validate_submission.py # Competition submission format validator
├── train/
│ ├── embeddingNN.ipynb # Multilingual embedding generation
│ ├── EMbedding_last_part.ipynb # FAISS nearest neighbour & reranking
│ └── TFIDF.ipynb # Sparse TF-IDF baseline experiments
└── submission 2/
├── code/business_entity_resolution/
│ ├── README.md # Package README
│ ├── requirements.txt # Pinned Python dependencies
│ ├── run_pipeline.py # Standalone end-to-end CLI execution
│ ├── src/
│ │ ├── __init__.py
│ │ ├── blocking.py # Candidate generation and blocking
│ │ ├── features.py # Pairwise string and semantic features
│ │ ├── model.py # Classification model & prediction
│ │ ├── normalization.py # Text & address cleaning
│ │ └── utils.py # TSV I/O & formatting utilities
│ └── tests/
│ ├── test_blocking_features.py
│ ├── test_model.py
│ └── test_normalization.py
├── notebooks/
│ └── end_to_end_entity_resolution.ipynb # Fully runnable end-to-end notebook
├── business_entity_resolution_submission/ # Packaged submission bundle
├── REBUILD_PLAN.md # Pipeline architecture & audit report
├── REPRODUCIBILITY_REPORT.md # Exact reproduction audit
├── validation_report.md # Validation results & sanity checks
├── FINAL_SUBMISSION_CHECKLIST.md # Pre-submission verification checklist
└── local_validation.json # Validator run metrics
Setup & Installation
-
Clone the repository:
git clone https://github.com/VoidCrewTech67/Amazon-ML-.git cd Amazon-ML-
-
Create and activate a virtual environment:
- Windows (PowerShell):
python -m venv .venv .\.venv\Scripts\Activate.ps1
- Linux / macOS:
python3 -m venv .venv source .venv/bin/activate
- Windows (PowerShell):
-
Install dependencies:
pip install --upgrade pip pip install -r "submission 2/code/business_entity_resolution/requirements.txt"
Usage & Pipeline Execution
CLI Execution
To execute the pipeline from raw dataset files:
python "submission 2/code/business_entity_resolution/run_pipeline.py" \
--data-dir "student_resource/dataset" \
--output-dir "output"
Notebook Execution
Open and execute the step-by-step notebook:
jupyter lab "submission 2/notebooks/end_to_end_entity_resolution.ipynb"
Testing & Validation
Run the project unit test suite using pytest:
pytest "submission 2/code/business_entity_resolution/tests"
Run submission schema validation:
python student_resource/utils/validate_submission.py \
--ground-truth student_resource/dataset/train/train_ground_truth.tsv \
--predictions output/matching_results.tsv
Data & Submission Files
To keep this repository lightweight and respect GitHub repository guidelines:
- Raw competition dataset files (
*.tsv), embeddings, and large submission zip bundles (*.zip) are ignored via.gitignore. - Raw data should be placed into
student_resource/dataset/when running the pipeline locally.