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

Refactor to support new diagnostics #62

Draft
wants to merge 32 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
88f5f71
Implement all Pareto diagnostics
sethaxen Dec 26, 2023
3ff48a4
Add standalone `pareto_diagnose` method
sethaxen Dec 26, 2023
50c0d2d
Remove dead code branches
sethaxen Dec 28, 2023
00514ef
Add h-specific pareto diagnose
sethaxen Dec 28, 2023
4b648e2
Run formatter
sethaxen Dec 28, 2023
a3cfa6e
Add object for storing Pareto diagnostics
sethaxen Jan 9, 2024
4be297a
Move methods
sethaxen Jan 9, 2024
a942492
Move tails functionality to own file
sethaxen Jan 9, 2024
bf8668c
Add utilities for computing expectands
sethaxen Jan 9, 2024
b1fc725
Update pareto_diagnose
sethaxen Jan 9, 2024
e1df148
Add pareto_smooth
sethaxen Jan 9, 2024
a8330da
Update psis to wrap pareto_smooth
sethaxen Jan 9, 2024
8d5ddc2
Update exports
sethaxen Jan 9, 2024
a3bb7d2
Refactor ess_is to use S-specific khat threshold
sethaxen Jan 9, 2024
937d0ae
Add Compat as dependency
sethaxen Jan 9, 2024
f5d0660
Document shape intervals
sethaxen Jan 9, 2024
a7f7722
Remove old diagnostic docs
sethaxen Jan 9, 2024
9620750
Remove PSISResult properties
sethaxen Jan 9, 2024
239c35c
Update ess_is
sethaxen Jan 9, 2024
8cf2954
Add param_sizes utility
sethaxen Jan 9, 2024
cd2dbd9
Update paretoshapeplot
sethaxen Jan 9, 2024
77a5983
Remove properties accessors
sethaxen Jan 9, 2024
7df6efe
Fix bug
sethaxen Jan 9, 2024
93abf46
Run formatter
sethaxen Jan 9, 2024
e603f57
Preserve older table formatting
sethaxen Jan 9, 2024
9a5fef7
Update docstring
sethaxen Jan 9, 2024
9a54cde
Overload pareto shape accessor
sethaxen Jan 9, 2024
54efca0
Make ESS column elements flush on the right
sethaxen Jan 9, 2024
4c739df
Update PSISResult tests
sethaxen Jan 9, 2024
58df0e7
Merge branch 'main' into refactor
sethaxen Aug 22, 2024
4cefc3c
Merge branch 'refactor' of https://github.com/arviz-devs/PSIS.jl into…
sethaxen Aug 22, 2024
8df64f6
Fix errors for older Julia versions
sethaxen Aug 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,40 @@ authors = ["Seth Axen <[email protected]> and contributors"]
version = "0.9.4"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[weakdeps]
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"

[extensions]
PSISStatsBaseExt = ["StatsBase"]

[compat]
Compat = "3, 4"
DimensionalData = "0.24"
Distributions = "0.25.81"
DocStringExtensions = "0.9"
IntervalSets = "0.7"
JLD2 = "0.4"
LinearAlgebra = "1.6"
LogExpFunctions = "0.2.0, 0.3"
Plots = "1"
PrettyTables = "2"
Printf = "1.6"
RecipesBase = "1"
ReferenceTests = "0.9, 0.10"
Requires = "1"
Statistics = "1.6"
StatsBase = "0.32, 0.33, 0.34"
julia = "1.6"

[extras]
Expand All @@ -31,6 +48,7 @@ Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
Expand Down
12 changes: 12 additions & 0 deletions ext/PSISStatsBaseExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module PSISStatsBaseExt

using PSIS, StatsBase

PSIS._max_moment_required(::typeof(StatsBase.skewness)) = 3
PSIS._max_moment_required(::typeof(StatsBase.kurtosis)) = 4
PSIS._max_moment_required(f::Base.Fix2{typeof(StatsBase.moment),<:Integer}) = f.x
# the pth cumulant is a polynomial of degree p in the moments
PSIS._max_moment_required(f::Base.Fix2{typeof(StatsBase.cumulant),<:Integer}) = f.x
PSIS._max_moment_required(::Base.Fix2{typeof(StatsBase.percentile),<:Real}) = 0

end # module
22 changes: 20 additions & 2 deletions src/PSIS.jl
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
module PSIS

using DocStringExtensions: FIELDS
using IntervalSets: IntervalSets
using LogExpFunctions: LogExpFunctions
using PrettyTables: PrettyTables
using Printf: @sprintf
using Statistics: Statistics

export PSISPlots
export PSISResult
export psis, psis!, ess_is
export ParetoDiagnostics, PSISResult
export pareto_diagnose, pareto_smooth, psis, psis!
export check_pareto_diagnostics, ess_is

include("utils.jl")
include("generalized_pareto.jl")
include("tails.jl")
include("expectand.jl")
include("diagnostics.jl")
include("pareto_diagnose.jl")
include("pareto_smooth.jl")
include("core.jl")
include("ess.jl")
include("recipes/plots.jl")

@static if !isdefined(Base, :get_extension)
using Requires: @require
function __init__()
@require StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" begin
include("../ext/PSISStatsBaseExt.jl")
end
end
end

end
Loading
Loading