skoro v0.0.0

Crates

skoro-core

Quantities, operations and their derivatives, models, terms and queries.

Depends on skoro-tensor.

skoro-core is everything that makes a model a model. It holds the spaces quantities live in (the Euclidean and positive types, products, the discrete types, and the embedded types that later crates declare from a retraction and its inverse) and the typed handles code holds them by, and gives every continuous space a reference measure through the log-volume of its chart: Lebesgue measure on its own types, and on an embedded type that declares its chart’s volume, the measure its retraction normalizes. An embedded type may be stored up to a group of signed permutations of its storage, as the rotations are stored as quaternions of either sign, and its charts and volume are then read on its points. A space whose measure has finite mass has a uniform distribution: a categorical space by its count, an embedded type by the log-mass and the uniform draw it declares, and a product by its factors, and every other space answers NoMass. A space without a measure has no densities, and the core refuses to score, propose or integrate out a quantity of it. It holds operations: the trait every operation implements, the kernels they are lowered to with derivatives up to second order, the primitives, composites, and the registry that makes an operation again from its name and parameters.

It holds the model itself: the writer that builds it in scopes and publishes snapshots, branches and readers, addresses and namespaces, and the terms that make the probabilistic graph, with their samplers, proposals and roles; the Distribution trait, by which a distribution scores a quantity; and sample, which makes a quantity and scores it by a distribution in one call. It compiles queries for a target into programs, whose passes give values, tangents, gradients and Hessian-vector products in tangent charts, for values of any number of entries, none included, as a Vector(0) or a Matrix(0, n), and it holds generation, which draws a model’s free quantities from explicit random keys and weighs the draw, and retirement, which removes the quantities at a collection of addresses, named one by one or as the namespaces they lie under, and keeps what they said about the rest as a likelihood factor over their Markov blanket, which the caller builds with the roles it binds, and whose handle the retirement gives back. A retirement also frees every node it leaves needed by nothing, so that a model that retires as it grows stays bounded, and pin and unpin keep a node the user still needs, such as a constant made once for a whole run.

An algorithm in another crate reads what it needs through the same interface: a query’s terms and observations, and the union of two sets of observations; the quantities any node is reached from; whether a composite reads an input, and so whether a space’s chart volume depends on its point; a constant of a space known only at run time; observations of a value that differs from row to row, as generation draws it; and a layout’s inverse step, the tangent at one point that reaches another. The linearization is built on these alone.

Its testing module is public, so that a later crate checks its own operations and embedded types the way the core checks its primitives: against finite differences, at both precisions, with the precision_tests! macro, a declared chart volume against the area formula, a declared mass against its draw and its volume, and a type stored up to a group against each condition its group asks, with close_up_to to compare stored values as points. Its wgpu target is admitted before any test uses it: Admission measures the adapter’s sine and cosine against double precision, and refuses an adapter whose absolute error exceeds what the removable singularities’ cutoffs are designed for, as Accuracy on the GPU works out.

Reading order

The modules in an order that uses as little as possible before it is read, computed from the sources when the site was built. A dashed arc marks a module's use of one that comes later, with what it uses named beside it.

