@@ -104,7 +104,7 @@ Base.argmax(x::OneHotLike; dims = Colon()) =
104
104
105
105
Return a `OneHotVector` which is roughly a sparse representation of `x .== labels`.
106
106
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
108
108
of `x` in `labels`. If `x` is not found in labels, then it either returns `onehot(default, labels)`,
109
109
or gives an error if no default is given.
110
110
@@ -145,13 +145,14 @@ end
145
145
onehotbatch(xs, labels, [default])
146
146
147
147
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.
149
150
150
151
If one of the inputs in `xs` is not found in `labels`, that column is `onehot(default, labels)`
151
152
if `default` is given, else an error.
152
153
153
154
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,
155
156
i.e. `result[:, k...] == onehot(xs[k...], labels)`.
156
157
157
158
# Examples
@@ -176,11 +177,12 @@ onehotbatch(ls, labels, default...) = batch([onehot(l, labels, default...) for l
176
177
"""
177
178
onecold(y, [labels])
178
179
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`.
181
183
182
184
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.
184
186
185
187
# Examples
186
188
```jldoctest
0 commit comments