8000 DOC Fix typos in math in Target Encoder user guide by lucyleeow · Pull Request #26584 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

DOC Fix typos in math in Target Encoder user guide #26584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions doc/modules/preprocessing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -883,11 +883,11 @@ cardinality categories are location based such as zip code or region. For the
binary classification target, the target encoding is given by:

.. math::
S_i = \lambda_i\frac{n_{iY}}{n_i} + (1 - \lambda_i)\frac{n_y}{n}
S_i = \lambda_i\frac{n_{iY}}{n_i} + (1 - \lambda_i)\frac{n_Y}{n}

where :math:`S_i` is the encoding for category :math:`i`, :math:`n_{iY}` is the
number of observations with :math:`Y=1` with category :math:`i`, :math:`n_i` is
the number of observations with category :math:`i`, :math:`n_y` is the number of
the number of observations with category :math:`i`, :math:`n_Y` is the number of
observations with :math:`Y=1`, :math:`n` is the number of observations, and
:math:`\lambda_i` is a shrinkage factor. The shrinkage factor is given by:

Expand All @@ -897,14 +897,14 @@ observations with :math:`Y=1`, :math:`n` is the number of observations, and
where :math:`m` is a smoothing factor, which is controlled with the `smooth`
parameter in :class:`TargetEncoder`. Large smoothing factors will put more
weight on the global mean. When `smooth="auto"`, the smoothing factor is
computed as an empirical Bayes estimate: :math:`m=\sigma_c^2/\tau^2`, where
computed as an empirical Bayes estimate: :math:`m=\sigma_i^2/\tau^2`, where
:math:`\sigma_i^2` is the variance of `y` with category :math:`i` and
:math:`\tau^2` is the global variance of `y`.

For continuous targets, the formulation is similar to binary classification:

.. math::
S_i = \lambda_i\frac{\sum_{k\in L_i}y_k}{n_i} + (1 - \lambda_i)\frac{\sum_{k=1}^{n}y_k}{n}
S_i = \lambda_i\frac{\sum_{k\in L_i}Y_k}{n_i} + (1 - \lambda_i)\frac{\sum_{k=1}^{n}Y_k}{n}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was more opinionated, but changed to capital Y to match the equation for binary case and the Micci-Barreca paper.

cc @thomasjpfan


where :math:`L_i` is the set of observations for which :math:`X=X_i` and
:math:`n_i` is the cardinality of :math:`L_i`.
Expand Down
0