quivers 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- quivers/__init__.py +486 -0
- quivers/categorical/__init__.py +69 -0
- quivers/categorical/adjunctions.py +309 -0
- quivers/categorical/base_change.py +150 -0
- quivers/categorical/functors.py +268 -0
- quivers/categorical/monoidal.py +344 -0
- quivers/categorical/natural_transformations.py +139 -0
- quivers/categorical/traced.py +456 -0
- quivers/continuous/__init__.py +182 -0
- quivers/continuous/boundaries.py +270 -0
- quivers/continuous/families.py +1352 -0
- quivers/continuous/flows.py +389 -0
- quivers/continuous/inline.py +1147 -0
- quivers/continuous/morphisms.py +845 -0
- quivers/continuous/programs.py +667 -0
- quivers/continuous/scan.py +338 -0
- quivers/continuous/spaces.py +329 -0
- quivers/core/__init__.py +97 -0
- quivers/core/_util.py +45 -0
- quivers/core/extra_quantales.py +269 -0
- quivers/core/morphisms.py +743 -0
- quivers/core/objects.py +374 -0
- quivers/core/quantales.py +393 -0
- quivers/core/tensor_ops.py +238 -0
- quivers/dsl/__init__.py +199 -0
- quivers/dsl/ast_nodes.py +1060 -0
- quivers/dsl/compiler.py +1829 -0
- quivers/dsl/examples/bayesian_regression.qvr +41 -0
- quivers/dsl/examples/bidirectional_rnn.qvr +65 -0
- quivers/dsl/examples/ccg.qvr +50 -0
- quivers/dsl/examples/continuous_hmm.qvr +84 -0
- quivers/dsl/examples/custom_rules.qvr +51 -0
- quivers/dsl/examples/elman_rnn.qvr +58 -0
- quivers/dsl/examples/gru.qvr +84 -0
- quivers/dsl/examples/hmm.qvr +74 -0
- quivers/dsl/examples/lstm.qvr +100 -0
- quivers/dsl/examples/mixture_model.qvr +81 -0
- quivers/dsl/examples/multimodal_tlg.qvr +46 -0
- quivers/dsl/examples/pcfg.qvr +53 -0
- quivers/dsl/examples/transformer.qvr +57 -0
- quivers/dsl/examples/type_logical.qvr +52 -0
- quivers/dsl/examples/vae.qvr +70 -0
- quivers/dsl/examples/vanilla_rnn.qvr +60 -0
- quivers/dsl/lexer.py +314 -0
- quivers/dsl/parser.py +1704 -0
- quivers/dsl/pygments_lexer.py +206 -0
- quivers/dsl/tokens.py +138 -0
- quivers/enriched/__init__.py +112 -0
- quivers/enriched/day_convolution.py +237 -0
- quivers/enriched/ends_coends.py +167 -0
- quivers/enriched/kan_extensions.py +313 -0
- quivers/enriched/optics.py +573 -0
- quivers/enriched/profunctors.py +159 -0
- quivers/enriched/weighted_limits.py +469 -0
- quivers/enriched/yoneda.py +319 -0
- quivers/giry.py +7 -0
- quivers/inference/__init__.py +40 -0
- quivers/inference/conditioning.py +80 -0
- quivers/inference/elbo.py +77 -0
- quivers/inference/guide.py +337 -0
- quivers/inference/predictive.py +91 -0
- quivers/inference/svi.py +67 -0
- quivers/inference/trace.py +263 -0
- quivers/monadic/__init__.py +51 -0
- quivers/monadic/algebras.py +420 -0
- quivers/monadic/comonads.py +504 -0
- quivers/monadic/distributive_laws.py +146 -0
- quivers/monadic/monads.py +355 -0
- quivers/program.py +264 -0
- quivers/stochastic/__init__.py +258 -0
- quivers/stochastic/_rule_system.py +258 -0
- quivers/stochastic/categories.py +561 -0
- quivers/stochastic/ccg.py +119 -0
- quivers/stochastic/deduction.py +223 -0
- quivers/stochastic/families.py +314 -0
- quivers/stochastic/giry.py +151 -0
- quivers/stochastic/inside.py +282 -0
- quivers/stochastic/lambek.py +155 -0
- quivers/stochastic/morphisms.py +116 -0
- quivers/stochastic/parsers.py +319 -0
- quivers/stochastic/quantale.py +109 -0
- quivers/stochastic/queries.py +115 -0
- quivers/stochastic/rules.py +195 -0
- quivers/stochastic/schema.py +975 -0
- quivers/stochastic/semiring.py +237 -0
- quivers/stochastic/span.py +449 -0
- quivers/stochastic/transforms.py +350 -0
- quivers-0.1.0.dist-info/METADATA +187 -0
- quivers-0.1.0.dist-info/RECORD +92 -0
- quivers-0.1.0.dist-info/WHEEL +4 -0
- quivers-0.1.0.dist-info/entry_points.txt +2 -0
- quivers-0.1.0.dist-info/licenses/LICENSE +21 -0
quivers/__init__.py
ADDED
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
"""quivers: V-enriched categorical relations as PyTorch tensors.
|
|
2
|
+
|
|
3
|
+
Provides finite sets as categorical objects, V-enriched relations as
|
|
4
|
+
morphisms (tensors with values in a quantale's lattice), and
|
|
5
|
+
parameterized composition via quantale enrichment.
|
|
6
|
+
|
|
7
|
+
Quick start::
|
|
8
|
+
|
|
9
|
+
from quivers import FinSet, morphism, observed, identity, Program
|
|
10
|
+
|
|
11
|
+
X = FinSet("X", 3)
|
|
12
|
+
Y = FinSet("Y", 4)
|
|
13
|
+
Z = FinSet("Z", 2)
|
|
14
|
+
|
|
15
|
+
f = morphism(X, Y) # latent (learnable)
|
|
16
|
+
g = morphism(Y, Z) # latent (learnable)
|
|
17
|
+
h = f >> g # V-enriched composition X -> Z
|
|
18
|
+
|
|
19
|
+
program = Program(h)
|
|
20
|
+
output = program() # tensor of shape (3, 2)
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
__version__ = "0.1.0"
|
|
24
|
+
|
|
25
|
+
from quivers.core.objects import (
|
|
26
|
+
SetObject,
|
|
27
|
+
FinSet,
|
|
28
|
+
ProductSet,
|
|
29
|
+
CoproductSet,
|
|
30
|
+
FreeMonoid,
|
|
31
|
+
Unit,
|
|
32
|
+
)
|
|
33
|
+
from quivers.core.quantales import (
|
|
34
|
+
Quantale,
|
|
35
|
+
ProductFuzzy,
|
|
36
|
+
BooleanQuantale,
|
|
37
|
+
PRODUCT_FUZZY,
|
|
38
|
+
BOOLEAN,
|
|
39
|
+
)
|
|
40
|
+
from quivers.core.morphisms import (
|
|
41
|
+
Morphism,
|
|
42
|
+
ObservedMorphism,
|
|
43
|
+
LatentMorphism,
|
|
44
|
+
ComposedMorphism,
|
|
45
|
+
ProductMorphism,
|
|
46
|
+
MarginalizedMorphism,
|
|
47
|
+
FunctorMorphism,
|
|
48
|
+
morphism,
|
|
49
|
+
observed,
|
|
50
|
+
identity,
|
|
51
|
+
)
|
|
52
|
+
from quivers.categorical.functors import (
|
|
53
|
+
Functor,
|
|
54
|
+
IdentityFunctor,
|
|
55
|
+
ComposedFunctor,
|
|
56
|
+
FreeMonoidFunctor,
|
|
57
|
+
IDENTITY,
|
|
58
|
+
)
|
|
59
|
+
from quivers.program import Program
|
|
60
|
+
from quivers.core.tensor_ops import (
|
|
61
|
+
noisy_or_contract,
|
|
62
|
+
noisy_or_reduce,
|
|
63
|
+
noisy_and_reduce,
|
|
64
|
+
componentwise_lift,
|
|
65
|
+
)
|
|
66
|
+
from quivers.enriched.ends_coends import coend, end
|
|
67
|
+
from quivers.categorical.natural_transformations import (
|
|
68
|
+
NaturalTransformation,
|
|
69
|
+
ComponentwiseNT,
|
|
70
|
+
)
|
|
71
|
+
from quivers.monadic.monads import (
|
|
72
|
+
Monad,
|
|
73
|
+
KleisliCategory,
|
|
74
|
+
FuzzyPowersetMonad,
|
|
75
|
+
FreeMonoidMonad,
|
|
76
|
+
)
|
|
77
|
+
from quivers.categorical.adjunctions import (
|
|
78
|
+
Adjunction,
|
|
79
|
+
ForgetfulFunctor,
|
|
80
|
+
FreeForgetfulAdjunction,
|
|
81
|
+
)
|
|
82
|
+
from quivers.enriched.kan_extensions import (
|
|
83
|
+
ObjectMap,
|
|
84
|
+
Projection,
|
|
85
|
+
Inclusion,
|
|
86
|
+
left_kan,
|
|
87
|
+
right_kan,
|
|
88
|
+
)
|
|
89
|
+
from quivers.enriched.profunctors import Profunctor
|
|
90
|
+
from quivers.categorical.monoidal import (
|
|
91
|
+
MonoidalStructure,
|
|
92
|
+
CartesianMonoidal,
|
|
93
|
+
CoproductMonoidal,
|
|
94
|
+
EmptySet,
|
|
95
|
+
EMPTY,
|
|
96
|
+
)
|
|
97
|
+
from quivers.categorical.base_change import (
|
|
98
|
+
BaseChange,
|
|
99
|
+
BoolToFuzzy,
|
|
100
|
+
FuzzyToBool,
|
|
101
|
+
)
|
|
102
|
+
from quivers.monadic.distributive_laws import (
|
|
103
|
+
DistributiveLaw,
|
|
104
|
+
FreeMonoidPowersetLaw,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
# -- new extensions --
|
|
108
|
+
|
|
109
|
+
from quivers.monadic.comonads import (
|
|
110
|
+
Comonad,
|
|
111
|
+
CoKleisliCategory,
|
|
112
|
+
DiagonalComonad,
|
|
113
|
+
CofreeComonad,
|
|
114
|
+
)
|
|
115
|
+
from quivers.monadic.algebras import (
|
|
116
|
+
Algebra,
|
|
117
|
+
FreeAlgebra,
|
|
118
|
+
ObservedAlgebra,
|
|
119
|
+
Coalgebra,
|
|
120
|
+
CofreeCoalgebra,
|
|
121
|
+
ObservedCoalgebra,
|
|
122
|
+
EilenbergMooreCategory,
|
|
123
|
+
)
|
|
124
|
+
from quivers.enriched.weighted_limits import (
|
|
125
|
+
Weight,
|
|
126
|
+
Diagram,
|
|
127
|
+
weighted_limit,
|
|
128
|
+
weighted_colimit,
|
|
129
|
+
weighted_limit_morphisms,
|
|
130
|
+
weighted_colimit_morphisms,
|
|
131
|
+
representable_weight,
|
|
132
|
+
terminal_weight,
|
|
133
|
+
)
|
|
134
|
+
from quivers.core.extra_quantales import (
|
|
135
|
+
LukasiewiczQuantale,
|
|
136
|
+
GodelQuantale,
|
|
137
|
+
TropicalQuantale,
|
|
138
|
+
LUKASIEWICZ,
|
|
139
|
+
GODEL,
|
|
140
|
+
TROPICAL,
|
|
141
|
+
)
|
|
142
|
+
from quivers.enriched.yoneda import (
|
|
143
|
+
Presheaf,
|
|
144
|
+
representable_profunctor,
|
|
145
|
+
corepresentable_profunctor,
|
|
146
|
+
yoneda_embedding,
|
|
147
|
+
yoneda_lemma,
|
|
148
|
+
yoneda_density,
|
|
149
|
+
verify_yoneda_fully_faithful,
|
|
150
|
+
)
|
|
151
|
+
from quivers.enriched.day_convolution import (
|
|
152
|
+
day_convolution,
|
|
153
|
+
day_unit,
|
|
154
|
+
day_convolution_profunctors,
|
|
155
|
+
)
|
|
156
|
+
from quivers.enriched.optics import (
|
|
157
|
+
Optic,
|
|
158
|
+
Lens,
|
|
159
|
+
Prism,
|
|
160
|
+
Adapter,
|
|
161
|
+
Grate,
|
|
162
|
+
compose_optics,
|
|
163
|
+
)
|
|
164
|
+
from quivers.categorical.traced import (
|
|
165
|
+
TracedMonoidal,
|
|
166
|
+
CartesianTrace,
|
|
167
|
+
IterativeTrace,
|
|
168
|
+
trace,
|
|
169
|
+
partial_trace,
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
# stochastic (FinStoch / Markov kernels)
|
|
173
|
+
from quivers.stochastic import (
|
|
174
|
+
MarkovQuantale,
|
|
175
|
+
MARKOV,
|
|
176
|
+
StochasticMorphism,
|
|
177
|
+
CategoricalMorphism,
|
|
178
|
+
DiscretizedNormal,
|
|
179
|
+
DiscretizedLogitNormal,
|
|
180
|
+
DiscretizedBeta,
|
|
181
|
+
DiscretizedTruncatedNormal,
|
|
182
|
+
ConditionedMorphism,
|
|
183
|
+
MixtureMorphism,
|
|
184
|
+
FactoredMorphism,
|
|
185
|
+
NormalizedMorphism,
|
|
186
|
+
condition,
|
|
187
|
+
mix,
|
|
188
|
+
factor,
|
|
189
|
+
normalize,
|
|
190
|
+
prob,
|
|
191
|
+
marginal_prob,
|
|
192
|
+
expectation,
|
|
193
|
+
stochastic,
|
|
194
|
+
)
|
|
195
|
+
from quivers.giry import (
|
|
196
|
+
GiryMonad,
|
|
197
|
+
FinStoch,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
# continuous (hybrid discrete-continuous architecture)
|
|
201
|
+
from quivers.continuous import (
|
|
202
|
+
ContinuousSpace,
|
|
203
|
+
Euclidean,
|
|
204
|
+
UnitInterval,
|
|
205
|
+
Simplex,
|
|
206
|
+
PositiveReals,
|
|
207
|
+
ProductSpace,
|
|
208
|
+
ContinuousMorphism,
|
|
209
|
+
SampledComposition,
|
|
210
|
+
ProductContinuousMorphism,
|
|
211
|
+
DiscreteAsContinuous,
|
|
212
|
+
# families — original
|
|
213
|
+
ConditionalNormal,
|
|
214
|
+
ConditionalLogitNormal,
|
|
215
|
+
ConditionalBeta,
|
|
216
|
+
ConditionalTruncatedNormal,
|
|
217
|
+
ConditionalDirichlet,
|
|
218
|
+
# families — loc-scale
|
|
219
|
+
ConditionalCauchy,
|
|
220
|
+
ConditionalLaplace,
|
|
221
|
+
ConditionalGumbel,
|
|
222
|
+
ConditionalLogNormal,
|
|
223
|
+
ConditionalStudentT,
|
|
224
|
+
# families — positive-valued
|
|
225
|
+
ConditionalExponential,
|
|
226
|
+
ConditionalGamma,
|
|
227
|
+
ConditionalChi2,
|
|
228
|
+
ConditionalHalfCauchy,
|
|
229
|
+
ConditionalHalfNormal,
|
|
230
|
+
ConditionalInverseGamma,
|
|
231
|
+
ConditionalWeibull,
|
|
232
|
+
ConditionalPareto,
|
|
233
|
+
# families — (0, 1)-valued
|
|
234
|
+
ConditionalKumaraswamy,
|
|
235
|
+
ConditionalContinuousBernoulli,
|
|
236
|
+
# families — two-df
|
|
237
|
+
ConditionalFisherSnedecor,
|
|
238
|
+
# families — special
|
|
239
|
+
ConditionalUniform,
|
|
240
|
+
# families — multivariate
|
|
241
|
+
ConditionalMultivariateNormal,
|
|
242
|
+
ConditionalLowRankMVN,
|
|
243
|
+
# families — relaxed discrete
|
|
244
|
+
ConditionalRelaxedBernoulli,
|
|
245
|
+
ConditionalRelaxedOneHotCategorical,
|
|
246
|
+
# families — matrix-valued
|
|
247
|
+
ConditionalWishart,
|
|
248
|
+
# families — discrete-valued
|
|
249
|
+
ConditionalBernoulli,
|
|
250
|
+
ConditionalCategorical,
|
|
251
|
+
# monadic programs
|
|
252
|
+
MonadicProgram,
|
|
253
|
+
# boundaries & flows
|
|
254
|
+
Discretize,
|
|
255
|
+
Embed,
|
|
256
|
+
AffineCouplingLayer,
|
|
257
|
+
ConditionalFlow,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
# dsl
|
|
261
|
+
from quivers.dsl import (
|
|
262
|
+
parse as dsl_parse,
|
|
263
|
+
loads as dsl_loads,
|
|
264
|
+
load as dsl_load,
|
|
265
|
+
LexError,
|
|
266
|
+
ParseError,
|
|
267
|
+
CompileError,
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
__all__ = [
|
|
271
|
+
# objects
|
|
272
|
+
"SetObject",
|
|
273
|
+
"FinSet",
|
|
274
|
+
"ProductSet",
|
|
275
|
+
"CoproductSet",
|
|
276
|
+
"FreeMonoid",
|
|
277
|
+
"Unit",
|
|
278
|
+
"EmptySet",
|
|
279
|
+
"EMPTY",
|
|
280
|
+
# quantales
|
|
281
|
+
"Quantale",
|
|
282
|
+
"ProductFuzzy",
|
|
283
|
+
"BooleanQuantale",
|
|
284
|
+
"PRODUCT_FUZZY",
|
|
285
|
+
"BOOLEAN",
|
|
286
|
+
# extra quantales
|
|
287
|
+
"LukasiewiczQuantale",
|
|
288
|
+
"GodelQuantale",
|
|
289
|
+
"TropicalQuantale",
|
|
290
|
+
"LUKASIEWICZ",
|
|
291
|
+
"GODEL",
|
|
292
|
+
"TROPICAL",
|
|
293
|
+
# morphisms
|
|
294
|
+
"Morphism",
|
|
295
|
+
"ObservedMorphism",
|
|
296
|
+
"LatentMorphism",
|
|
297
|
+
"ComposedMorphism",
|
|
298
|
+
"ProductMorphism",
|
|
299
|
+
"MarginalizedMorphism",
|
|
300
|
+
"FunctorMorphism",
|
|
301
|
+
"morphism",
|
|
302
|
+
"observed",
|
|
303
|
+
"identity",
|
|
304
|
+
# functors
|
|
305
|
+
"Functor",
|
|
306
|
+
"IdentityFunctor",
|
|
307
|
+
"ComposedFunctor",
|
|
308
|
+
"FreeMonoidFunctor",
|
|
309
|
+
"IDENTITY",
|
|
310
|
+
# program
|
|
311
|
+
"Program",
|
|
312
|
+
# tensor ops
|
|
313
|
+
"noisy_or_contract",
|
|
314
|
+
"noisy_or_reduce",
|
|
315
|
+
"noisy_and_reduce",
|
|
316
|
+
"componentwise_lift",
|
|
317
|
+
# ends and coends
|
|
318
|
+
"coend",
|
|
319
|
+
"end",
|
|
320
|
+
# natural transformations
|
|
321
|
+
"NaturalTransformation",
|
|
322
|
+
"ComponentwiseNT",
|
|
323
|
+
# monads
|
|
324
|
+
"Monad",
|
|
325
|
+
"KleisliCategory",
|
|
326
|
+
"FuzzyPowersetMonad",
|
|
327
|
+
"FreeMonoidMonad",
|
|
328
|
+
# comonads
|
|
329
|
+
"Comonad",
|
|
330
|
+
"CoKleisliCategory",
|
|
331
|
+
"DiagonalComonad",
|
|
332
|
+
"CofreeComonad",
|
|
333
|
+
# algebras and coalgebras
|
|
334
|
+
"Algebra",
|
|
335
|
+
"FreeAlgebra",
|
|
336
|
+
"ObservedAlgebra",
|
|
337
|
+
"Coalgebra",
|
|
338
|
+
"CofreeCoalgebra",
|
|
339
|
+
"ObservedCoalgebra",
|
|
340
|
+
"EilenbergMooreCategory",
|
|
341
|
+
# adjunctions
|
|
342
|
+
"Adjunction",
|
|
343
|
+
"ForgetfulFunctor",
|
|
344
|
+
"FreeForgetfulAdjunction",
|
|
345
|
+
# kan extensions
|
|
346
|
+
"ObjectMap",
|
|
347
|
+
"Projection",
|
|
348
|
+
"Inclusion",
|
|
349
|
+
"left_kan",
|
|
350
|
+
"right_kan",
|
|
351
|
+
# profunctors
|
|
352
|
+
"Profunctor",
|
|
353
|
+
# monoidal
|
|
354
|
+
"MonoidalStructure",
|
|
355
|
+
"CartesianMonoidal",
|
|
356
|
+
"CoproductMonoidal",
|
|
357
|
+
# base change
|
|
358
|
+
"BaseChange",
|
|
359
|
+
"BoolToFuzzy",
|
|
360
|
+
"FuzzyToBool",
|
|
361
|
+
# distributive laws
|
|
362
|
+
"DistributiveLaw",
|
|
363
|
+
"FreeMonoidPowersetLaw",
|
|
364
|
+
# weighted limits
|
|
365
|
+
"Weight",
|
|
366
|
+
"Diagram",
|
|
367
|
+
"weighted_limit",
|
|
368
|
+
"weighted_colimit",
|
|
369
|
+
"weighted_limit_morphisms",
|
|
370
|
+
"weighted_colimit_morphisms",
|
|
371
|
+
"representable_weight",
|
|
372
|
+
"terminal_weight",
|
|
373
|
+
# yoneda
|
|
374
|
+
"Presheaf",
|
|
375
|
+
"representable_profunctor",
|
|
376
|
+
"corepresentable_profunctor",
|
|
377
|
+
"yoneda_embedding",
|
|
378
|
+
"yoneda_lemma",
|
|
379
|
+
"yoneda_density",
|
|
380
|
+
"verify_yoneda_fully_faithful",
|
|
381
|
+
# day convolution
|
|
382
|
+
"day_convolution",
|
|
383
|
+
"day_unit",
|
|
384
|
+
"day_convolution_profunctors",
|
|
385
|
+
# optics
|
|
386
|
+
"Optic",
|
|
387
|
+
"Lens",
|
|
388
|
+
"Prism",
|
|
389
|
+
"Adapter",
|
|
390
|
+
"Grate",
|
|
391
|
+
"compose_optics",
|
|
392
|
+
# traced monoidal
|
|
393
|
+
"TracedMonoidal",
|
|
394
|
+
"CartesianTrace",
|
|
395
|
+
"IterativeTrace",
|
|
396
|
+
"trace",
|
|
397
|
+
"partial_trace",
|
|
398
|
+
# stochastic
|
|
399
|
+
"MarkovQuantale",
|
|
400
|
+
"MARKOV",
|
|
401
|
+
"StochasticMorphism",
|
|
402
|
+
"CategoricalMorphism",
|
|
403
|
+
"DiscretizedNormal",
|
|
404
|
+
"DiscretizedLogitNormal",
|
|
405
|
+
"DiscretizedBeta",
|
|
406
|
+
"DiscretizedTruncatedNormal",
|
|
407
|
+
"ConditionedMorphism",
|
|
408
|
+
"MixtureMorphism",
|
|
409
|
+
"FactoredMorphism",
|
|
410
|
+
"NormalizedMorphism",
|
|
411
|
+
"condition",
|
|
412
|
+
"mix",
|
|
413
|
+
"factor",
|
|
414
|
+
"normalize",
|
|
415
|
+
"prob",
|
|
416
|
+
"marginal_prob",
|
|
417
|
+
"expectation",
|
|
418
|
+
"stochastic",
|
|
419
|
+
# giry monad
|
|
420
|
+
"GiryMonad",
|
|
421
|
+
"FinStoch",
|
|
422
|
+
# continuous — spaces
|
|
423
|
+
"ContinuousSpace",
|
|
424
|
+
"Euclidean",
|
|
425
|
+
"UnitInterval",
|
|
426
|
+
"Simplex",
|
|
427
|
+
"PositiveReals",
|
|
428
|
+
"ProductSpace",
|
|
429
|
+
# continuous — morphisms
|
|
430
|
+
"ContinuousMorphism",
|
|
431
|
+
"SampledComposition",
|
|
432
|
+
"ProductContinuousMorphism",
|
|
433
|
+
"DiscreteAsContinuous",
|
|
434
|
+
# continuous — families (original)
|
|
435
|
+
"ConditionalNormal",
|
|
436
|
+
"ConditionalLogitNormal",
|
|
437
|
+
"ConditionalBeta",
|
|
438
|
+
"ConditionalTruncatedNormal",
|
|
439
|
+
"ConditionalDirichlet",
|
|
440
|
+
# continuous — families (loc-scale)
|
|
441
|
+
"ConditionalCauchy",
|
|
442
|
+
"ConditionalLaplace",
|
|
443
|
+
"ConditionalGumbel",
|
|
444
|
+
"ConditionalLogNormal",
|
|
445
|
+
"ConditionalStudentT",
|
|
446
|
+
# continuous — families (positive-valued)
|
|
447
|
+
"ConditionalExponential",
|
|
448
|
+
"ConditionalGamma",
|
|
449
|
+
"ConditionalChi2",
|
|
450
|
+
"ConditionalHalfCauchy",
|
|
451
|
+
"ConditionalHalfNormal",
|
|
452
|
+
"ConditionalInverseGamma",
|
|
453
|
+
"ConditionalWeibull",
|
|
454
|
+
"ConditionalPareto",
|
|
455
|
+
# continuous — families ((0,1)-valued)
|
|
456
|
+
"ConditionalKumaraswamy",
|
|
457
|
+
"ConditionalContinuousBernoulli",
|
|
458
|
+
# continuous — families (two-df)
|
|
459
|
+
"ConditionalFisherSnedecor",
|
|
460
|
+
# continuous — families (special)
|
|
461
|
+
"ConditionalUniform",
|
|
462
|
+
# continuous — families (multivariate)
|
|
463
|
+
"ConditionalMultivariateNormal",
|
|
464
|
+
"ConditionalLowRankMVN",
|
|
465
|
+
# continuous — families (relaxed discrete)
|
|
466
|
+
"ConditionalRelaxedBernoulli",
|
|
467
|
+
"ConditionalRelaxedOneHotCategorical",
|
|
468
|
+
# continuous — families (matrix-valued)
|
|
469
|
+
"ConditionalWishart",
|
|
470
|
+
# continuous — families (discrete-valued)
|
|
471
|
+
"ConditionalBernoulli",
|
|
472
|
+
"ConditionalCategorical",
|
|
473
|
+
# continuous — monadic programs
|
|
474
|
+
"MonadicProgram",
|
|
475
|
+
"Discretize",
|
|
476
|
+
"Embed",
|
|
477
|
+
"AffineCouplingLayer",
|
|
478
|
+
"ConditionalFlow",
|
|
479
|
+
# dsl
|
|
480
|
+
"dsl_parse",
|
|
481
|
+
"dsl_loads",
|
|
482
|
+
"dsl_load",
|
|
483
|
+
"LexError",
|
|
484
|
+
"ParseError",
|
|
485
|
+
"CompileError",
|
|
486
|
+
]
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""Categorical structures: functors, natural transformations, adjunctions, monoidal, and traced categories."""
|
|
2
|
+
|
|
3
|
+
from quivers.categorical.functors import (
|
|
4
|
+
Functor,
|
|
5
|
+
IdentityFunctor,
|
|
6
|
+
ComposedFunctor,
|
|
7
|
+
FreeMonoidFunctor,
|
|
8
|
+
IDENTITY,
|
|
9
|
+
)
|
|
10
|
+
from quivers.categorical.natural_transformations import (
|
|
11
|
+
NaturalTransformation,
|
|
12
|
+
ComponentwiseNT,
|
|
13
|
+
)
|
|
14
|
+
from quivers.categorical.adjunctions import (
|
|
15
|
+
Adjunction,
|
|
16
|
+
FreeForgetfulAdjunction,
|
|
17
|
+
ForgetfulFunctor,
|
|
18
|
+
)
|
|
19
|
+
from quivers.categorical.monoidal import (
|
|
20
|
+
MonoidalStructure,
|
|
21
|
+
CartesianMonoidal,
|
|
22
|
+
CoproductMonoidal,
|
|
23
|
+
EmptySet,
|
|
24
|
+
EMPTY,
|
|
25
|
+
)
|
|
26
|
+
from quivers.categorical.base_change import (
|
|
27
|
+
BaseChange,
|
|
28
|
+
BoolToFuzzy,
|
|
29
|
+
FuzzyToBool,
|
|
30
|
+
)
|
|
31
|
+
from quivers.categorical.traced import (
|
|
32
|
+
TracedMonoidal,
|
|
33
|
+
CartesianTrace,
|
|
34
|
+
IterativeTrace,
|
|
35
|
+
trace,
|
|
36
|
+
partial_trace,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
# functors
|
|
41
|
+
"Functor",
|
|
42
|
+
"IdentityFunctor",
|
|
43
|
+
"ComposedFunctor",
|
|
44
|
+
"FreeMonoidFunctor",
|
|
45
|
+
"IDENTITY",
|
|
46
|
+
# natural transformations
|
|
47
|
+
"NaturalTransformation",
|
|
48
|
+
"ComponentwiseNT",
|
|
49
|
+
# adjunctions
|
|
50
|
+
"Adjunction",
|
|
51
|
+
"FreeForgetfulAdjunction",
|
|
52
|
+
"ForgetfulFunctor",
|
|
53
|
+
# monoidal
|
|
54
|
+
"MonoidalStructure",
|
|
55
|
+
"CartesianMonoidal",
|
|
56
|
+
"CoproductMonoidal",
|
|
57
|
+
"EmptySet",
|
|
58
|
+
"EMPTY",
|
|
59
|
+
# base change
|
|
60
|
+
"BaseChange",
|
|
61
|
+
"BoolToFuzzy",
|
|
62
|
+
"FuzzyToBool",
|
|
63
|
+
# traced
|
|
64
|
+
"TracedMonoidal",
|
|
65
|
+
"CartesianTrace",
|
|
66
|
+
"IterativeTrace",
|
|
67
|
+
"trace",
|
|
68
|
+
"partial_trace",
|
|
69
|
+
]
|