Categorical preprocessing starts by naming the allowed tokens and the output columns.

highlighted = computed this step

Pin the category list first

The known color list is red, blue, green. The column order is pinned before any row is encoded.

categories=(red,blue,green)\text{categories}=(\text{red},\text{blue},\text{green})
Categorical Features ExactlyExact one-hot columns from a pinned category list.one-hot columns from pinned category orderrowcolorredbluegreenotherAred1000Bblue0100Cgreen0010category order: red, blue, green; other reservedpreprocessing rewrites category tokens into indicator columnsunknown category uses the pinned other-column policyNOT training; NOT learning; NOT generalizationNOT accuracy; NOT calibration; NOT a guarantee of model qualityNOT probability truth

Make explicit columns

The indicator columns are red, blue, green, and other. The other column is reserved for the stated unknown-category policy.

columns=(red,blue,green,other)\text{columns}=(\text{red},\text{blue},\text{green},\text{other})
Categorical Features ExactlyExact one-hot columns from a pinned category list.one-hot columns from pinned category orderrowcolorredbluegreenotherAred1000Bblue0100Cgreen0010category order: red, blue, green; other reservedpreprocessing rewrites category tokens into indicator columnsunknown category uses the pinned other-column policyNOT training; NOT learning; NOT generalizationNOT accuracy; NOT calibration; NOT a guarantee of model qualityNOT probability truth

This is preprocessing

No model has been trained. Category tokens are only being rewritten into explicit indicator columns.

category tokenindicator row\text{category token}\rightarrow\text{indicator row}
Categorical Features ExactlyExact one-hot columns from a pinned category list.one-hot columns from pinned category orderrowcolorredbluegreenotherAred1000Bblue0100Cgreen0010category order: red, blue, green; other reservedpreprocessing rewrites category tokens into indicator columnsunknown category uses the pinned other-column policyNOT training; NOT learning; NOT generalizationNOT accuracy; NOT calibration; NOT a guarantee of model qualityNOT probability truth