@@ -106,10 +106,10 @@ function Base.getproperty(ds::DataStore, s::Symbol)
106106end
107107
108108function Base. setproperty! (ds:: DataStore , s:: Symbol , x)
109- @assert s!= :_n " cannot set _n directly"
110- @assert s!= :_data " cannot set _data directly"
111- if getn (ds) > 0
112- @assert numobs (x)== getn (ds) " expected (numobs(x) == getn(ds)) but got $(numobs (x)) != $(getn (ds)) "
109+ @assert s != :_n " cannot set _n directly"
110+ @assert s != :_data " cannot set _data directly"
111+ if getn (ds) >= 0
112+ @assert numobs (x) == getn (ds) " expected (numobs(x) == getn(ds)) but got $(numobs (x)) != $(getn (ds)) "
113113 end
114114 return getdata (ds)[s] = x
115115end
@@ -164,7 +164,7 @@ function MLUtils.getobs(ds::DataStore,
164164 i:: AbstractVector{T} ) where {T <: Union{Integer, Bool} }
165165 newdata = getobs (getdata (ds), i)
166166 n = getn (ds)
167- if n > - 1
167+ if n >= 0
168168 if length (ds) > 0
169169 n = numobs (newdata)
170170 else
@@ -180,14 +180,14 @@ end
180180
181181function cat_features (ds1:: DataStore , ds2:: DataStore )
182182 n1, n2 = getn (ds1), getn (ds2)
183- n1 = n1 > 0 ? n1 : 1
184- n2 = n2 > 0 ? n2 : 1
183+ n1 = n1 >= 0 ? n1 : 1
184+ n2 = n2 >= 0 ? n2 : 1
185185 return DataStore (n1 + n2, cat_features (getdata (ds1), getdata (ds2)))
186186end
187187
188188function cat_features (dss:: AbstractVector{DataStore} ; kws... )
189189 ns = getn .(dss)
190- ns = map (n -> n > 0 ? n : 1 , ns)
190+ ns = map (n -> n >= 0 ? n : 1 , ns)
191191 return DataStore (sum (ns), cat_features (getdata .(dss); kws... ))
192192end
193193
0 commit comments