Skip to content

Commit 5a4b2cb

Browse files
committed
tweaks & typos
1 parent 4e92c28 commit 5a4b2cb

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/onehot.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Base.argmax(x::OneHotLike; dims = Colon()) =
104104
105105
Return a `OneHotVector` which is roughly a sparse representation of `x .== labels`.
106106
107-
Instead of storing say `Vector{Bool}`, it stores the index of the first occourence
107+
Instead of storing say `Vector{Bool}`, it stores the index of the first occurrence
108108
of `x` in `labels`. If `x` is not found in labels, then it either returns `onehot(default, labels)`,
109109
or gives an error if no default is given.
110110
@@ -145,13 +145,14 @@ end
145145
onehotbatch(xs, labels, [default])
146146
147147
Returns a `OneHotMatrix` where `k`th column of the matrix is [`onehot(xs[k], labels)`](@ref onehot).
148-
This is a sparse matrix, which stores just a `Vector{UInt32}` containing the indices.
148+
This is a sparse matrix, which stores just a `Vector{UInt32}` containing the indices of the
149+
nonzero elements.
149150
150151
If one of the inputs in `xs` is not found in `labels`, that column is `onehot(default, labels)`
151152
if `default` is given, else an error.
152153
153154
If `xs` has more dimensions, `M = ndims(xs) > 1`, then the result is an
154-
`AbstractArray{Bool, N+1}` which is one-hot along the first dimension,
155+
`AbstractArray{Bool, M+1}` which is one-hot along the first dimension,
155156
i.e. `result[:, k...] == onehot(xs[k...], labels)`.
156157
157158
# Examples
@@ -176,11 +177,12 @@ onehotbatch(ls, labels, default...) = batch([onehot(l, labels, default...) for l
176177
"""
177178
onecold(y, [labels])
178179
179-
Roughly the inverse operation of [`onehot`](@ref): Finds the index of
180-
the largest element of `y`, or each column of `y`, and looks them up in `labels`.
180+
Roughly the inverse operation of [`onehot`](@ref) or [`onehotbatch`](@ref):
181+
This finds the index of the largest element of `y`, or each column of `y`,
182+
and looks them up in `labels`.
181183
182184
If `labels` are not specified, the default is integers `1:size(y,1)` --
183-
the same as `argmax(y, dims=1)` but a different return type.
185+
the same operation as `argmax(y, dims=1)` but sometimes a different return type.
184186
185187
# Examples
186188
```jldoctest

0 commit comments

Comments
 (0)