Skip to content

Commit d1b5151

Browse files
committed
Improve docstrings of Indicator and LowHigh
1 parent 02148a6 commit d1b5151

2 files changed

Lines changed: 11 additions & 14 deletions

File tree

src/transforms/indicator.jl

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@ const SCALES = [:quantile, :linear]
33
"""
44
Indicator(col; k=10, scale=:quantile, categ=false)
55
6-
Transforms continuous variable into `k` indicator variables defined by
7-
half-intervals of `col` values in a given `scale`. Optionally, specify the `categ`
8-
option to return binary categorical values as opposed to raw 1s and 0s.
6+
Given a sequence of `k` increasing threshold values `t1 < t2 < ... < tk`,
7+
the transform converts a continuous variable `z` into a sequence of `k`
8+
variables `z <= t1`, `z <= t2`, ..., `z <= tk`.
99
10-
Given a sequence of increasing threshold values `t1 < t2 < ... < tk`, the indicator
11-
transform converts a continuous variable `Z` into a sequence of `k` variables
12-
`Z_1 = Z <= t1`, `Z_2 = Z <= t2`, ..., `Z_k = Z <= tk`.
10+
The threshold values are a function of the `scale` option, which can be:
1311
14-
## Scales:
12+
* `:quantile` - thresholds are calculated using `quantile`s
13+
* `:linear` - thresholds are calculated using direct values
1514
16-
* `:quantile` - threshold values are calculated using the `quantile(Z, p)` function
17-
with a linear range of probabilities.
18-
* `:linear` - threshold values are calculated using a linear range.
15+
The `categ` option can be used to enforce binary categorical values
16+
instead of raw `1` and `0` integer values.
1917
2018
## Examples
2119

src/transforms/lowhigh.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55
"""
66
LowHigh(; low=0.25, high=0.75)
77
8-
Applies the LowHigh transform to all columns of the table.
9-
The LowHigh transform of the column `x` is defined by `(x .- xl) ./ (xh - xl)`,
8+
Transforms a column `x` into `(x .- xl) ./ (xh - xl)`,
109
where `xl = quantile(x, low)` and `xh = quantile(x, high)`.
1110
1211
LowHigh(col₁, col₂, ..., colₙ; low=0.25, high=0.75)
1312
LowHigh([col₁, col₂, ..., colₙ]; low=0.25, high=0.75)
1413
LowHigh((col₁, col₂, ..., colₙ); low=0.25, high=0.75)
1514
16-
Applies the LowHigh transform on columns `col₁`, `col₂`, ..., `colₙ`.
15+
Applies the transform to columns `col₁`, `col₂`, ..., `colₙ`.
1716
1817
LowHigh(regex; low=0.25, high=0.75)
1918
20-
Applies the LowHigh transform on columns that match with `regex`.
19+
Applies the transform to columns that match with `regex`.
2120
2221
## Examples
2322

0 commit comments

Comments
 (0)