@@ -108,6 +108,10 @@ julia> StatsBase.transform(dt, X)
108108"""
109109function fit (:: Type{ZScoreTransform} , X:: AbstractMatrix{<:Real} ;
110110 dims:: Union{Integer,Nothing} = nothing , center:: Bool = true , scale:: Bool = true )
111+ if dims === nothing
112+ Base. depwarn (" fit(t, x) is deprecated: use fit(t, x, dims=2) instead" , :fit )
113+ dims = 2
114+ end
111115 if dims == 1
112116 n, l = size (X)
113117 n >= 2 || error (" X must contain at least two rows." )
@@ -116,9 +120,6 @@ function fit(::Type{ZScoreTransform}, X::AbstractMatrix{<:Real};
116120 l, n = size (X)
117121 n >= 2 || error (" X must contain at least two columns." )
118122 m, s = mean_and_std (X, 2 )
119- elseif dims === nothing
120- Base. depwarn (" fit(t, x) is deprecated: use fit(t, x, dims=2) instead" , :fit )
121- m, s = mean_and_std (X, 2 )
122123 else
123124 throw (DomainError (dims, " fit only accept dims to be 1 or 2." ))
124125 end
@@ -128,10 +129,8 @@ function fit(::Type{ZScoreTransform}, X::AbstractMatrix{<:Real};
128129end
129130
130131function fit (:: Type{ZScoreTransform} , X:: AbstractVector{<:Real} ;
131- dims:: Union{Integer,Nothing} = nothing , center:: Bool = true , scale:: Bool = true )
132- if dims == nothing
133- Base. depwarn (" fit(t, x) is deprecated: use fit(t, x, dims=2) instead" , :fit )
134- elseif dims != 1
132+ dims:: Integer = 1 , center:: Bool = true , scale:: Bool = true )
133+ if dims != 1
135134 throw (DomainError (dims, " fit only accepts dims=1 over a vector. Try fit(t, x, dims=1)." ))
136135 end
137136
@@ -267,13 +266,14 @@ julia> StatsBase.transform(dt, X)
267266"""
268267function fit (:: Type{UnitRangeTransform} , X:: AbstractMatrix{<:Real} ;
269268 dims:: Union{Integer,Nothing} = nothing , unit:: Bool = true )
269+ if dims === nothing
270+ Base. depwarn (" fit(t, x) is deprecated: use fit(t, x, dims=2) instead" , :fit )
271+ dims = 2
272+ end
270273 if dims == 1
271274 l, tmin, tmax = _compute_extrema (X)
272275 elseif dims == 2
273276 l, tmin, tmax = _compute_extrema (X' )
274- elseif dims == nothing
275- Base. depwarn (" fit(t, x) is deprecated: use fit(t, x, dims=2) instead" , :fit )
276- l, tmin, tmax = _compute_extrema (X' )
277277 else
278278 throw (DomainError (dims, " fit only accept dims to be 1 or 2." ))
279279 end
@@ -301,7 +301,7 @@ function _compute_extrema(X::AbstractMatrix{<:Real})
301301end
302302
303303function fit (:: Type{UnitRangeTransform} , X:: AbstractVector{<:Real} ;
304- dims:: Union{ Integer,Nothing} = nothing , unit:: Bool = true )
304+ dims:: Integer = 1 , unit:: Bool = true )
305305 if dims != 1
306306 throw (DomainError (dims, " fit only accept dims=1 over a vector. Try fit(t, x, dims=1)." ))
307307 end
0 commit comments