arviz-devs / ArviZ.jl
1
@forwardplotfun plot_autocorr
2
@forwardplotfun plot_bpv
3
@forwardplotfun plot_compare
4
@forwardplotfun plot_density
5
@forwardplotfun plot_dist
6
@forwardplotfun plot_dist_comparison
7
@forwardplotfun plot_elpd
8
@forwardplotfun plot_energy
9
@forwardplotfun plot_ess
10
@forwardplotfun plot_forest
11
@forwardplotfun plot_hdi
12
@forwardplotfun plot_kde
13
@forwardplotfun plot_khat
14
@forwardplotfun plot_loo_pit
15
@forwardplotfun plot_mcse
16
@forwardplotfun plot_pair
17
@forwardplotfun plot_parallel
18
@forwardplotfun plot_posterior
19
@forwardplotfun plot_ppc
20
@forwardplotfun plot_rank
21
@forwardplotfun plot_separation
22
@forwardplotfun plot_trace
23
@forwardplotfun plot_violin
24

25
@deprecate plot_hpd(args...; kwargs...) plot_hdi(args...; kwargs...)
26
@deprecate plot_joint(args...; kwargs...) plot_pair(args...; kwargs...)
27

28
function convert_arguments(::typeof(plot_compare), df, args...; kwargs...)
29 20
    pdf = topandas(Val(:DataFrame), df; index_name=:name)
30 20
    return tuple(pdf, args...), kwargs
31
end
32

33
function convert_arguments(::typeof(plot_elpd), data, args...; kwargs...)
34 20
    dict = Dict(k => try
35 20
        topandas(Val(:ELPDData), v)
36
    catch
37 20
        convert_to_inference_data(v)
38
    end for (k, v) in pairs(data))
39 20
    return tuple(dict, args...), kwargs
40
end
41
function convert_arguments(::typeof(plot_khat), df, args...; kwargs...)
42 20
    return tuple(topandas(Val(:ELPDData), df), args...), kwargs
43
end
44

45
for f in (
46
    :plot_autocorr,
47
    :plot_ess,
48
    :plot_mcse,
49
    :plot_pair,
50
    :plot_parallel,
51
    :plot_posterior,
52
    :plot_trace,
53
    :plot_violin,
54
)
55
    @eval begin
56
        function convert_arguments(::typeof($(f)), data, args...; kwargs...)
57 20
            idata = convert_to_inference_data(data; group=:posterior)
58 20
            return tuple(idata, args...), kwargs
59
        end
60
    end
61
end
62

63
for f in (:plot_autocorr, :plot_ess, :plot_mcse, :plot_posterior, :plot_violin)
64
    @eval begin
65
        function convert_arguments(::typeof($(f)), data::AbstractArray, args...; kwargs...)
66 20
            return tuple(data, args...), kwargs
67
        end
68
    end
69
end
70

71
function convert_arguments(::typeof(plot_energy), data, args...; kwargs...)
72 20
    dataset = convert_to_dataset(data; group=:sample_stats)
73 20
    return tuple(dataset, args...), kwargs
74
end
75

76
for f in (:plot_density, :plot_forest, :plot_rank)
77
    @eval begin
78
        function convert_arguments(
79
            ::typeof($(f)), data, args...; transform=identity, group=:posterior, kwargs...
80
        )
81 20
            tdata = transform(data)
82 20
            dataset = convert_to_dataset(tdata; group=group)
83 20
            return tuple(dataset, args...), kwargs
84
        end
85
    end
86
end
87

88
for f in (:plot_density, :plot_forest)
89
    @eval begin
90
        function convert_arguments(
91
            ::typeof($(f)),
92
            data::Union{AbstractVector,Tuple},
93
            transform=identity,
94
            group=:posterior,
95
            args...;
96
            kwargs...,
97
        )
98 20
            tdata = transform(data)
99 20
            datasets = map(tdata) do datum
100
                return convert_to_dataset(datum; group=group)
101
            end
102 20
            return tuple(datasets, args...), kwargs
103
        end
104
        function convert_arguments(
105
            ::typeof($(f)),
106
            data::AbstractVector{<:Real},
107
            transform=identity,
108
            group=:posterior,
109
            args...;
110
            kwargs...,
111
        )
112 20
            tdata = transform(data)
113 20
            dataset = convert_to_dataset(tdata; group=group)
114 20
            return tuple(dataset, args...), kwargs
115
        end
116
    end
117
end

Read our documentation on viewing source code .

Loading