Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rounding errors #32

Open
LilithHafner opened this issue Dec 17, 2024 · 0 comments
Open

Rounding errors #32

LilithHafner opened this issue Dec 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@LilithHafner
Copy link
Collaborator

(@DDS) pkg> up
    Updating registry at `~/.julia/registries/General.toml`
    Updating git-repo `https://github.com/Tortar/DynamicSampling.jl`
  No Changes to `~/.julia/environments/DDS/Project.toml`
  No Changes to `~/.julia/environments/DDS/Manifest.toml`

(@DDS) pkg> st
Status `~/.julia/environments/DDS/Project.toml`
  [2083aeaf] DynamicSampling v0.4.7 `https://github.com/Tortar/DynamicSampling.jl#main`

julia> using DynamicSampling

julia> ds = DynamicSampler()
DynamicSampler(Tuple{Int64, Float64}[])

julia> push!(ds, 1, .9)
DynamicSampler([(1, 0.9)])

julia> push!(ds, 2, 1.0)
DynamicSampler([(1, 0.9), (2, 1.0)])

julia> push!(ds, 3, 1e100)
DynamicSampler([(1, 0.9), (2, 1.0), (3, 1.0e100)])

julia> delete!(ds, 3)
DynamicSampler([(1, 0.9), (2, 1.0)])

julia> unique(rand(ds) for _ in 1:100)
1-element Vector{Int64}:
 2

In a hundred samples, we should certainly (p > 1-10^-22) see at least one 1. The issue is in tracking total weight:

julia> ds.info.totweight, ds.info.toterror
(0.0, 0.0)
@LilithHafner LilithHafner added the bug Something isn't working label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant