-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust eweights calculation to avoid precision issues (#509)
* Adjust eweights calculation to avoid precision issues. The modified function is equivalent to dividing all weights by the largest value. ``` julia> x = [ 0.3 0.42857142857142855 0.6122448979591837 0.8746355685131197 1.249479383590171 1.7849705479859588 2.549957925694227 3.642797036706039 5.203995766722913 7.434279666747019 ] 10-element Array{Float64,1}: 0.3 0.42857142857142855 0.6122448979591837 0.8746355685131197 1.249479383590171 1.7849705479859588 2.549957925694227 3.642797036706039 5.203995766722913 7.434279666747019 julia> x ./ last(x) 10-element Array{Float64,1}: 0.04035360699999998 0.057648009999999965 0.08235429999999996 0.11764899999999996 0.16806999999999994 0.24009999999999995 0.34299999999999997 0.49 0.7 1.0 julia> using StatsBase [ Info: Recompiling stale cache file /Users/rory/.julia/compiled/v1.0/StatsBase/EZjIG.ji for StatsBase [2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91] julia> eweights(1:10, 0.3) 10-element Weights{Float64,Float64,Array{Float64,1}}: 0.04035360699999998 0.05764800999999997 0.08235429999999996 0.11764899999999996 0.16806999999999994 0.24009999999999995 0.3429999999999999 0.48999999999999994 0.7 1.0 ``` * Fix eweight tests. * Add a couple links to the docstring. * Address review comments and properly deprecate unscaled behaviour with a `scaled::DepBool` kwarg. * Rename scaled => scale. * Fixup docstring slightly and don't make (t, λ, n) method a public method. * More docstring updates. * Reword `n` explanation * Bump patch release
- Loading branch information
Showing
6 changed files
with
96 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1678fd1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
1678fd1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/49065
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: