-
Notifications
You must be signed in to change notification settings - Fork 17
/
Omega.jl
190 lines (162 loc) · 3.49 KB
/
Omega.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# __precompile__(false)
"A Library for Causal and Higher-Order Probabilistic Programming"
module Omega
using Flux
using Spec
using UnicodePlots
import Random
import Random: GLOBAL_RNG, AbstractRNG
import Statistics: mean, var, quantile
# Util
include("util/Util.jl")
using .Util
export ntranspose
# Core
include("space/Space.jl") # UIDs
using .Space
export Ω, uid, @id, SimpleΩ
# RandVar
include("randvar/randvar.jl" ) # Random variables
include("randvar/urandvar.jl") # Random variables
include("randvar/randvarapply.jl") # Random variable application to ω::Ω
include("randvar/ciid.jl") # Conditionally i.i.d. RandVars
include("randvar/elemtype.jl") # Infer Element Type
export RandVar, MaybeRV, ciid, isconstant, elemtype, params
# Conditioning
include("cond.jl") # Conditioning
export cond
# Lifted random variable operatiosn
include("lift/containers.jl") # Array/Tuple primitives
export randarray, randtuple
# Higher-Order Inference
include("higher/Higher.jl")
using .Higher
export rcd, rid, ∥
# Lifting functions to RandVar domain
include("lift/lift.jl")
export @lift, lift
# Soft Inference
include("soft/kernels.jl") # Kernels
include("soft/soft.jl") # Soft logic
include("soft/trackerror.jl") # Tracking error
export SoftBool,
softeq,
softlt,
softgt,
≊,
⪆,
⪅,
>ₛ,
>=ₛ,
<=ₛ,
<ₛ,
==ₛ,
# Kernels
kse,
kseα,
kf1,
kf1β,
withkernel,
indomain,
applywoerror,
trackerrorapply
# Gradient
include("gradient.jl")
export gradient
# Inference Algorithms
include("inference/Inference.jl")
using .Inference
export isapproximate,
RejectionSample,
MI,
SSMH,
HMC,
# SGHMC,
HMCFAST,
RejectionSampleAlg,
MIAlg,
SSMHAlg,
HMCAlg,
# SGHMCAlg,
HMCFASTAlg,
defalg,
defcb,
defΩ,
defΩProj,
everyn,
→,
idcb,
throttle,
plotrv,
plotscalar,
default_cbs,
Inside,
Outside,
default_cbs_tpl,
default_cbs
# Causal Inference
include("causal/Causal.jl")
using .Causal
export replace
# Library
include("primitive/Prim.jl")
using .Prim
export bernoulli,
betarv,
β,
categorical,
# dirichlet,
exponential,
gammarv,
Γ,
invgamma,
kumaraswamy,
logistic,
# mvnormal,
normal,
poisson,
rademacher,
uniform
export succprob,
failprob,
maximum,
minimum,
islowerbounded,
isupperbounded,
isbounded,
std,
median,
mode,
modes,
skewness,
kurtosis,
isplatykurtic,
ismesokurtic,
isleptokurtic,
entropy,
mean,
prob,
lprob
# Lifted distributional functions
export lsuccprob,
lfailprob,
lmaximum,
lminimum,
lislowerbounded,
lisupperbounded,
lisbounded,
lstd,
lmedian,
lmode,
lmodes,
lskewness,
lkurtosis,
lisplatykurtic,
lismesokurtic,
lisleptokurtic,
lentropy,
lmean
# Neural Network Stuff
include("flux.jl")
export Dense
end