Skip to content

Commit 92bc454

Browse files
authored
Revise JOSS paper per review (#484) (#494)
- Lowercase the project name 'category_encoders' where it began a sentence. - Add a 'Representative encoding methods' section with mathematical definitions for One-Hot, Hashing, Target (mean), and Weight of Evidence encoders to help readers understand how the encoders work. - Cite Anthropic's Claude Opus 4.8 (with version) in the AI usage disclosure and add the corresponding bibliography entry.
1 parent b9f9b0a commit 92bc454

2 files changed

Lines changed: 38 additions & 4 deletions

File tree

joss/paper.bib

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,11 @@ @article{schmitt2022predicting
184184
pages={3223--3239},
185185
year={2022},
186186
DOI={10.1007/s11095-022-03370-3}
187+
}
188+
@misc{anthropic2026claude,
189+
author={{Anthropic}},
190+
title={Claude Opus 4.8},
191+
year={2026},
192+
howpublished={\url{https://www.anthropic.com/claude}},
193+
note={Large language model}
187194
}

joss/paper.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ bibliography: paper.bib
4949

5050
# Summary
5151

52-
Category_encoders is a scikit-learn-contrib module of transformers for encoding categorical data. As a scikit-learn-contrib
52+
category_encoders is a scikit-learn-contrib module of transformers for encoding categorical data. As a scikit-learn-contrib
5353
module, category_encoders is fully compatible with the scikit-learn API [@scikit-learn-api]. It also uses heavily the tools
5454
provided by scikit-learn [@scikit-learn] itself, SciPy [@scipy], pandas [@pandas], and statsmodels [@statsmodels].
5555

@@ -91,7 +91,7 @@ train/test handling. In the R ecosystem, the `recipes` and `embed` packages prov
9191
with a different API paradigm. The Python libraries Patsy and formulaic support contrast coding schemes but are oriented
9292
toward formula-based model specification rather than general-purpose feature engineering.
9393

94-
Category_encoders fills a gap by consolidating over twenty encoding strategies into a single scikit-learn-compatible
94+
category_encoders fills a gap by consolidating over twenty encoding strategies into a single scikit-learn-compatible
9595
package. It is the only Python library that provides supervised encoding methods such as Target, CatBoost, Weight of
9696
Evidence, James-Stein, and GLMM encoders alongside classical contrast coding and hashing approaches, all with a uniform
9797
interface that handles edge cases like unseen categories and missing values consistently across methods.
@@ -113,6 +113,33 @@ All encoders accept and return pandas DataFrames, automatically detect categoric
113113
support inverse transforms where applicable. The library is designed for production use, with careful handling of edge
114114
cases including previously unseen categories, missing values, and invariant columns.
115115

116+
# Representative encoding methods
117+
118+
To illustrate the range of techniques the library provides, we give mathematical definitions for a few representative
119+
encoders. Consider a single categorical feature that takes values in a set of $K$ categories $\{c_1, \dots, c_K\}$. Let
120+
$n_k$ be the number of training observations in category $c_k$ and $n = \sum_{k=1}^{K} n_k$ the total number of
121+
observations.
122+
123+
*One-Hot Encoding* is the canonical unsupervised scheme: it maps each category $c_k$ to the indicator vector
124+
$e_k \in \{0, 1\}^K$, the $k$-th standard basis vector, so that the encoded feature is orthogonal across categories at
125+
the cost of a width that grows linearly with cardinality $K$.
126+
127+
*Hashing Encoding* keeps the output width fixed regardless of cardinality. Given a hash function $h$ and a chosen number
128+
of output dimensions $d$, category $c_k$ is mapped to bucket $h(c_k) \bmod d$. This bounds the encoded width by $d$ but
129+
allows distinct categories to collide into the same bucket.
130+
131+
*Target (mean) Encoding* is a representative supervised scheme. With a target $y$, global mean $\bar{y}$, and
132+
within-category mean $\bar{y}_k$, category $c_k$ is replaced by a shrinkage estimate that blends the category mean toward
133+
the global mean,
134+
$$\hat{x}_k = \lambda(n_k)\, \bar{y}_k + \big(1 - \lambda(n_k)\big)\, \bar{y}, \qquad \lambda(n_k) = \frac{n_k}{n_k + m},$$
135+
where the smoothing parameter $m \ge 0$ controls how strongly low-frequency categories are regularized toward $\bar{y}$.
136+
The M-Estimate and James-Stein encoders are variants that differ in how the shrinkage weight $\lambda$ is chosen.
137+
138+
*Weight of Evidence (WOE) Encoding* targets binary classification. It encodes category $c_k$ by the log-ratio of the
139+
conditional probabilities of the category given each class,
140+
$$\mathrm{WOE}_k = \ln \frac{P(c_k \mid y = 1)}{P(c_k \mid y = 0)},$$
141+
which is positive when the category is over-represented among positive observations and negative otherwise.
142+
116143
# Research impact statement
117144

118145
Since its original publication [@onehot], category_encoders has been widely adopted across both academic research and
@@ -133,7 +160,7 @@ for working with categorical data in Python.
133160

134161
# AI usage disclosure
135162

136-
AI tools (Claude, Anthropic) were used to assist in drafting and editing the text of this paper. No AI tools were used in
137-
the development of the category_encoders software.
163+
Anthropic's Claude Opus 4.8 [@anthropic2026claude] was used to assist in drafting and editing the text of this paper. No
164+
AI tools were used in the development of the category_encoders software.
138165

139166
# References

0 commit comments

Comments
 (0)