Skip to content

Commit

Permalink
Update compat entries
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkobunse committed Jan 5, 2023
1 parent 1903a23 commit 0fe0b54
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
[compat]
Discretizers = "3.2"
Optim = "0.22, 1"
Polynomials = "1.1"
PyCall = "1.92"
Polynomials = "1.1 - 3.1"
PyCall = "1.92 - 1.94"
Reexport = "0.2, 1"
ScikitLearn = "0.6"
ScikitLearnBase = "0.5"
Expand Down
10 changes: 5 additions & 5 deletions src/DeconvUtil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export
reduce,
train_and_predict_proba

"""
"""
fit_pdf(x[, bins]; normalize=true, laplace=false)
Obtain the discrete pdf of the integer array `x`, optionally specifying the array of `bins`.
Expand Down Expand Up @@ -124,7 +124,7 @@ normalizepdf(a::AbstractVector...; kwargs...) =
function normalizepdf!(a::AbstractVector...; warn::Bool=true)
arrs = [ a... ] # convert tuple to array
single = length(a) == 1 # normalization of single array?

# check for NaNs and Infs
nans = [ any(isnan.(arr)) || any(abs.(arr) .== Inf) for arr in arrs ]
if sum(nans) > 0
Expand All @@ -139,7 +139,7 @@ function normalizepdf!(a::AbstractVector...; warn::Bool=true)
@warn "Normalization set NaNs and Infs in $(sum(nans)) arrays to zero"
end
end

# check for negative values
negs = [ any(arr .< 0) for arr in arrs ]
if sum(negs) > 0
Expand All @@ -153,7 +153,7 @@ function normalizepdf!(a::AbstractVector...; warn::Bool=true)
@warn "Normalization set negative values in $(sum(negs)) arrays to zero"
end
end

# check for zero sums
sums = map(sum, arrs)
zers = map(iszero, sums)
Expand All @@ -168,7 +168,7 @@ function normalizepdf!(a::AbstractVector...; warn::Bool=true)
@warn "Normalization replaced $(sum(zers)) zero vectors by uniform densities"
end
end

# normalize (narrs array is created before assignment for cases where the same array is in arrs multiple times)
narrs = [ zers[i] ? arrs[i] : arrs[i] ./ sums[i] for i in 1:length(arrs) ]
for i in findall(.!(zers))
Expand Down

0 comments on commit 0fe0b54

Please sign in to comment.