uses an earlier module uses a later module a cycle (21 modules)
The order in which to read skoro-coretesting uses key: Keytesting uses id: NodeIdtesting uses error: Errorgenerate uses key: Keyretire uses address: Addresstesting uses space: Spacegenerate uses id: NodeIdregistry uses error: Errortesting uses q: QDyngenerate uses error: Errorretire uses id: NodeIdretire uses error: Error, Failuretesting uses query: Querygenerate uses q: QDynops uses id: NodeIdretire uses space: Spacewriter uses error: Failuretesting uses operation: FirstOrder, Forward, Kernel, Lowered, Lowering, Operation, Pullback, SecondOrder, SecondPullbackops uses error: Errorretire uses q: Q, QDyn, Realcompile uses id: NodeIdgenerate uses query: Observationsops uses space: Spaceregistry uses operation: Operation, Paramretraction uses error: Errorscope uses address: Addresscompile uses error: Errorcomposite uses id: NodeIdgenerate uses operation: Forward, Kernel, Loweringmodel uses address: Addressops uses q: Boolean, Categorical, CategoricalDyn, Declares, Integer, Matrix, MatrixDyn, Positive, PositiveDyn, ProductDyn, Q, QDyn, Real, Typed, Vector, VectorDynregistry uses primitive::discrete: IntegerAdd, IntegerEq, IntegerLe, IntegerLt, IntegerMul, IntegerSub, IsNonnegative, ToRealretire uses query: Observationsretraction uses space: Block, Spacecompile uses space: Spacecomposite uses error: Error, Failureretraction uses q: QDyn, Realscope uses id: NodeIdcomposite uses space: Spacemodel uses id: NodeIdregistry uses primitive::euclidean: Add, Atan2, Concatenate, Cos, Exp, Log, MatMul, Mul, Neg, Scale, Sin, Slice, Sub, Sum, Transposescope uses error: Error, Failureterm uses key: Keytesting uses program: Frames, Pass, Program, Valuescomposite uses q: QDyngenerate uses primitive::euclidean: Neg, Submodel uses error: Errorops uses operation: Operationregistry uses primitive::positive: PositiveAsReal, PositiveExp, PositiveLog, PositiveMul, PositiveRecip, Selectscope uses space: Spaceterm uses id: NodeIdtesting uses embedded: Domain, Embedded, Include, Linear, Project, Retractcompile uses query: Observations, Query, Targetslayout uses id: NodeIdmodel uses space: Spaceops uses primitive::discrete: IntegerAdd, IntegerEq, IntegerLe, IntegerLt, IntegerMul, IntegerSub, IsNonnegative, ToRealq uses scope: narrow()retraction uses operation: Paramscope uses q: Declares, Handle, Q, QDyn, Typedterm uses error: Errorcompile uses operation: Kernel, Link, Lowered, Lowering, Operationembedded uses id: NodeIdgenerate uses program: Slot, Valueslayout uses error: Errorregistry uses embedded: Embeddedretraction uses primitive::discrete: IsNonnegative, ToRealscope uses into_host: IntoHostValueterm uses space: Spacecomposite uses operation: Lowered, Lowering, Operation, Paramembedded uses error: Errorlayout uses space: Block, Spaceoperation uses composite: Compositeops uses primitive::euclidean: Add, Atan2, Concatenate, Cos, Exp, Log, MatMul, Mul, Neg, Scale, Sin, Slice, Sub, Sum, Transposeprogram uses id: NodeIdterm uses q: Q, QDyn, Real, Typedembedded uses space: Spaceops uses primitive::positive: PositiveAsReal, PositiveExp, PositiveLog, PositiveMul, PositiveRecip, Selectprogram uses error: Errorquery uses model: Snapshotretraction uses primitive::euclidean: Concatenate, Slicescope uses operation: Lowered, Lowering, Operationspace uses embedded: Embeddedtesting uses scope: quantity_in()compile uses primitive::euclidean: Addembedded uses q: QDyn, Realgenerate uses term: Sample, Termmodel uses operation: Operationprimitive::positive uses error: Errorprogram uses space: Spaceretraction uses primitive::positive: PositiveExp, PositiveLog, PositiveMultesting uses composite: Compositecompile uses primitive::positive: Selectgenerate uses model: Snapshotops uses embedded: Include, Projectprimitive::euclidean uses error: Errorprimitive::positive uses space: Spaceprogram uses q: QDynretire uses term: Draft.add_proposal(), Draft.add_term(), Multiplicity, Proposal, Role, Term, TermHandle, named(), named_by(), roots()term uses operation: Paramtesting uses compile: .compile()compile uses program: Free, Program, Root, Slot, Step, expand()primitive::euclidean uses space: Spaceretire uses model: Model, Snapshotretraction uses embedded: Domain, Include, Retracttesting uses retraction: Space.domain(), Space.log_mass(), Space.log_volume(), Space.retraction()embedded uses compile: .compile()embedded uses operation: FirstOrder, Forward, Kernel, Lowered, Lowering, Operation, Param, Pullback, SecondOrder, SecondPullbacklayout uses retraction: Space.inverse_retraction(), Space.retraction()model uses writer: Writerprimitive::discrete uses error: Errorretire uses scope: Draft, Frame, open()writer uses model: Model, Snapshottesting uses ops: .cos(), .exp(), .local(), .log_volume(), .sin(), .sum(), .transpose()compile uses layout: Layoutembedded uses composite: Compositegenerate uses compile: Builderlayout uses compile: .compile()operation uses error: Erroroperation uses program: Programprimitive::discrete uses space: Spaceprogram uses operation: Kernel, Order, Pullback, SecondPullbackquery uses id: NodeIdscope uses program: Valuesterm uses retraction: Space.has_measure()writer uses scope: Draft, Frame, open()testing uses writer: Writerembedded uses scope: constant()model uses program: Programoperation uses space: Spaceops uses scope: Draft, build(), literal()primitive::positive uses operation: Lowered, Lowering, Operation, Paramcompile uses model: Model, NodeKind, Snapshoterror uses address: Addressgenerate uses ops: .sum()model uses compile: ProgramKeyprimitive::euclidean uses operation: Lowered, Lowering, Operation, Paramq uses id: NodeIdretire uses retraction: Space.has_measure()retraction uses scope: apply(), constant()compile uses scope: fits()composite uses model: Model, Node, NodeKindlayout uses model: Snapshotlayout uses program: Frames, Program, Valuesprimitive::positive uses primitive::rule: Rule, RuleKernel, columns(), widen()primitive::rule uses operation: FirstOrder, Forward, Kernel, Pullback, SecondOrder, SecondPullbackprogram uses layout: Layoutquery uses q: Q, QDyn, Typedretraction uses composite: Compositescope uses compile: .compile()scope uses term: Distributionterm uses scope: Draft, build()compile uses composite: Compositecomposite uses scope: Draft, Frame, apply(), open()embedded uses layout: Frames.identity()embedded uses program: Frames, Pass, Program, Valueserror uses id: NodeIderror uses space: Spaceinto_host uses q: Boolean, Categorical, CategoricalDyn, Integer, Matrix, MatrixDyn, Positive, PositiveDyn, Real, Vector, VectorDynkey uses address: Address, Segmentmodel uses term: Multiplicity, Proposal, Role, Term, roots()ops uses retraction: Space.inverse_retraction(), Space.log_volume(), Space.retraction()primitive::discrete uses operation: Forward, Kernel, Lowered, Lowering, Operation, Paramprimitive::euclidean uses primitive::rule: Rule, RuleKernel, columns(), widen()q uses space: Spacequery uses into_host: IntoHostValueretire uses writer: Writerretraction uses ops: .log_volume(), .sum()scope uses model: Model, Node, NodeKindspace uses error: Errorterm uses model: Model1address2key3id4errorSpace5spaceEmbedded6qnarrow()7into_host8querySnapshot9operationProgram · Composite10primitive::discrete11primitive::rule12primitive::euclidean13primitive::positive14programLayout15embeddedFrames.identity() · constant() · Composite · .compile()16layoutSnapshot · .compile() · Space.inverse_retraction(), Space.retraction()17termModel · Draft, build() · Space.has_measure()18modelProgramKey · Writer19scope.compile()20composite21compile22retraction.log_volume(), .sum()23ops24writer25retire26generate27registry28testing

Hover over or tap a module to see everything it uses and everything that uses it.

21 uses of a later module, naming 24 items: a cycle too large to order exactly was ordered greedily, so there may be fewer.
ModuleUses, before it is readFrom
errorSpacespace
spaceEmbeddedembedded
qnarrow()scope
querySnapshotmodel
operationProgramprogram
operationCompositecomposite
programLayoutlayout
embeddedFrames.identity()layout
embeddedconstant()scope
embeddedCompositecomposite
embedded.compile()compile
layoutSnapshotmodel
layout.compile()compile
layoutSpace.inverse_retraction(), Space.retraction()retraction
termModelmodel
termDraft, build()scope
termSpace.has_measure()retraction
modelProgramKeycompile
modelWriterwriter
scope.compile()compile
retraction.log_volume(), .sum()ops