Skip to content

Commit 961cc89

Browse files
committed
🔼 Change positive to reference
1 parent d895ac4 commit 961cc89

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/encoders/target_encoding/target_encoding.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
**Private method.**
33
44
Given the targets belonging to a specific category (level) for a categorical variable,
5-
find the frequency of the positive class (binary classification is assumed).
5+
find the frequency of the reference class (binary classification is assumed).
66
77
# Arguments
88
@@ -11,10 +11,10 @@ find the frequency of the positive class (binary classification is assumed).
1111
1212
# Returns
1313
14-
- `freq`: A float for the frequency of the positive class given the category
14+
- `freq`: A float for the frequency of the reference class given the category
1515
"""
1616
function compute_label_freq_for_level(targets_for_level, y_classes)
17-
# Assumes binary classification where the first level is the positive class
17+
# Assumes binary classification where the first level is the reference class
1818
positive_class = y_classes[1]
1919
freq = sum(targets_for_level .== positive_class) / length(targets_for_level)
2020
return freq
@@ -52,7 +52,7 @@ find the frequency of each of the classes (multiclass classification assumed cla
5252
5353
# Returns
5454
55-
- `freqs`: A vector of floats for the frequency of the positive class
55+
- `freqs`: A vector of floats for the frequency of the reference class
5656
"""
5757
function compute_label_freqs_for_level(targets_for_level, y_classes)
5858
# e.g., if y_classes = [1, 2, 3, 4]
@@ -100,7 +100,7 @@ Implement mixing between a posterior and a prior statistic by computing `λ * p
100100
function mix_stats(; posterior, prior, λ)
101101
# mixing prior and posterior with mixing factor λ
102102
return λ .* posterior .+ (1 - λ) .* prior
103-
# prior is like the frequency of the positive class over the whole data
103+
# prior is like the frequency of the reference class over the whole data
104104
# posterior is the frequency given rows that have the specific catefory
105105
end
106106

0 commit comments

Comments
 (0)