Giter Club home page Giter Club logo

bayeshistogram.jl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bayeshistogram.jl's Issues

supoprt `weight`?

Still reading the paper and I'm wondering how does weights work with this algorithm, for two reasons:

  • The data in HEP has weights (so I assume the paper address it some how)
  • I want to use this algorithm for re-binning rather than just binning on raw data

elaborate the point 2 a bit, often the raw data is >> RAM, the best I can do is to first make a really fine-binning histogram, then re-bin it

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

indexing off by 1

julia> BayesHistogram.bayesian_blocks(rand(1000); weights=randn(1000)).edges
ERROR: BoundsError: attempt to access 1001-element Vector{Float64} at index [[0, 1001]]
Stacktrace:
 [1] throw_boundserror(A::Vector{Float64}, I::Tuple{Vector{Int64}})
   @ Base ./abstractarray.jl:703
 [2] checkbounds
   @ ./abstractarray.jl:668 [inlined]
 [3] _getindex
   @ ./multidimensional.jl:874 [inlined]
 [4] getindex
   @ ./abstractarray.jl:1241 [inlined]
 [5] bayesian_blocks(t::Vector{Float64}; weights::Vector{Float64}, prior::Pearson{Float64}, resolution::Float64, min_counts::Int64)
   @ BayesHistogram ~/.julia/packages/BayesHistogram/V6yoj/src/BayesHistogram.jl:144
 [6] top-level scope
   @ REPL[20]:1

Disagreement with respect to scikit-hep implementation

julia> using NPZ

julia> npzread("./data_gen.npz")
Dict{String, Vector{Float64}} with 2 entries:
  "weights" => [1.03524, 1.59065, 1.92159, 1.7245, 1.25175, 1.1111, 1.0
  "data"    => [-1.13384, 0.384319, 1.49655, -0.355382, -0.787534, -0.4

julia> datas = npzread("./data_gen.npz");

julia> answers = npzread("./answers_bayesian_blocks.npz");

julia> bayesian_blocks(datas["data"]).edges
8-element Vector{Float64}:
 -3.154662950679158
 -2.126058692427544
 -1.5407490071030014
 -0.7146943329219142
  0.6404466881064395
  1.3817680464742417
  2.1781371551736664
  3.265843988558946

julia> answers["be1"]
9-element Vector{Float64}:
 -3.154662950679158
 -2.366746726914241
 -1.8916975822891833
 -1.2379204553303205
 -0.7146943329219142
  0.6404466881064395
  1.3817680464742417
  2.2181565018686125
  3.265843988558946

to make the data

import numpy as np
np.random.seed(111)
data1 = np.random.normal(size=1000)
data2 = np.random.normal(2, 1, size=1000)
weights = np.random.uniform(1, 2, size=1000)
np.savez("data_gen.npz", data=data1, weights=weights)

here's the output:
data_gen.npz.txt
answers_bayesian_blocks.npz

need handle integers

In [22]: modeling.bayesian_blocks(np.ceil(np.random.randn(1000) * 100))
Out[22]:
array([-284. , -211. , -131.5,  -90.5,   67.5,  131.5,  176.5,  259.5,
        326. ])

(I will make a PR)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.