@@ -112,56 +112,6 @@ function decompose(X, v, _targets::NTuple)
112112 return swapdims (A, v), collect (names), swapdims (B, v)
113113end
114114
115- """
116- classes(x)
117-
118- *Private method.*
119-
120- Return, as a `CategoricalVector`, all the categorical elements with
121- the same pool as `CategoricalValue` `x` (including `x`), with an
122- ordering consistent with the pool. Note that `x in classes(x)` is
123- always true.
124-
125- Not to be confused with `levels(x.pool)`. See the example below.
126-
127- Also, overloaded for `x` a `CategoricalArray`, `CategoricalPool`, and for views of
128- `CategoricalArray`.
129-
130- julia> v = categorical(['c', 'b', 'c', 'a'])
131- 4-element CategoricalArrays.CategoricalArray{Char,1,UInt32}:
132- 'c'
133- 'b'
134- 'c'
135- 'a'
136-
137- julia> levels(v)
138- 3-element Array{Char,1}:
139- 'a'
140- 'b'
141- 'c'
142-
143- julia> x = v[4]
144- CategoricalArrays.CategoricalValue{Char,UInt32} 'a'
145-
146- julia> classes(x)
147- 3-element CategoricalArrays.CategoricalArray{Char,1,UInt32}:
148- 'a'
149- 'b'
150- 'c'
151-
152- julia> levels(x.pool)
153- 3-element Array{Char,1}:
154- 'a'
155- 'b'
156- 'c'
157-
158- """
159- classes (p:: CategoricalArrays.CategoricalPool ) = [p[i] for i in 1 : length (p)]
160- classes (x:: CategoricalArrays.CategoricalValue ) = classes (CategoricalArrays. pool (x))
161- classes (v:: CategoricalArrays.CategoricalArray ) = classes (CategoricalArrays. pool (v))
162- classes (v:: SubArray{<:Any, <:Any, <:CategoricalArrays.CategoricalArray} ) = classes (parent (v))
163-
164-
165115struct CategoricalDecoder{V,R}
166116 classes:: CategoricalArrays.CategoricalVector {
167117 V,
@@ -193,7 +143,7 @@ pool as `x`.
193143*Warning:* There is no guarantee that `levelcode.(d.(u)) == u` will always holds.
194144
195145"""
196- decoder (x) = CategoricalDecoder (classes (x))
146+ decoder (x) = CategoricalDecoder (CategoricalArrays . levels (x))
197147
198148(d:: CategoricalDecoder{V,R} )(i:: Integer ) where {V,R} =
199149 CategoricalArrays. CategoricalValue {V,R} (d. classes[i])
0 commit comments