Skip to content

Commit

Permalink
Merge 092a20e into d5e6fbc
Browse files Browse the repository at this point in the history
  • Loading branch information
kleinschmidt committed Mar 2, 2020
2 parents d5e6fbc + 092a20e commit 135941b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
@@ -1,7 +1,7 @@
name = "StatsBase"
uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
authors = ["JuliaStats"]
version = "0.32.1"
version = "0.32.2"

[deps]
DataAPI = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a"
Expand Down
8 changes: 8 additions & 0 deletions src/transformations.jl
Expand Up @@ -62,6 +62,11 @@ struct ZScoreTransform{T<:Real} <: AbstractDataTransform
lens == l || lens == 0 || throw(DimensionMismatch("Inconsistent dimensions."))
new{T}(l, dims, m, s)
end

function ZScoreTransform(l::Int, m::Vector{T}, s::Vector{T}) where T
Base.depwarn("ZScoreTransform(len, m, s) is deprecated: use ZScoreTransform(len, 2, m, s) instead", :ZScoreTransform)
ZScoreTransform(l, 2, m, s)
end
end

function Base.getproperty(t::ZScoreTransform, p::Symbol)
Expand Down Expand Up @@ -118,6 +123,7 @@ function fit(::Type{ZScoreTransform}, X::AbstractMatrix{<:Real};
m, s = mean_and_std(X, 2)
elseif dims === nothing
Base.depwarn("fit(t, x) is deprecated: use fit(t, x, dims=2) instead", :fit)
dims = 2
m, s = mean_and_std(X, 2)
else
throw(DomainError(dims, "fit only accept dims to be 1 or 2."))
Expand All @@ -131,6 +137,7 @@ function fit(::Type{ZScoreTransform}, X::AbstractVector{<:Real};
dims::Union{Integer,Nothing}=nothing, center::Bool=true, scale::Bool=true)
if dims == nothing
Base.depwarn("fit(t, x) is deprecated: use fit(t, x, dims=2) instead", :fit)
dims = 1
elseif dims != 1
throw(DomainError(dims, "fit only accepts dims=1 over a vector. Try fit(t, x, dims=1)."))
end
Expand Down Expand Up @@ -273,6 +280,7 @@ function fit(::Type{UnitRangeTransform}, X::AbstractMatrix{<:Real};
l, tmin, tmax = _compute_extrema(X')
elseif dims == nothing
Base.depwarn("fit(t, x) is deprecated: use fit(t, x, dims=2) instead", :fit)
dims = 2
l, tmin, tmax = _compute_extrema(X')
else
throw(DomainError(dims, "fit only accept dims to be 1 or 2."))
Expand Down

0 comments on commit 135941b

Please sign in to comment.