-
-
Notifications
You must be signed in to change notification settings - Fork 26k
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
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
||
|
@@ -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} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was more opinionated, but changed to capital 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`. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.