Skip to content
Snippets Groups Projects
Commit 4dcf4f63 authored by François  LAURENT's avatar François LAURENT
Browse files

reverting previous 2 commits and making capacitysampling behaves as in v0.14...

reverting previous 2 commits and making capacitysampling behaves as in v0.14 (CapacitySampling was introduced in v0.14)
parent 51df68cf
No related branches found
No related tags found
No related merge requests found
Pipeline #112529 passed
......@@ -679,7 +679,9 @@ function sample(f, loader::DataLoader, features=:spine; kwargs...)
end
function sample(file::Formats.PreloadedFile, window, ix::LazyIndex, features; kwargs...)
ix.sampler.rng = Random.seed!(Random.default_rng(), ix.sampler.seed)
if !(ix.sampler isa CapacitySampling)
ix.sampler.rng = Random.seed!(Random.default_rng(), ix.sampler.seed)
end
sample(ix.sampler, file, window, ix.targetcounts[file], features; kwargs...)
end
......@@ -767,11 +769,10 @@ end
presample(_, ::Nothing, _, _, counts) = (0, sum(values(counts)))
presample(_, cumulatedcount, _, _, counts) = (sum(cumulatedcount), sum(values(counts)))
mutable struct CapacitySampling <: RatioBasedSampling
struct CapacitySampling <: RatioBasedSampling
selectors
maxcount::Integer
rng
seed
end
"""
......@@ -788,9 +789,9 @@ function capacitysampling(selectors, maxcount::Integer; seed=nothing, rng=nothin
if isnothing(rng)
rng = Random.default_rng()
end
#Random.seed!(rng, seed)
Random.seed!(rng, seed)
end
LazyIndex(CapacitySampling(asselectors(selectors), maxcount, rng, seed))
LazyIndex(CapacitySampling(asselectors(selectors), maxcount, rng))
end
function capacitysampling(maxcount::Integer; kwargs...)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment