{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Comparing Target Encoder with Other Encoders\n\n.. currentmodule:: sklearn.preprocessing\n\nThe :class:`TargetEncoder` uses the value of the target to encode each\ncategorical feature. In this example, we will compare three different approaches\nfor handling categorical features: :class:`TargetEncoder`,\n:class:`OrdinalEncoder`, :class:`OneHotEncoder` and dropping the category.\n\n
`fit(X, y).transform(X)` does not equal `fit_transform(X, y)` because a\n cross fitting scheme is used in `fit_transform` for encoding. See the\n `User Guide