category_encoders: A Second JOSS Paper and the 2.11 Release

Back in 2018 I wrote a short post about category_encoders getting published in JOSS. The review took about a month and happened entirely in GitHub issues. Eight years and a lot of encoders later, the library went through JOSS again, and on August 26, 2026 the new paper was accepted: 10.21105/joss.10645.

A fresh review was also a good excuse to sit down with the codebase for a stretch, so I did, and 2.11.0 shipped less than two weeks later with four new capabilities, a lighter install, and five new contributors.

Why a second paper

The 2018 paper described a library with a handful of encoders and a scikit-learn-compatible API. The library people use today is a lot bigger than that, and the original paper had stopped describing it. So it went through review again, and the new paper covers what category_encoders actually is now.

The review itself ran in openjournals/joss-reviews#10645, edited by fangzhou-xie with mbsuraj and jungtaekkim as reviewers. The review led to a set of improvements:

  • The example script was updated for current dependencies (#490).
  • The README examples now build small self-contained DataFrames with categorical columns (#491).
  • Encoders now support scikit-learn’s global set_output(transform='pandas'), including inside a ColumnTransformer (#492).

Plus a round of edits to the manuscript. All of it shipped in 2.10.0, which was the version the paper reviewed. Thanks to all three of them for the time.

MultiHotEncoder

The first new encoder handles a shape of data that comes up constantly: cells that hold several categories at once. Tags, genres, skills, 'math|physics'. One-hot encoding treats that whole string as one category, which is almost never what you want.

MultiHotEncoder splits each cell on a delimiter and gives every distinct item its own binary column:

import pandas as pd
import category_encoders as ce

X = pd.DataFrame({'topic': ['math|physics', 'math', 'physics|art', 'art']})
ce.MultiHotEncoder(use_cat_names=True).fit_transform(X)
   topic_math  topic_physics  topic_art
0           1              1          0
1           1              0          0
2           0              1          1
3           0              0          1

The delimiter is configurable, whitespace around items is stripped, and empty fragments are dropped, so 'a | b' and 'a||b' both come out as a and b. The usual handle_unknown and handle_missing options apply. An unknown item in a cell is ignored by default while the cell’s known items still light up their columns. There’s no inverse_transform, because a multi-hot row doesn’t uniquely identify the original string.

CountTargetEncoder

CountTargetEncoder is a supervised encoder for classification targets, based on the count-based “Dracula” scheme from Microsoft’s old Big Learning Made Easy with Counts writeup. For each category it stores per-class counts, blends the category’s class shares with the global prior using an S-shaped weight on category size, and emits the log-odds of that smoothed estimate against the prior.

X = pd.DataFrame({'city': ['chicago', 'chicago', 'denver', 'denver', 'denver']})
y = [1, 0, 1, 1, 0]
ce.CountTargetEncoder().fit(X, y).transform(X)
       city
0 -0.058774
1 -0.058774
2  0.043099
3  0.043099
4  0.043099

Small categories get shrunk toward zero evidence, which is what keeps this from overfitting on id-like columns, and a category never seen at fit time encodes to exactly zero: no evidence either way. Binary targets give you one WOE-style column per feature, and multiclass targets give one column per class. For continuous targets, use TargetEncoder or GLMMEncoder.

Rare-category lumping everywhere

CountEncoder has had min_group_size for a long time: categories smaller than a threshold get merged into one leftovers group before encoding. That’s useful for basically every encoder, since a category with three rows produces a noisy statistic no matter which statistic it is. #520 generalized it to every encoder built on BaseEncoder, with the lumping applied before the encoder computes its own statistics:

X = pd.DataFrame({'city': ['chicago'] * 40 + ['denver'] * 30 + ['boise', 'reno', 'akron']})
y = [1, 0] * 20 + [1, 1, 0] * 10 + [1, 0, 1]

enc = ce.TargetEncoder(min_group_size=5, min_group_name='other').fit(X, y)
enc.min_group_lumping_
{'city': {'boise': 'other', 'reno': 'other', 'akron': 'other'}}

The fitted mapping is exposed on min_group_lumping_, so you can see exactly what got merged.

Joint target encoding with composite_cols

This is my favorite one. Target encoding looks at one column at a time. If the signal lives in the combination of two columns, per-column encoding can’t see it at all.

Here’s the cleanest possible demonstration: an XOR-shaped target where neither column alone tells you anything.

X = pd.DataFrame({
    'state': ['GA', 'GA', 'TX', 'TX'] * 25,
    'plan':  ['pro', 'free', 'pro', 'free'] * 25,
})
y = [1, 0, 0, 1] * 25

ce.TargetEncoder().fit(X, y).transform(X).head(4)
   state  plan
0    0.5   0.5
1    0.5   0.5
2    0.5   0.5
3    0.5   0.5

Every value is the prior. Now encode the pair jointly with composite_cols:

ce.TargetEncoder(composite_cols=[('state', 'plan')]).fit(X, y).transform(X).head(4)
   state|plan
0     0.81123
1     0.18877
2     0.18877
3     0.81123

The statistics are learned over the combinations, and the signal shows up. (The values aren’t 1.0 and 0.0 because the default smoothing still pulls 25-row groups part of the way toward the prior. That’s the point of smoothing.) composite_cols works on all the supervised encoders: Target, MEstimate, WOE, JamesStein, CatBoost, GLMM, LeaveOneOut, and Quantile. Set keep_components=True if you want the individual columns encoded alongside the joint one.

A lighter install

#482 took patsy out of the dependency list entirely. The four contrast-coding encoders (Polynomial, Helmert, BackwardDifference, Sum) now build their contrast matrices in-tree. statsmodels became optional too, since only GLMMEncoder needs it. That encoder loads lazily and tells you clearly what to install if it’s missing:

pip install category_encoders          # numpy, scipy, pandas, scikit-learn
pip install "category_encoders[glmm]"  # adds statsmodels for GLMMEncoder

For most users that’s two fewer heavy packages in every environment that installs category_encoders transitively.

How we differ from scikit-learn

The last headline item is documentation, and I think it might help people the most. category_encoders follows the scikit-learn estimator pattern, so it plugs into pipelines and grid search, but it isn’t a drop-in replacement for the scikit-learn transformers it resembles. #522 added a page that just lists them:

  • Most encoders are supervised, so fit requires y.
  • transform on training data can take y too, which lets encoders like leave-one-out apply their regularization, and fit_transform is not simply fit followed by an untargeted transform.
  • Missing and unknown values default to 'value' (treated as their own category) instead of raising, which is the opposite of scikit-learn’s OneHotEncoder default.

The rest of 2.11

The changelog is long, so the highlights: handle_unknown and handle_missing now accept callables and integers across the supervised and ordinal encoders. OneHotEncoder.transform assembles its output in one allocation, which cut peak memory on a 100k-row, 10-column, 20-level benchmark from 626 MB to 337 MB. Encoders fitted on a DataFrame now accept the plain NumPy array that an earlier pipeline step hands them.

Five people made their first contributions in this release: JayeshSuryavanshi, kiwoongyoon, xyf5432, HamzaShahid1122, and manishaagangadevi. Thank you.

2.11.1 and 2.11.2 followed as patch releases.

Getting it

pip install --upgrade category_encoders

The current release on PyPI is 2.11.2. The code lives at scikit-learn-contrib/category_encoders, and if you cite the library, the new JOSS paper is the one to cite now. If you’re curious who cited the old one, I went through the research that uses category_encoders earlier this year, and it’s a much stranger list than you’d guess.