﻿# Avazu adapters need the same category and calendar rules online

Use the documented Avazu-derived schema to distinguish identifiers, click labels, calendar fields and categorical variables while preserving offline-online preprocessing consistency.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-avazu-derived-schema-offline-online-category-consistency/
Language: en

## A prepared subset is a particular data product

A developer may train on an Avazu-derived tutorial table and later feed the endpoint rows from a different distribution or schema. The [Alibaba Cloud implementation](https://www.alibabacloud.com/help/en/pai/use-cases/implement-consistent-click-through-rate-prediction-in-batch-and-real-time-modes) explicitly uses a subset with prepared calendar fields and a packaged preprocessing sequence.

Record that derivative's schema rather than assuming every Avazu mirror already contains the same columns. An adapter is part of the trained system, even when its work happens before the neural network or factorization model.

## Identifiers and numeric-looking categories have different roles

The documented table distinguishes an identifier, a click label, calendar components, and discrete variables. A category can arrive as a number without representing an ordered measurement. Inferring all feature semantics from storage dtype can therefore create arbitrary numeric distances between category codes.

Keep the record identifier available for joining predictions. Exclude the target from predictor assembly, and choose identifier usage deliberately rather than automatically scaling every field accepted by a numeric parser.

## Calendar derivation must be reproducible

Specify how an original temporal value becomes year, month, day, and hour in a prepared table. The [pandas datetime API](https://pandas.pydata.org/docs/reference/api/pandas.to_datetime.html) requires attention to format and timezone interpretation; successful conversion alone does not establish that the resulting clock matches the training data.

Use the same interpretation during offline evaluation and serving. If a new implementation changes calendar extraction, compare its prepared values on the same source records before attributing a prediction difference to model weights.

## Unknown categories need a serving policy

The [OneHotEncoder documentation](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html) distinguishes erroring on unknown categories from alternative handling. Select the behavior intentionally and preserve the fitted category inventory and output order.

Relearning a vocabulary independently at request time can shift feature positions while preserving vector length. The [data identity guide](/journal/data-guide-coco-instance-caption-identities/) helps retain field identity across representation changes. Test both familiar values and previously unseen categories against the deployed preparation.

## Compare identical records across both execution paths

Export the complete fitted transformation with the predictor, then compare prepared feature vectors and outputs for matching offline and endpoint records. A raw-input comparison is insufficient if the preparation silently differs.

The [benchmark methodology guide](/journal/inference-benchmark-method/) helps define what an inference measurement includes. Report whether parsing, encoding, assembly, and prediction are timed. Agreement on a derivative subset establishes implementation consistency for that contract, not equivalence to every original competition protocol or demonstrated advertising effectiveness on live traffic.
