Raw catalog exploration · Saved notebook
Data Workbench
Explore Amazon UK and Amazon Berkeley Objects catalog structure, gender-related title wording, and product-title length through the team’s exploratory notebook. The charts and outputs below are saved in the supplied notebook; this page does not execute Python.
Download Jupyter notebookRun the notebook locally
Open the download in Jupyter or Google Colab with NumPy, pandas, and Matplotlib available. Set UK_CSV_PATH to your Amazon UK CSV and ABO_METADATA_DIR to the directory containing all 16 compressed ABO metadata shards. The notebook expects downloaded datasets and does not download them for you. It uses seed 42 and a target sample size of 25,000 per catalog before deduplication.
This exploration uses independent catalogs, including ABO’s UK-English subset. It is separate from the 72-product embedding study and the 1,600-product Playground. Category labels are not equivalent across datasets, and keyword matches alone do not establish bias.
Final Project Exploratory Visualization: Amazon UK and Amazon Berkeley Objects
Group members: Howard Zhang, Eduardo Belluti, and Ivan Perez
Project context and team plan
Our project examines how product text and images represent products, including how products are grouped into categories, how gender-related wording appears, and whether text and images emphasize different aspects of a product. We are designing for people who evaluate or use product-search and recommendation systems. With the final visualization, users should be able to explore product representations, compare patterns across categories, and investigate how text and image representations relate. We hope to learn whether product wording and images organize products in similar or different ways.
Datasets used: For this exploration, we used two raw product catalogs: the Amazon UK Products Dataset (2023), which includes titles, categories, prices, ratings, review/popularity fields, and image URLs; and Amazon Berkeley Objects (ABO), whose listing metadata includes multilingual titles, taxonomy nodes, product types, and image identifiers. ABO contains listings from multiple marketplaces, so for side-by-side title comparisons we used its amazon.co.uk records with en_GB titles. We explored the catalogs as independent datasets rather than treating their records or category labels as direct matches. This notebook uses raw catalog data only; it does not rely on our earlier embedding results.
Our team divided the broader project across the text, gender-framing, evaluation, and interactive-visualization work. Howard Zhang completed the first three project components. Eduardo Belluti's contributions included the text-embedding pipeline (TF-IDF, MPNet, BGE, and Qwen3), analysis of gender framing using causal attention, the Neighbor Purity evaluation, and the interactive scatterplot-brushing prototype. Ivan Perez completed this raw-data exploratory visualization section. These pieces provide different perspectives on how product text and images can be analyzed.
We used Slack to communicate and track workload, and Zoom for team discussions. When a blocker came up, we met to discuss it and agree on how to proceed.
The two catalogs differ in their collection methods, available fields, marketplaces, and taxonomies. ABO is filtered to UK marketplace listings with British-English titles for the title comparisons, but this does not make the catalogs equivalent. The observations below are descriptive starting points for the group's later analysis.
Step 1 — inspect both datasets before plotting
The datasets have already been downloaded. Before running the notebook, update UK_CSV_PATH and ABO_METADATA_DIR in the setup cell to point to the Amazon UK CSV and the folder containing all 16 ABO metadata shards. The notebook reads the files from those locations and does not download data. The first pass prints columns, example rows, record and missingness summaries, and taxonomy/category counts; no chart is drawn until after that inspection.
Python code · cell 3
from pathlib import Path
import gzip
import json
import random
import re
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from IPython.display import display
plt.style.use('seaborn-v0_8-whitegrid')
# Update these two paths to the locations where the datasets are already saved.
UK_CSV_PATH = Path("ADD_PATH_TO_AMAZON_UK_CSV_HERE").expanduser()
ABO_METADATA_DIR = Path("ADD_PATH_TO_ABO_METADATA_FOLDER_HERE").expanduser()
UK_PATH = UK_CSV_PATH
ABO_CACHE = ABO_METADATA_DIR
ABO_SHARDS = list('0123456789abcdef')
if not UK_PATH.is_file() or UK_PATH.name.startswith('ADD_PATH'):
raise FileNotFoundError('Set UK_CSV_PATH to the downloaded Amazon UK CSV file.')
if not ABO_CACHE.is_dir():
raise FileNotFoundError('Set ABO_METADATA_DIR to the folder containing the 16 downloaded listings_<hex>.json.gz files.')
missing_abo_shards = [abo_cache_file for abo_cache_file in (ABO_CACHE / f'listings_{shard}.json.gz' for shard in ABO_SHARDS) if not abo_cache_file.is_file()]
if missing_abo_shards:
missing_names = ', '.join(path.name for path in missing_abo_shards)
raise FileNotFoundError(f'Missing ABO metadata shard(s): {missing_names}. Set ABO_METADATA_DIR to the folder containing all 16 downloaded shards.')
SAMPLE_SIZE = 25_000
SEED = 42
print(f'Amazon UK data file is ready ({UK_PATH.stat().st_size / 1_000_000:.1f} MB).')
print(f'Found all {len(ABO_SHARDS)} downloaded ABO metadata shards.')Saved text output · cell 3
Amazon UK data file is ready (651.1 MB). Found all 16 downloaded ABO metadata shards.
Inspect the raw schemas and sample records
Python code · cell 5
uk_header = pd.read_csv(UK_PATH, nrows=0)
print('Amazon UK columns:', list(uk_header.columns))
uk_preview = pd.read_csv(UK_PATH, nrows=5)
display(uk_preview)
print('Amazon UK dtypes:')
display(uk_preview.dtypes.astype(str).rename('dtype').to_frame())
def abo_shard_path(shard):
return ABO_CACHE / f'listings_{shard}.json.gz'
abo_first_path = abo_shard_path(ABO_SHARDS[0])
with gzip.open(abo_first_path, 'rt', encoding='utf-8') as stream:
abo_preview_rows = [json.loads(next(stream)) for _ in range(3)]
print('\nABO listing-record fields (first record):', sorted(abo_preview_rows[0].keys()))
display(pd.json_normalize(abo_preview_rows).head(3).T)Saved text output · cell 5
Amazon UK columns: ['asin', 'title', 'imgUrl', 'productURL', 'stars', 'reviews', 'price', 'isBestSeller', 'boughtInLastMonth', 'categoryName']
Saved text output · cell 5
asin title \
0 B09B96TG33 Echo Dot (5th generation, 2022 release) | Big ...
1 B01HTH3C8S Anker Soundcore mini, Super-Portable Bluetooth...
2 B09B8YWXDF Echo Dot (5th generation, 2022 release) | Big ...
3 B09B8T5VGV Echo Dot with clock (5th generation, 2022 rele...
4 B09WX6QD65 Introducing Echo Pop | Full sound compact Wi-F...
imgUrl \
0 https://m.media-amazon.com/images/I/71C3lbbeLs...
1 https://m.media-amazon.com/images/I/61c5rSxwP0...
2 https://m.media-amazon.com/images/I/61j3SEUjMJ...
3 https://m.media-amazon.com/images/I/71yf6yTNWS...
4 https://m.media-amazon.com/images/I/613dEoF9-r...
productURL stars reviews price \
0 https://www.amazon.co.uk/dp/B09B96TG33 4.7 15308 21.99
1 https://www.amazon.co.uk/dp/B01HTH3C8S 4.7 98099 23.99
2 https://www.amazon.co.uk/dp/B09B8YWXDF 4.7 15308 21.99
3 https://www.amazon.co.uk/dp/B09B8T5VGV 4.7 7205 31.99
4 https://www.amazon.co.uk/dp/B09WX6QD65 4.6 1881 17.99
isBestSeller boughtInLastMonth categoryName
0 False 0 Hi-Fi Speakers
1 True 0 Hi-Fi Speakers
2 False 0 Hi-Fi Speakers
3 False 0 Hi-Fi Speakers
4 False 0 Hi-Fi Speakers Saved text output · cell 5
Amazon UK dtypes:
Saved text output · cell 5
dtype asin object title object imgUrl object productURL object stars float64 reviews int64 price float64 isBestSeller bool boughtInLastMonth int64 categoryName object
Saved text output · cell 5
ABO listing-record fields (first record): ['brand', 'bullet_point', 'color', 'country', 'domain_name', 'item_id', 'item_keywords', 'item_name', 'main_image_id', 'marketplace', 'model_name', 'model_number', 'model_year', 'node', 'other_image_id', 'product_type', 'style']
Saved text output · cell 5
0 \
brand [{'language_tag': 'nl_NL', 'value': 'find.'}]
bullet_point [{'language_tag': 'nl_NL', 'value': 'Schoen in...
color [{'language_tag': 'nl_NL', 'value': 'Veelkleur...
item_id B06X9STHNG
item_name [{'language_tag': 'nl_NL', 'value': 'Amazon-me...
model_name [{'language_tag': 'nl_NL', 'value': '37753'}]
model_number [{'value': '12-05-04'}]
model_year [{'value': 2017}]
product_type [{'value': 'SHOES'}]
style [{'language_tag': 'nl_NL', 'value': 'Gesloten-...
main_image_id 81iZlv3bjpL
other_image_id [91mIRxgziUL, 91eqBkW06wL, A1BHZSKNbkL]
item_keywords [{'language_tag': 'nl_NL', 'value': 'block hee...
country NL
marketplace Amazon
domain_name amazon.nl
node [{'node_id': 16391787031, 'node_name': '/Categ...
item_weight NaN
item_dimensions.height.normalized_value.unit NaN
item_dimensions.height.normalized_value.value NaN
item_dimensions.height.unit NaN
item_dimensions.height.value NaN
item_dimensions.length.normalized_value.unit NaN
item_dimensions.length.normalized_value.value NaN
item_dimensions.length.unit NaN
item_dimensions.length.value NaN
item_dimensions.width.normalized_value.unit NaN
item_dimensions.width.normalized_value.value NaN
item_dimensions.width.unit NaN
item_dimensions.width.value NaN
material NaN
1 \
brand [{'language_tag': 'es_MX', 'value': 'AmazonBas...
bullet_point [{'language_tag': 'es_MX', 'value': 'White Pow...
color [{'language_tag': 'es_MX', 'value': 'White Pow...
item_id B07P8ML82R
item_name [{'language_tag': 'es_MX', 'value': '22" Botto...
model_name NaN
model_number [{'value': 'AB5013-R22-10'}]
model_year NaN
product_type [{'value': 'HARDWARE'}]
style [{'language_tag': 'es_MX', 'value': '10 pares'}]
main_image_id 619y9YG9cnL
other_image_id [51Fqps5k9YL, 51lCKFuYuWL]
item_keywords [{'language_tag': 'es_MX', 'value': '22'}, {'l...
country MX
marketplace Amazon
domain_name amazon.com.mx
node [{'node_id': 9827962011, 'node_name': '/Catego...
item_weight [{'normalized_value': {'unit': 'pounds', 'valu...
item_dimensions.height.normalized_value.unit inches
item_dimensions.height.normalized_value.value 0.9
item_dimensions.height.unit inches
item_dimensions.height.value 0.9
item_dimensions.length.normalized_value.unit inches
item_dimensions.length.normalized_value.value 22.0
item_dimensions.length.unit inches
item_dimensions.length.value 22.0
item_dimensions.width.normalized_value.unit inches
item_dimensions.width.normalized_value.value 0.87
item_dimensions.width.unit inches
item_dimensions.width.value 0.87
material NaN
2
brand [{'language_tag': 'en_AE', 'value': 'AmazonBas...
bullet_point [{'language_tag': 'en_AE', 'value': '3D printe...
color [{'language_tag': 'en_AE', 'value': 'Transluce...
item_id B07H9GMYXS
item_name [{'language_tag': 'en_AE', 'value': 'AmazonBas...
model_name NaN
model_number [{'value': 'AMG10528516-10'}]
model_year NaN
product_type [{'value': 'MECHANICAL_COMPONENTS'}]
style [{'language_tag': 'en_AE', 'value': '1-Pack'}]
main_image_id 81NP7qh2L6L
other_image_id [81A0u5L4VAL, 61xhS6iLrZL]
item_keywords [{'language_tag': 'en_AE', 'value': '3d printe...
country AE
marketplace Amazon
domain_name amazon.ae
node [{'node_id': 11601270031, 'node_name': '/Categ...
item_weight [{'normalized_value': {'unit': 'pounds', 'valu...
item_dimensions.height.normalized_value.unit inches
item_dimensions.height.normalized_value.value 2.99
item_dimensions.height.unit inches
item_dimensions.height.value 2.99
item_dimensions.length.normalized_value.unit inches
item_dimensions.length.normalized_value.value 9.21
item_dimensions.length.unit inches
item_dimensions.length.value 9.21
item_dimensions.width.normalized_value.unit inches
item_dimensions.width.normalized_value.value 8.31
item_dimensions.width.unit inches
item_dimensions.width.value 8.31
material [{'language_tag': 'en_AE', 'value': 'PETG (Pol... Full-file audit and comparable exploration samples
The UK file is audited in chunks. ABO's 16 compressed metadata shards are streamed one at a time; the code counts all records by marketplace, then uses only amazon.co.uk records with en_GB titles for the comparison sample. Reservoir sampling retains a reproducible sample without loading all listings into memory. For ABO, category is the last component of the available taxonomy node, with product type as fallback. This is not equivalent to Amazon UK's categoryName. Fields absent from one dataset are left absent rather than imputed.
Python code · cell 7
uk_required = {'asin', 'title', 'categoryName', 'price', 'stars', 'reviews', 'boughtInLastMonth', 'isBestSeller', 'imgUrl'}
if not uk_required.issubset(uk_header.columns):
raise ValueError(f'Amazon UK data missing expected columns: {sorted(uk_required - set(uk_header.columns))}')
uk_total = 0
uk_missing = pd.Series(0, index=uk_header.columns, dtype='int64')
uk_categories = pd.Series(dtype='int64')
uk_sample = pd.DataFrame()
uk_sample_keys = np.array([], dtype=float)
uk_usecols = list(uk_header.columns)
rng = np.random.default_rng(SEED)
for chunk in pd.read_csv(UK_PATH, chunksize=100_000):
uk_total += len(chunk)
uk_missing = uk_missing.add(chunk.isna().sum(), fill_value=0).astype('int64')
counts = chunk['categoryName'].fillna('[missing]').astype(str).value_counts()
uk_categories = uk_categories.add(counts, fill_value=0).astype('int64')
if len(chunk):
combined = pd.concat([uk_sample, chunk], ignore_index=True)
combined_keys = np.concatenate([uk_sample_keys, rng.random(len(chunk))])
keep_count = min(SAMPLE_SIZE, len(combined))
keep = np.argpartition(combined_keys, keep_count - 1)[:keep_count]
uk_sample = combined.iloc[keep].reset_index(drop=True)
uk_sample_keys = combined_keys[keep]
uk_sample = uk_sample.drop_duplicates('asin').reset_index(drop=True)
uk_audit = pd.DataFrame({'dataset': ['Amazon UK'], 'records': [uk_total], 'fields': [len(uk_header.columns)], 'category_labels': [len(uk_categories)]})
print('Amazon UK audit:')
display(uk_audit)
display(pd.DataFrame({'missing_records': uk_missing, 'missing_percent': (uk_missing / uk_total * 100).round(2)}).sort_values('missing_percent', ascending=False))
print('Most frequent UK categories:')
display(uk_categories.sort_values(ascending=False).head(15).rename('records').to_frame())
def localized_english_value(record, field):
value = record.get(field, [])
if not isinstance(value, list):
return '', ''
for item in value:
if isinstance(item, dict):
language = str(item.get('language_tag', ''))
text = item.get('value')
if language.lower().startswith('en') and text is not None:
return str(text), language
return '', ''
def abo_category(record):
nodes = record.get('node', [])
if isinstance(nodes, list):
for node in nodes:
if isinstance(node, dict) and node.get('node_name'):
path = str(node['node_name']).strip().strip('/')
segments = [part for part in path.split('/') if part and part.lower() != 'categories']
if segments:
return segments[-1]
types = record.get('product_type', [])
if isinstance(types, list) and types and isinstance(types[0], dict):
return str(types[0].get('value', ''))
return '[uncategorized]'
abo_rng = random.Random(SEED)
abo_sample_rows = []
abo_total = 0
abo_uk_english = 0
abo_categories = {}
abo_domains = {}
abo_field_present = {key: 0 for key in ['item_name', 'node', 'product_type', 'main_image_id', 'other_image_id', 'brand']}
for shard in ABO_SHARDS:
shard_path = abo_shard_path(shard)
with gzip.open(shard_path, 'rt', encoding='utf-8') as stream:
for line in stream:
if not line.strip():
continue
record = json.loads(line)
abo_total += 1
domain = str(record.get('domain_name', record.get('country', '')))
abo_domains[domain] = abo_domains.get(domain, 0) + 1
for field in abo_field_present:
if record.get(field):
abo_field_present[field] += 1
title, language = localized_english_value(record, 'item_name')
if domain != 'amazon.co.uk' or language.lower() != 'en_gb' or not title.strip():
continue
abo_uk_english += 1
category_name = abo_category(record) or '[uncategorized]'
abo_categories[category_name] = abo_categories.get(category_name, 0) + 1
other_images = record.get('other_image_id', [])
image_count = int(bool(record.get('main_image_id'))) + (len(other_images) if isinstance(other_images, list) else 0)
row = {
'product_id': str(record.get('item_id', '')),
'title': title,
'category': category_name,
'dataset': 'ABO',
'language': language,
'marketplace': str(record.get('domain_name', record.get('country', ''))),
'product_type': str((record.get('product_type') or [{}])[0].get('value', '')),
'has_image': image_count > 0,
'image_count': image_count,
'brand': str((record.get('brand') or [{}])[0].get('value', '')),
}
if len(abo_sample_rows) < SAMPLE_SIZE:
abo_sample_rows.append(row)
else:
replacement = abo_rng.randrange(abo_uk_english)
if replacement < SAMPLE_SIZE:
abo_sample_rows[replacement] = row
print(f'Processed ABO shard {shard}; cumulative records: {abo_total:,}; amazon.co.uk en_GB records: {abo_uk_english:,}')
abo_sample = pd.DataFrame(abo_sample_rows).drop_duplicates('product_id').reset_index(drop=True)
abo_category_counts = pd.Series(abo_categories, dtype='int64')
abo_audit = pd.DataFrame({'dataset': ['ABO (all marketplaces)'], 'records': [abo_total], 'comparison_subset': ['amazon.co.uk; en_GB titles'], 'comparison_records': [abo_uk_english], 'taxonomy_labels_in_subset': [len(abo_categories)]})
print('\nABO audit:')
display(abo_audit)
print('ABO records by marketplace (full metadata):')
display(pd.Series(abo_domains, name='records').sort_values(ascending=False).head(20).to_frame())
display(pd.Series(abo_field_present, name='records_with_field').to_frame())
print('Most frequent ABO categories among amazon.co.uk en_GB records:')
display(abo_category_counts.sort_values(ascending=False).head(15).rename('records').to_frame())
print(f'Exploration samples: UK={len(uk_sample):,}; ABO UK en_GB={len(abo_sample):,}.')Saved text output · cell 7
Amazon UK audit:
Saved text output · cell 7
dataset records fields category_labels 0 Amazon UK 2222742 10 296
Saved text output · cell 7
missing_records missing_percent asin 0 0.0 title 0 0.0 imgUrl 0 0.0 productURL 0 0.0 stars 0 0.0 reviews 0 0.0 price 0 0.0 isBestSeller 0 0.0 boughtInLastMonth 0 0.0 categoryName 0 0.0
Saved text output · cell 7
Most frequent UK categories:
Saved text output · cell 7
records categoryName Sports & Outdoors 826076 Skin Care 18755 Fragrances 18563 Make-up 18453 Manicure & Pedicure Products 17212 Handmade Clothing, Shoes & Accessories 16707 Men 16384 Women 16284 Handmade Gifts 15790 Handmade Artwork 15297 Bath & Body 14880 Luggage and travel gear 14612 Handmade Kitchen & Dining 14261 Hair Care 13584 Handmade Jewellery 12420
Saved text output · cell 7
Processed ABO shard 0; cumulative records: 9,232; amazon.co.uk en_GB records: 342
Saved text output · cell 7
Processed ABO shard 1; cumulative records: 18,464; amazon.co.uk en_GB records: 693
Saved text output · cell 7
Processed ABO shard 2; cumulative records: 27,696; amazon.co.uk en_GB records: 1,040
Saved text output · cell 7
Processed ABO shard 3; cumulative records: 36,928; amazon.co.uk en_GB records: 1,396
Saved text output · cell 7
Processed ABO shard 4; cumulative records: 46,160; amazon.co.uk en_GB records: 1,743
Saved text output · cell 7
Processed ABO shard 5; cumulative records: 55,392; amazon.co.uk en_GB records: 2,045
Saved text output · cell 7
Processed ABO shard 6; cumulative records: 64,624; amazon.co.uk en_GB records: 2,388
Saved text output · cell 7
Processed ABO shard 7; cumulative records: 73,856; amazon.co.uk en_GB records: 2,725
Saved text output · cell 7
Processed ABO shard 8; cumulative records: 83,088; amazon.co.uk en_GB records: 3,074
Saved text output · cell 7
Processed ABO shard 9; cumulative records: 92,320; amazon.co.uk en_GB records: 3,415
Saved text output · cell 7
Processed ABO shard a; cumulative records: 101,552; amazon.co.uk en_GB records: 3,742
Saved text output · cell 7
Processed ABO shard b; cumulative records: 110,784; amazon.co.uk en_GB records: 4,078
Saved text output · cell 7
Processed ABO shard c; cumulative records: 120,016; amazon.co.uk en_GB records: 4,392
Saved text output · cell 7
Processed ABO shard d; cumulative records: 129,248; amazon.co.uk en_GB records: 4,713
Saved text output · cell 7
Processed ABO shard e; cumulative records: 138,480; amazon.co.uk en_GB records: 5,093
Saved text output · cell 7
Processed ABO shard f; cumulative records: 147,702; amazon.co.uk en_GB records: 5,432 ABO audit:
Saved text output · cell 7
dataset records comparison_subset \ 0 ABO (all marketplaces) 147702 amazon.co.uk; en_GB titles comparison_records taxonomy_labels_in_subset 0 5432 1006
Saved text output · cell 7
ABO records by marketplace (full metadata):
Saved text output · cell 7
records amazon.in 76433 amazon.com 19616 amazon.ca 6720 amazon.co.uk 5438 amazon.com.mx 4831 amazon.de 4749 amazon.es 4443 amazon.fr 4073 amazon.it 3861 amazon.co.jp 3651 amazon.com.au 2142 fresh.amazon.com 2042 amazon.nl 1688 primenow.amazon.com 1349 amazon.sg 1341 wholefoodsmarket.com 1186 amazon.ae 1181 amazon.se 1024 amazon.com/go 598 amazon.sa 375
Saved text output · cell 7
records_with_field item_name 147702 node 140749 product_type 147702 main_image_id 147127 other_image_id 137976 brand 147643
Saved text output · cell 7
Most frequent ABO categories among amazon.co.uk en_GB records:
Saved text output · cell 7
records Boots 228 Necklaces 187 Fashion Sandals 169 Fashion Trainers 166 Fitted Sheets 165 Home & Kitchen 122 Sofas & Couches 104 Duvet Cover Sets 92 Bracelets 80 Curtains 77 Earrings 71 Coffee Tables 61 Court Shoes 61 Area Rugs 58 Loafers & Moccasins 57
Saved text output · cell 7
Exploration samples: UK=25,000; ABO UK en_GB=5,432.
What we noticed before making charts
Before plotting, we found that the UK file contains more than two million records and that the inspected UK fields have no missing values. ABO includes many marketplaces, but only a smaller portion of its listings are from the UK. The UK catalog has a dominant Sports & Outdoors label, while the ABO UK-English subset uses many more taxonomy leaves with different labels. Every sampled product in both datasets has an image reference, so reference presence does not vary enough to be useful as an exploratory measure. The catalogs are independent rather than matched product rows, and their fields are not identical; for example, the UK file includes price, review, and popularity fields that are not available in the same form in the ABO listing metadata.
Three exploratory hypotheses
We explored three questions:
1. Catalog organization. What differences and concentrations appear in the category labels used by the two catalogs?
2. Gender-related language. How often do explicit gender-related terms appear in English product titles, and how does their presence vary across the categories in each dataset?
3. Product-title text. How does title length vary across the two catalogs and across product categories?
These are open questions, not predicted findings. They explore raw catalog data relevant to the group’s later embedding work. Keyword matches do not establish bias; image references do not reveal image semantics; and unlike category labels should not be equated across the two datasets.
Hypothesis 1 — What category structure is visible in each catalog?
Iteration 1: top category counts, side by side
We began with raw counts within each dataset to see which labels were most common. This made the dominant labels easy to spot, but the different catalog sizes made direct comparison difficult, and the labels do not represent equivalent taxonomies.
Python code · cell 11
uk_top = uk_categories.sort_values(ascending=False).head(12).sort_values()
abo_top = abo_category_counts.sort_values(ascending=False).head(12).sort_values()
fig, axes = plt.subplots(1, 2, figsize=(15, 7))
axes[0].barh(uk_top.index, uk_top.values, color='#3977b8')
axes[0].set_title('Amazon UK · top category labels')
axes[0].set_xlabel('Full-dataset record count')
axes[1].barh(abo_top.index, abo_top.values, color='#df8b38')
axes[1].set_title('ABO UK · top en_GB taxonomy leaves')
axes[1].set_xlabel('Full-shard record count with English title')
fig.suptitle('H1 · Iteration 1: category counts (separate scales and taxonomies)')
plt.tight_layout()
plt.show()
print('Refinement note: counts expose dominant labels; next compare within-dataset percentages to reduce size effects.')
Saved text output · cell 11
Refinement note: counts expose dominant labels; next compare within-dataset percentages to reduce size effects.
Iteration 2: refine the same bars to within-catalog percentages
We keep the horizontal-bar design, but change raw counts to percentages and align category ranks within each dataset. This directly addresses the different dataset sizes and makes the concentration pattern easier to compare. Categories remain dataset-specific; this does not imply matching taxonomy meanings.
Python code · cell 13
uk_share = uk_categories.sort_values(ascending=False).head(15) / uk_total * 100
abo_share = abo_category_counts.sort_values(ascending=False).head(15) / abo_uk_english * 100
fig, axes = plt.subplots(1, 2, figsize=(15, 7))
axes[0].barh(uk_share.sort_values().index, uk_share.sort_values().values, color='#3977b8')
axes[0].set_title('Amazon UK · share of all records')
axes[1].barh(abo_share.sort_values().index, abo_share.sort_values().values, color='#df8b38')
axes[1].set_title('ABO UK · share of en_GB records')
for ax in axes:
ax.set_xlabel('Dataset share (%)')
fig.suptitle('H1 · Iteration 2: within-catalog category concentration')
plt.tight_layout()
plt.show()
print('Refinement note: normalized bars clarify concentration; next examine how quickly categories cover the catalog.')
Saved text output · cell 13
Refinement note: normalized bars clarify concentration; next examine how quickly categories cover the catalog.
Iteration 3: cumulative share covered by ranked categories
This cumulative curve changes from individual category bars to an overview of taxonomy concentration. A steep curve means a small set of labels covers many records. It avoids direct label matching, but does not indicate whether either taxonomy is more accurate.
Python code · cell 15
uk_cumulative = uk_categories.sort_values(ascending=False).cumsum() / uk_total
abo_cumulative = abo_category_counts.sort_values(ascending=False).cumsum() / abo_uk_english
fig, ax = plt.subplots(figsize=(8, 6))
ax.plot(np.arange(1, len(uk_cumulative) + 1), uk_cumulative.values, label=f'Amazon UK ({len(uk_cumulative)} labels)', color='#3977b8')
ax.plot(np.arange(1, len(abo_cumulative) + 1), abo_cumulative.values, label=f'ABO UK en_GB ({len(abo_cumulative)} labels)', color='#df8b38')
ax.set_xlabel('Category labels, ranked from most frequent')
ax.set_ylabel('Cumulative share of records')
ax.set_ylim(0, 1.02)
ax.set_title('H1 · Iteration 3: cumulative coverage of each catalog taxonomy')
ax.legend()
plt.tight_layout()
plt.show()
uk_top10_share = uk_categories.sort_values(ascending=False).head(10).sum() / uk_total
abo_top10_share = abo_category_counts.sort_values(ascending=False).head(10).sum() / abo_uk_english
print(f"H1 exploratory conclusion: the UK catalog is strongly concentrated in {uk_categories.idxmax()} ({uk_categories.max() / uk_total:.1%} of full-catalog rows), while ABO UK's most frequent leaf is {abo_category_counts.idxmax()} ({abo_category_counts.max() / abo_uk_english:.1%} of the UK-English subset). The top 10 labels cover {uk_top10_share:.1%} of UK rows and {abo_top10_share:.1%} of ABO UK rows. This suggests different category concentration in these catalogs, but it does not establish which taxonomy is more accurate; their labels and collection processes differ.")
Saved text output · cell 15
H1 exploratory conclusion: the UK catalog is strongly concentrated in Sports & Outdoors (37.2% of full-catalog rows), while ABO UK's most frequent leaf is Boots (4.2% of the UK-English subset). The top 10 labels cover 44.1% of UK rows and 25.6% of ABO UK rows. This suggests different category concentration in these catalogs, but it does not establish which taxonomy is more accurate; their labels and collection processes differ.
Hypothesis 2 — Where does gender-related wording appear in English titles?
The seed lexicon below is intentionally transparent and incomplete. It finds explicit terms only and may miss synonyms, contexts, and other languages. ABO is restricted to amazon.co.uk listings with en_GB titles here; Amazon UK dataset titles are treated as English, but marketplace text may still contain non-English phrases.
Iteration 1: overall term prevalence by dataset
We began the title audit with the percentage of products containing at least one seed-list term and included the sample sizes as context. Percentages are more useful than raw counts for samples of different sizes, but this summary does not tell us how a term is being used or whether the wording is biased.
Python code · cell 17
gender_terms = ['women', 'woman', 'men', 'man', 'girls', 'girl', 'boys', 'boy', 'female', 'male', 'ladies', 'lady', 'unisex']
term_pattern = re.compile(r'(?<![A-Za-z])(' + '|'.join(re.escape(t) for t in gender_terms) + r')(?![A-Za-z])', re.IGNORECASE)
uk_sample['title'] = uk_sample['title'].fillna('').astype(str)
uk_sample['has_gender_term'] = uk_sample['title'].map(lambda text: bool(term_pattern.search(text)))
abo_sample['has_gender_term'] = abo_sample['title'].map(lambda text: bool(term_pattern.search(text)))
h2_overall = pd.DataFrame({
'dataset': ['Amazon UK', 'ABO UK en_GB'],
'sample_size': [len(uk_sample), len(abo_sample)],
'titles_with_term': [int(uk_sample.has_gender_term.sum()), int(abo_sample.has_gender_term.sum())],
})
h2_overall['percent'] = 100 * h2_overall.titles_with_term / h2_overall.sample_size
fig, ax = plt.subplots(figsize=(7, 4))
bars = ax.bar(h2_overall.dataset, h2_overall.percent, color=['#3977b8', '#df8b38'])
ax.bar_label(bars, labels=[f'{p:.1f}%\n(n={n:,})' for p, n in zip(h2_overall.percent, h2_overall.sample_size)], padding=4)
ax.set_ylabel('Sampled titles with ≥1 seed term (%)')
ax.set_title('H2 · Iteration 1: explicit gender-term prevalence')
ax.set_ylim(0, max(5, h2_overall.percent.max() * 1.25))
plt.tight_layout()
plt.show()
display(h2_overall)
print('Refinement note: overall prevalence hides which terms and categories contribute; inspect term frequencies next.')
Saved text output · cell 17
dataset sample_size titles_with_term percent 0 Amazon UK 25000 7262 29.048000 1 ABO UK en_GB 5432 900 16.568483
Saved text output · cell 17
Refinement note: overall prevalence hides which terms and categories contribute; inspect term frequencies next.
Iteration 2: refine the bars to compare individual terms
We keep a bar-chart comparison but move from any-term prevalence to counts for each term, normalized per 1,000 titles to account for sample size. This reveals which terms drive the initial overall rate; it still ignores context and can count audience, style, or other uses.
Python code · cell 19
def terms_in_title(text):
return sorted(set(match.group(0).lower() for match in term_pattern.finditer(str(text))))
uk_term_counts = pd.Series([term for title in uk_sample.title for term in terms_in_title(title)]).value_counts()
abo_term_counts = pd.Series([term for title in abo_sample.title for term in terms_in_title(title)]).value_counts()
all_terms = sorted(set(uk_term_counts.index) | set(abo_term_counts.index))
term_table = pd.DataFrame({'term': all_terms, 'Amazon UK': [1000 * uk_term_counts.get(t, 0) / len(uk_sample) for t in all_terms], 'ABO UK en_GB': [1000 * abo_term_counts.get(t, 0) / len(abo_sample) for t in all_terms]})
term_table = term_table.sort_values('Amazon UK', ascending=True).tail(15)
fig, ax = plt.subplots(figsize=(9, 6))
y = np.arange(len(term_table))
ax.barh(y - .18, term_table['Amazon UK'], height=.35, label='Amazon UK sample', color='#3977b8')
ax.barh(y + .18, term_table['ABO UK en_GB'], height=.35, label='ABO UK en_GB sample', color='#df8b38')
ax.set_yticks(y, term_table.term)
ax.set_xlabel('Titles containing term per 1,000 sampled titles')
ax.set_title('H2 · Iteration 2: normalized seed-term frequency')
ax.legend()
plt.tight_layout()
plt.show()
print('Refinement note: term counts expose wording differences; next inspect rates by each dataset’s own category labels.')
Saved text output · cell 19
Refinement note: term counts expose wording differences; next inspect rates by each dataset’s own category labels.
Iteration 3: category-level prevalence within each dataset
This final view changes from bars to a dot plot, making the category rates easier to scan without emphasizing volume. Each point shows the percentage of titles containing a seed term within that category, and the category labels include the number of sampled products. We show the 15 highest-rate categories with at least 20 sampled products in each dataset. The panels use each dataset's own categories and independent samples, so we do not compare category names as if they were equivalent. Rates based on smaller categories are less stable. Looking at example titles from high-rate categories would help us understand the terms in context; a lexical match by itself is not a fairness finding.
Python code · cell 21
uk_sample['category'] = uk_sample['categoryName'].fillna('[missing]').astype(str)
def prevalence_by_category(frame, category_col='category'):
return frame.groupby(category_col).agg(products=('title', 'size'), titles_with_term=('has_gender_term', 'sum')).assign(
percent=lambda d: 100 * d.titles_with_term / d.products).query('products >= 20').sort_values('percent').tail(15)
uk_h2_cat = prevalence_by_category(uk_sample)
abo_h2_cat = prevalence_by_category(abo_sample)
fig, axes = plt.subplots(1, 2, figsize=(15, 8))
for ax, data, color in [(axes[0], uk_h2_cat, '#3977b8'), (axes[1], abo_h2_cat, '#df8b38')]:
y = np.arange(len(data))
ax.scatter(data.percent, y, color=color, s=48, zorder=3)
ax.set_yticks(y, [f'{category} (n={count})' for category, count in zip(data.index, data.products)])
ax.grid(axis='x', alpha=0.3)
axes[0].set_title('Amazon UK · categories with highest sampled rate')
axes[1].set_title('ABO UK · categories with highest sampled rate')
for ax in axes:
ax.set_xlabel('Titles with a seed term (%)')
fig.suptitle('H2 · Iteration 3: category context (taxonomies not directly equivalent)')
plt.tight_layout()
plt.show()
rate_gap = h2_overall.loc[0, 'percent'] - h2_overall.loc[1, 'percent']
uk_peak = uk_h2_cat.iloc[-1]
abo_peak = abo_h2_cat.iloc[-1]
print(f"H2 exploratory conclusion: at least one seed term appears in {h2_overall.loc[0, 'percent']:.1f}% of the UK sample and {h2_overall.loc[1, 'percent']:.1f}% of the ABO UK en_GB sample (a descriptive difference of {rate_gap:.1f} percentage points). Among categories with at least 20 sampled products, the highest observed rates are {uk_peak.name} ({uk_peak.percent:.1f}%) and {abo_peak.name} ({abo_peak.percent:.1f}%). A high rate in a gender-named category may follow from its category definition; this is a seed-lexicon observation, not evidence of bias, and the catalogs/categories differ.")
print('Most frequent matched terms (normalized per 1,000 titles):')
display(term_table.sort_values('Amazon UK', ascending=False).head(8))
Saved text output · cell 21
H2 exploratory conclusion: at least one seed term appears in 29.0% of the UK sample and 16.6% of the ABO UK en_GB sample (a descriptive difference of 12.5 percentage points). Among categories with at least 20 sampled products, the highest observed rates are Girls (94.1%) and Men (87.5%). A high rate in a gender-named category may follow from its category definition; this is a seed-lexicon observation, not evidence of bias, and the catalogs/categories differ. Most frequent matched terms (normalized per 1,000 titles):
Saved text output · cell 21
term Amazon UK ABO UK en_GB 12 women 128.16 76.767305 9 men 109.16 78.240059 4 girls 40.36 11.045655 1 boys 24.36 4.418262 10 unisex 19.64 2.761414 3 girl 14.92 1.840943 5 ladies 14.44 0.920471 0 boy 8.64 0.552283
Hypothesis 3 — How does product-title length vary across the two catalogs and their categories?
Both catalogs include product titles/names, making this a shared raw field relevant to the group's text-embedding work. The initial audit found an image reference on every sampled record, so binary image-reference presence cannot distinguish products here; it is not useful as the main variable for this hypothesis. This is a refinement based on inspecting the data.
Iteration 1: overlaid title-length distributions
We apply the same word-count rule and bins to both datasets and normalize each histogram to density because the sample sizes differ. The shape and tails are visible, but medians and category variation are hard to compare.
Python code · cell 23
uk_sample['title_words'] = uk_sample.title.fillna('').astype(str).str.findall(r'\b\w+\b').str.len()
abo_sample['title_words'] = abo_sample.title.fillna('').astype(str).str.findall(r'\b\w+\b').str.len()
fig, ax = plt.subplots(figsize=(8, 5))
bins = np.arange(0, int(max(uk_sample.title_words.max(), abo_sample.title_words.max())) + 3, 2)
ax.hist(uk_sample.title_words, bins=bins, density=True, histtype='step', linewidth=2, label=f'Amazon UK (n={len(uk_sample):,})', color='#3977b8')
ax.hist(abo_sample.title_words, bins=bins, density=True, histtype='step', linewidth=2, label=f'ABO UK en_GB (n={len(abo_sample):,})', color='#df8b38')
ax.set_xlabel('Words in product title/name (display clipped at 60 words)')
ax.set_ylabel('Density')
ax.set_title('H3 · Iteration 1: title-length distributions')
ax.set_xlim(0, 60)
ax.legend()
plt.tight_layout()
plt.show()
print(f"{(uk_sample.title_words > 60).mean():.1%} of UK sample titles and {(abo_sample.title_words > 60).mean():.1%} of ABO UK titles exceed the displayed 60-word range.")
print('Refinement note: the shared-bin distributions show shape; add median and spread summaries next.')
Saved text output · cell 23
0.0% of UK sample titles and 0.0% of ABO UK titles exceed the displayed 60-word range. Refinement note: the shared-bin distributions show shape; add median and spread summaries next.
Iteration 2: dataset-level title-length boxplots
This keeps title length as the measure but changes the encoding from overlapping histograms to medians, quartiles, and outliers. The same word-count scale and labels make the two samples easier to compare; the boxplots still hide category-level variation.
Python code · cell 25
fig, ax = plt.subplots(figsize=(8, 5))
ax.boxplot([uk_sample.title_words, abo_sample.title_words], tick_labels=[f'Amazon UK\n(n={len(uk_sample):,})', f'ABO UK en_GB\n(n={len(abo_sample):,})'], showfliers=False, patch_artist=True,
boxprops={'facecolor': '#d9e7f2'}, medianprops={'color': '#b64242', 'linewidth': 2})
ax.set_ylabel('Words in product title/name')
ax.set_title('H3 · Iteration 2: median and interquartile spread')
plt.tight_layout()
plt.show()
print('Refinement note: the boxplot makes medians/spread easier to compare; now inspect variation across each catalog’s own categories.')
Saved text output · cell 25
Refinement note: the boxplot makes medians/spread easier to compare; now inspect variation across each catalog’s own categories.
Iteration 3: category-level title-length dot plots
This final view decomposes the dataset-level distributions by category. Each dot is a category median, horizontal bars show the interquartile range (not a confidence interval), and labels include sample counts. We show the 12 most-sampled categories with at least 30 products in each dataset, in separate panels because their taxonomies are not interchangeable.
Python code · cell 27
def category_title_summary(frame, category_col):
grouped = frame.groupby(category_col).title_words
result = grouped.agg(products='size', median='median', q1=lambda x: x.quantile(.25), q3=lambda x: x.quantile(.75))
result = result[result.products >= 30].nlargest(12, 'products').sort_values('median')
return result
uk_h3 = category_title_summary(uk_sample, 'categoryName')
abo_h3 = category_title_summary(abo_sample, 'category')
fig, axes = plt.subplots(1, 2, figsize=(15, 8))
for ax, data, name, color in [(axes[0], uk_h3, 'Amazon UK', '#3977b8'), (axes[1], abo_h3, 'ABO UK en_GB', '#df8b38')]:
y = np.arange(len(data))
errors = np.vstack([data['median'] - data.q1, data.q3 - data['median']])
ax.errorbar(data['median'], y, xerr=errors, fmt='o', capsize=3, color=color, ecolor=color)
ax.set_yticks(y, [f'{category} (n={count})' for category, count in zip(data.index, data.products)])
ax.set_xlabel('Title words: median and IQR')
ax.set_title(name)
fig.suptitle('H3 · Iteration 3: title-length variation across frequent categories')
fig.tight_layout()
plt.show()
uk_image_rate = uk_sample['imgUrl'].fillna('').astype(str).str.strip().str.startswith(('http://', 'https://')).mean()
abo_image_rate = abo_sample.has_image.mean()
uk_iqr = uk_sample.title_words.quantile(.75) - uk_sample.title_words.quantile(.25)
abo_iqr = abo_sample.title_words.quantile(.75) - abo_sample.title_words.quantile(.25)
print(f"H3 exploratory conclusion: median title lengths are {uk_sample.title_words.median():.0f} words (IQR {uk_iqr:.0f}) in the UK sample and {abo_sample.title_words.median():.0f} (IQR {abo_iqr:.0f}) in the ABO UK en_GB subset. The category dot plots show whether this descriptive difference is consistent or category-specific; the catalogs are not matched, so it is not causal.")
print(f"Image-reference check: {uk_image_rate:.1%} of sampled UK rows and {abo_image_rate:.1%} of sampled ABO UK en_GB rows have references. Because presence is constant here, it was excluded from the final comparison.")
print('Categories shown (top 12 by sample size, with at least 30 records):', len(uk_h3), 'UK and', len(abo_h3), 'ABO.')
Saved text output · cell 27
H3 exploratory conclusion: median title lengths are 19 words (IQR 12) in the UK sample and 12 (IQR 8) in the ABO UK en_GB subset. The category dot plots show whether this descriptive difference is consistent or category-specific; the catalogs are not matched, so it is not causal. Image-reference check: 100.0% of sampled UK rows and 100.0% of sampled ABO UK en_GB rows have references. Because presence is constant here, it was excluded from the final comparison. Categories shown (top 12 by sample size, with at least 30 records): 12 UK and 12 ABO.
What we learned from the exploration
We began by inspecting the schemas, example records, missingness, marketplace coverage, and category fields before making charts. This showed us that the catalogs were not directly comparable: they use different category systems, cover different marketplaces, and do not contain the same fields. One unexpected result was that every sampled record in both datasets had an image reference. Because image-reference presence did not vary, it could not help us distinguish products, so we shifted our third question to a shared field that did vary: product-title length.
For the first question, raw category counts made the most common labels easy to spot, but they were difficult to compare across datasets of different sizes. We therefore refined the bars to show within-catalog percentages, then used a cumulative curve to see how quickly the leading labels covered each catalog. Sports & Outdoors accounts for 37.2% of the full Amazon UK catalog, while Boots is the most common leaf label in the ABO UK-English subset at 4.2%. The top ten labels cover 44.1% of the UK catalog and 25.6% of the ABO subset. This suggests that the label distributions differ in concentration, but it does not tell us which taxonomy is better; the label definitions and data-collection processes are different.
For the second question, we first compared the percentage of titles containing any term from our seed list. We then normalized individual term counts per 1,000 titles and finally compared rates within each dataset's own categories. At least one listed term appears in 29.0% of the Amazon UK sample and 16.6% of the ABO UK-English sample. The highest category rates were in Girls (94.1%) and Men (87.5%). Those high rates may be related to the category names themselves, so we treat them as a prompt to inspect titles and context—not as evidence of bias. Our short list only captures explicit terms and can miss other wording or meanings.
For the third question, we started with overlaid title-length distributions, moved to boxplots to make medians and spread easier to compare, and then broke the results down by category. The median title length is 19 words (IQR 12) in the Amazon UK sample and 12 words (IQR 8) in the ABO UK-English subset. The selected category plots also show substantial variation in median title length within both catalogs, so the overall medians do not describe every category. Since the catalogs are independent and not matched product-by-product, this is a descriptive difference, not a causal result.
Together, these views give the team a baseline description of the raw product data before interpreting text or image embeddings. The category patterns can inform later text-neighbor analysis; the title examples give the gender-framing work context for checking how keywords are used; and the image references show metadata coverage, not what the images depict. Evaluating whether text and image neighborhoods differ still requires aligned product-level image and text representations.
How we refined the visualizations
We tried several views for each question rather than relying on a single chart. For category structure, we moved from counts to percentages and then cumulative coverage because the catalogs have different sizes. For title wording, we moved from an overall rate to per-term rates and then to a category-level dot plot to add context and show a different pattern clearly. For title length, we moved from histograms to boxplots and then category-level median-and-IQR dot plots. These changes helped us see both dataset-wide patterns and variation hidden within the overall summaries. The charts use ranked bars, a cumulative curve, histograms, boxplots, and dot plots, and each iteration responds to a limitation in the earlier view.
Limitations
The Amazon UK charts use a reproducible sample of up to 25,000 products, although the audit and category counts use the full CSV. We examined all ABO metadata shards for marketplace coverage and used the available 5,432 amazon.co.uk records with en_GB titles for the comparison. The samples are not matched products, and the catalogs may differ in collection method, coverage, and timing. Their category taxonomies are not equivalent, and their fields are not identical. Finally, the gender-term list is incomplete and context-sensitive; title keyword matches do not establish bias. Image references do not provide evidence about image content, quality, or embedding structure.
This exploration leaves us with follow-up questions rather than final claims: how much of the title-length difference is associated with category mix, how are gender-related words used in context, and do text and image representations organize the same products differently? Those questions connect the descriptive catalog work to the group's later embedding and interactive-visualization analyses.