Code Monkey home page Code Monkey logo

Comments (3)

milankl avatar milankl commented on July 25, 2024

No, the argument is correctly passed on (this happens through ;kwargs... which just takes all keyword argument and so kwargs can be passed on to functions inside functions).

julia> using BitInformation
julia> a = rand(Float32,100)
julia> bitinformation(a,set_zero_insignificant=true)
32-element Vector{Float64}:
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 
 0.0

julia> bitinformation(a,set_zero_insignificant=false)
32-element Vector{Float64}:
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0040017578752447125
 0.00762811148439329
 0.004276987851521523
 0.00023748155804284116
 
 0.007157098012580706
 0.00791399692709715
 0.00480941092599706
 0.002926451394794344
 0.008214283901808138
 0.005549176061803784
 0.00359966561437504
 0.017224936442887365
 0.0059782906996011615

julia> bitinformation(a,set_zero_insignificant=false,masked_value=NaN32)
32-element Vector{Float64}:
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0038971829878380847
 0.005576694247738862
 0.005576694247738862
 0.0005831180658698092
 
 0.0059096798906598975
 0.006578377952308912
 0.003943640725332606
 0.004330712596832224
 0.006655303074143492
 0.004283055423926335
 0.002705618353765177
 0.018927358053287838
 0.006400338428602179

but as you can see the results are not exactly the same, the reason is that to avoid counting information across array bounds currently always the last element in every dimension is masked.

mask[n:n:end] .= true

So as long as you have large datasets all good, but you are right, maybe this should be done differently. Quick check, if you add one more element to your example you'll actually get the same result

julia> bitinformation(Float32[1,2,3,4,5], set_zero_insignificant=false, masked_value=NaN32)
32-element Vector{Float64}:
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.25162916738782287
 0.25162916738782287
 

from bitinformation.jl.

milankl avatar milankl commented on July 25, 2024

Just changed the title of this issue because this is really what this is about: Counting information across array bounds is like periodic boundary conditions, if you mask the last element then its like closed boundaries...

from bitinformation.jl.

observingClouds avatar observingClouds commented on July 25, 2024

Alright, thanks for the clarification!

from bitinformation.jl.

Related Issues (16)

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.