diff --git a/dev/Manifest.toml b/dev/Manifest.toml index f564e1448..502668f42 100644 --- a/dev/Manifest.toml +++ b/dev/Manifest.toml @@ -975,9 +975,9 @@ version = "0.3.4" [[StructArrays]] deps = ["Adapt", "ConstructionBase", "DataAPI", "GPUArraysCore", "StaticArraysCore", "Tables"] -git-tree-sha1 = "0a3db38e4cce3c54fe7a71f831cd7b6194a54213" +git-tree-sha1 = "1b0b1205a56dc288b71b1961d48e351520702e24" uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" -version = "0.6.16" +version = "0.6.17" [[SuiteSparse]] deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] @@ -1046,7 +1046,7 @@ version = "1.4.0" deps = ["ADTypes", "AbstractMCMC", "AdvancedHMC", "AdvancedMH", "AdvancedPS", "AdvancedVI", "BangBang", "Bijectors", "DataStructures", "Distributions", "DistributionsAD", "DocStringExtensions", "DynamicPPL", "EllipticalSliceSampling", "ForwardDiff", "Libtask", "LinearAlgebra", "LogDensityProblems", "LogDensityProblemsAD", "MCMCChains", "NamedArrays", "Printf", "Random", "Reexport", "Requires", "SciMLBase", "Setfield", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns"] path = "/home/runner/.julia/dev/Turing" uuid = "fce5fe82-541a-59a6-adf8-730c64b5f9a0" -version = "0.30.1" +version = "0.30.2" [[UUIDs]] deps = ["Random", "SHA"] diff --git a/dev/docs/library/advancedhmc/index.html b/dev/docs/library/advancedhmc/index.html index b2751c9fa..4f34edd4e 100644 --- a/dev/docs/library/advancedhmc/index.html +++ b/dev/docs/library/advancedhmc/index.html @@ -839,19 +839,19 @@

Index

  • AdvancedHMC.HMCState
  • AdvancedHMC.JitteredLeapfrog
  • AdvancedHMC.Leapfrog
  • -
  • AdvancedHMC.MultinomialTS
  • [AdvancedHMC.MultinomialTS](/dev/docs/library/advancedhmc/#AdvancedHMC.MultinomialTS-Tuple{MultinomialTS, AbstractFloat, AdvancedHMC.PhasePoint})
  • +
  • AdvancedHMC.MultinomialTS
  • [AdvancedHMC.MultinomialTS](/dev/docs/library/advancedhmc/#AdvancedHMC.MultinomialTS-Tuple{Random.AbstractRNG, AdvancedHMC.PhasePoint})
  • AdvancedHMC.NUTS
  • AdvancedHMC.PartialMomentumRefreshment
  • AdvancedHMC.SliceTS
  • -
  • [AdvancedHMC.SliceTS](/dev/docs/library/advancedhmc/#AdvancedHMC.SliceTS-Tuple{Random.AbstractRNG, AdvancedHMC.PhasePoint})
  • [AdvancedHMC.SliceTS](/dev/docs/library/advancedhmc/#AdvancedHMC.SliceTS-Tuple{SliceTS, AbstractFloat, AdvancedHMC.PhasePoint})
  • +
  • [AdvancedHMC.SliceTS](/dev/docs/library/advancedhmc/#AdvancedHMC.SliceTS-Tuple{Random.AbstractRNG, AdvancedHMC.PhasePoint})
  • AdvancedHMC.StaticTerminationCriterion
  • AdvancedHMC.StrictGeneralisedNoUTurn
  • AdvancedHMC.TemperedLeapfrog
  • -
  • [AdvancedHMC.Termination](/dev/docs/library/advancedhmc/#AdvancedHMC.Termination-Union{Tuple{F}, Tuple{SliceTS, Trajectory, F, F}} where F<:AbstractFloat)
  • [AdvancedHMC.Termination](/dev/docs/library/advancedhmc/#AdvancedHMC.Termination-Union{Tuple{F}, Tuple{MultinomialTS, Trajectory, F, F}} where F<:AbstractFloat)
  • +
  • [AdvancedHMC.Termination](/dev/docs/library/advancedhmc/#AdvancedHMC.Termination-Union{Tuple{F}, Tuple{SliceTS, Trajectory, F, F}} where F<:AbstractFloat)
  • AdvancedHMC.Termination
  • AdvancedHMC.Trajectory
  • AdvancedHMC.Transition
  • @@ -862,9 +862,9 @@

    Index

  • [AdvancedHMC.combine](/dev/docs/library/advancedhmc/#AdvancedHMC.combine-Tuple{AdvancedHMC.BinaryTree, AdvancedHMC.BinaryTree})
  • AdvancedHMC.determine_sampler_eltype
  • [AdvancedHMC.find_good_stepsize](/dev/docs/library/advancedhmc/#AdvancedHMC.find_good_stepsize-Union{Tuple{T}, Tuple{Random.AbstractRNG, Hamiltonian, AbstractVector{T}}} where T<:Real)
  • -
  • [AdvancedHMC.isterminated](/dev/docs/library/advancedhmc/#AdvancedHMC.isterminated-Tuple{ClassicNoUTurn, Hamiltonian, AdvancedHMC.BinaryTree})
  • -
  • [AdvancedHMC.isterminated](/dev/docs/library/advancedhmc/#AdvancedHMC.isterminated-Tuple{StrictGeneralisedNoUTurn, Hamiltonian, Any, Any, Any})
  • [AdvancedHMC.isterminated](/dev/docs/library/advancedhmc/#AdvancedHMC.isterminated-Tuple{GeneralisedNoUTurn, Hamiltonian, AdvancedHMC.BinaryTree})
  • +
  • [AdvancedHMC.isterminated](/dev/docs/library/advancedhmc/#AdvancedHMC.isterminated-Tuple{StrictGeneralisedNoUTurn, Hamiltonian, Any, Any, Any})
  • +
  • [AdvancedHMC.isterminated](/dev/docs/library/advancedhmc/#AdvancedHMC.isterminated-Tuple{ClassicNoUTurn, Hamiltonian, AdvancedHMC.BinaryTree})
  • [AdvancedHMC.maxabs](/dev/docs/library/advancedhmc/#AdvancedHMC.maxabs-Tuple{Any, Any})
  • [AdvancedHMC.mh_accept_ratio](/dev/docs/library/advancedhmc/#AdvancedHMC.mh_accept_ratio-Union{Tuple{T}, Tuple{Random.AbstractRNG, T, T}} where T<:AbstractFloat)
  • AdvancedHMC.nom_step_size
  • diff --git a/dev/docs/library/index.html b/dev/docs/library/index.html index 54c9351a5..04ce557b7 100644 --- a/dev/docs/library/index.html +++ b/dev/docs/library/index.html @@ -880,7 +880,7 @@

    # Turing.Inference.HMCType.

    HMC(ϵ::Float64, n_leapfrog::Int; adtype::ADTypes.AbstractADType = AutoForwardDiff(; chunksize=0))
     
    @@ -902,7 +902,7 @@

    # Reduced step size sample(gdemo([1.5, 2]), HMC(0.01, 10), 1000) -

    source

    +

    source

    # Turing.Inference.HMCDAType.

    HMCDA(
         n_adapts::Int, δ::Float64, λ::Float64; ϵ::Float64 = 0.0;
    @@ -924,7 +924,7 @@ 

    arXiv link):

    Hoffman, Matthew D., and Andrew Gelman. "The No-U-turn sampler: adaptively setting path lengths in Hamiltonian Monte Carlo." Journal of Machine Learning Research 15, no. 1 (2014): 1593-1623.

    -

    source

    +

    source

    # Turing.Inference.ISType.

    IS()
     
    @@ -944,7 +944,7 @@

    sample(gdemo([1.5, 2]), IS(), 1000)

    -

    source

    +

    source

    # Turing.Inference.MHType.

    MH(space...)
     
    @@ -1059,7 +1059,7 @@

    ) mean(chain) -

    source

    +

    source

    # Turing.Inference.NUTSType.

    NUTS(n_adapts::Int, δ::Float64; max_depth::Int=10, Δ_max::Float64=1000.0, init_ϵ::Float64=0.0; adtype::ADTypes.AbstractADType=AutoForwardDiff(; chunksize=0)
     
    @@ -1077,7 +1077,7 @@

    # Turing.Inference.PGType.

    struct PG{space, R} <: Turing.Inference.ParticleInference
     
    @@ -1087,7 +1087,7 @@

    # Turing.Inference.SMCType.

    struct SMC{space, R} <: Turing.Inference.ParticleInference
     
    @@ -1096,7 +1096,7 @@

    Distributions

    @@ -1107,7 +1107,7 @@

    $$ f(x) = 1. $$

    -

    source

    +

    source

    # Turing.FlatPosType.

    FlatPos(l::Real)
     
    @@ -1118,7 +1118,7 @@

    # Turing.BinomialLogitType.

    BinomialLogit(n, logitp)
     
    @@ -1128,7 +1128,7 @@

    Binomial

    -

    source

    +

    source

    !!! warning "Missing docstring." Missing docstring for VecBinomialLogit. Check Documenter's build log for details.

    # Turing.OrderedLogisticType.

    @@ -1143,7 +1143,7 @@

    Jekyll2024-01-19T23:07:42+00:00/dev/feed.xmlTuring.jlTuring: A robust, efficient and modular library for general-purpose probabilistic programming. +Jekyll2024-01-20T23:08:49+00:00/dev/feed.xmlTuring.jlTuring: A robust, efficient and modular library for general-purpose probabilistic programming. The Turing TeamGoogle Summer of Code 20222022-02-17T00:00:00+00:002022-02-17T00:00:00+00:00/dev/posts/gsoc<p>It is another year of the <a href="https://summerofcode.withgoogle.com/">Google Summer of Code</a> time, and we have compiled an updated list of exciting Turing projects! Projects that the Turing team would be interested in working with students on over the summer are listed below. This information is also cross-posted at <a href="https://julialang.org/jsoc/gsoc/turing/">Julia's Turing project page</a>.</p> diff --git a/dev/search/search_index.json b/dev/search/search_index.json index 78c8f6520..256b44d57 100644 --- a/dev/search/search_index.json +++ b/dev/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location": "/assets/js/application.js", "text": "function e t for var n in t e n t n window function e function t r if n r return n r exports var i n r i r l 1 exports return e r call i exports i i exports t i l 0 i exports var n return t m e t c n t d function e n r t o e n object defineproperty e n configurable 1 enumerable 0 get r t n function e var n e e esmodule function return e default function return e return t d n a n n t o function e t return object prototype hasownproperty call e t t p t t s 6 function e t n use strict t esmodule 0 t default createelement function e t var n document createelement e t array prototype foreach call object keys t function e n setattribute e t e for var r arguments length i array r 2 r 2 0 o 2 o pre pre code array prototype foreach call n function t n var r code n i e createelement button class md clipboard title h clipboard copy data clipboard target r pre r code e createelement span class md clipboard message o t parentnode o id r o insertbefore i t new c default md clipboard on success function e var t e trigger queryselector md clipboard message if t instanceof htmlelement throw new referenceerror e clearselection t dataset mdtimer cleartimeout parseint t dataset mdtimer 10 t classlist add md clipboard message active t innerhtml h clipboard copied t dataset mdtimer settimeout function t classlist remove md clipboard message active t dataset mdtimer 2e3 tostring if modernizr details var r document queryselectorall details summary array prototype foreach call r function e e addeventlistener click function e var t e target parentnode t hasattribute open t removeattribute open t setattribute open var i function if document location hash var e document getelementbyid document location hash substring 1 if e return for var t e parentnode t t instanceof htmldetailselement t t parentnode if t t open t open 0 var n location hash location hash location hash n if window addeventlistener hashchange i i modernizr ios var o document queryselectorall data md scrollfix array prototype foreach call o function e e addeventlistener touchstart function var t e scrolltop 0 t e scrolltop 1 t e offsetheight e scrollheight e scrolltop t 1 listen new f default event listener window scroll resize orientationchange new f default header shadow data md component container data md component header listen new f default event listener window scroll resize orientationchange new f default header title data md component title md typeset h1 listen document queryselector data md component hero new f default event listener window scroll resize orientationchange new f default tabs toggle data md component hero listen document queryselector data md component tabs new f default event listener window scroll resize orientationchange new f default tabs toggle data md component tabs listen new f default event matchmedia min width 1220px new f default event listener window scroll resize orientationchange new f default sidebar position data md component navigation data md component header document queryselector data md component toc new f default event matchmedia min width 960px new f default event listener window scroll resize orientationchange new f default sidebar position data md component toc data md component header new f default event matchmedia min width 960px new f default event listener window scroll new f default nav blur data md component toc href var n document queryselectorall data md component collapsible array prototype foreach call n function e new f default event matchmedia min width 1220px new f default event listener e previouselementsibling click new f default nav collapse e new f default event matchmedia max width 1219px new f default event listener data md component navigation data md toggle change new f default nav scrolling data md component navigation nav document queryselector data md component search new f default event matchmedia max width 959px new f default event listener data md toggle search change new f default search lock data md toggle search new f default event listener data md component query focus keyup change new f default search result data md component result function return fetch t url base search search index json credentials same origin then function e return e json then function e return e docs map function e return e location t url base e location e listen new f default event listener data md component reset click function settimeout function var e document queryselector data md component query if e instanceof htmlinputelement throw new referenceerror e focus 10 listen new f default event listener data md toggle search change function e settimeout function e if e instanceof htmlinputelement throw new referenceerror if e checked var t document queryselector data md component query if t instanceof htmlinputelement throw new referenceerror t focus 400 e target listen new f default event matchmedia min width 960px new f default event listener data md component query focus function var e document queryselector data md toggle search if e instanceof htmlinputelement throw new referenceerror e checked e checked 0 e dispatchevent new customevent change new f default event listener window keydown function e var t document queryselector data md toggle search if t instanceof htmlinputelement throw new referenceerror var n document queryselector data md component query if n instanceof htmlinputelement throw new referenceerror if e metakey e ctrlkey if t checked if 13 e keycode if n document activeelement e preventdefault var r document queryselector data md component search href data md state active r instanceof htmllinkelement window location r getattribute href t checked 1 t dispatchevent new customevent change n blur else if 9 e keycode 27 e keycode t checked 1 t dispatchevent new customevent change n blur else if 1 8 37 39 indexof e keycode n document activeelement n focus else if 1 38 40 indexof e keycode var i e keycode o array prototype slice call document queryselectorall data md component query data md component search href a o find function e if e instanceof htmlelement throw new referenceerror return active e dataset mdstate a a dataset mdstate var s math max 0 o indexof a o length 38 i 1 1 o length return o s o s dataset mdstate active o s focus e preventdefault e stoppropagation 1 else document activeelement document activeelement form 70 e keycode 83 e keycode n focus e preventdefault listen new f default event listener window keypress function var e document queryselector data md toggle search if e instanceof htmlinputelement throw new referenceerror if e checked var t document queryselector data md component query if t instanceof htmlinputelement throw new referenceerror t document activeelement t focus listen new f default event listener document body keydown function e if 9 e keycode var t document queryselectorall data md component navigation md nav link for not tabindex array prototype foreach call t function e e offsetheight e tabindex 0 listen new f default event listener document body mousedown function var e document queryselectorall data md component navigation md nav link tabindex array prototype foreach call e function e e removeattribute tabindex listen document body addeventlistener click function tabbing document body dataset mdstate document body dataset mdstate new f default event matchmedia max width 959px new f default event listener data md component navigation href click function var e document queryselector data md toggle drawer if e instanceof htmlinputelement throw new referenceerror e checked e checked 1 e dispatchevent new customevent change function var e document queryselector data md source if e return a default resolve if e instanceof htmlanchorelement throw new referenceerror switch e dataset mdsource case github return new f default source adapter github e fetch default return a default resolve then function e var t document queryselectorall data md source array prototype foreach call t function t new f default source repository t initialize e t esmodule 0 t app void 0 n 7 n 8 n 9 n 10 n 11 n 12 n 13 var o n 14 a r o s n 19 c r s u n 20 l r u d n 21 f r d window promise window promise a default var h function e var t document getelementsbyname lang e 0 if t instanceof htmlmetaelement throw new referenceerror return t content p initialize i t app p call t n 0 function e t n e exports n p assets images icons bitbucket 1b09e088 svg function e t n e exports n p assets images icons github f0b8504a svg function e t n e exports n p assets images icons gitlab 6dd19c00 svg function e t function e t function e t try var n new window customevent test if n preventdefault 0 n defaultprevented throw new error could not prevent default catch e var r function e t var n r return t t bubbles 1 cancelable 1 detail void 0 n document createevent customevent n initcustomevent e t bubbles t cancelable t detail r n preventdefault n preventdefault function r call this try object defineproperty this defaultprevented get function return 0 catch e this defaultprevented 0 n r prototype window event prototype window customevent r function e t n window fetch window fetch n 2 default n 2 function e t n use strict object defineproperty t esmodule value 0 function e function r function i e t return function e apply t arguments function o e if this instanceof o throw new typeerror promises must be constructed via new if function typeof e throw new typeerror not a function this state 0 this handled 1 this value void 0 this deferreds d e this function a e t for 3 e state e e value if 0 e state return void e deferreds push t e handled 0 o immediatefn function var n 1 e state t onfulfilled t onrejected if null n return void 1 e state s c t promise e value var r try r n e value catch e return void c t promise e s t promise r function s e t try if t e throw new typeerror a promise cannot be resolved with itself if t object typeof t function typeof t var n t then if t instanceof o return e state 3 e value t void u e if function typeof n return void d i n t e e state 1 e value t u e catch t c e t function c e t e state 2 e value t u e function u e 2 e state 0 e deferreds length o immediatefn function e handled o unhandledrejectionfn e value for var t 0 n e deferreds length t 0 e idletimeoutid settimeout function e ontimeout e ontimeout t n 16 t setimmediate undefined typeof self self setimmediate void 0 e e setimmediate this this setimmediate t clearimmediate undefined typeof self self clearimmediate void 0 e e clearimmediate this this clearimmediate call t n 1 function e t n function e t function e n use strict function r e function typeof e e new function e for var t new array arguments length 1 n 0 n 1 for var n 1 n 0 void 0 arguments 0 arguments 0 this action e action this container e container this emitter e emitter this target e target this text e text this trigger e trigger this selectedtext key initselection value function this text this selectfake this target this selecttarget key selectfake value function var e this t rtl document documentelement getattribute dir this removefake this fakehandlercallback function return e removefake this fakehandler this container addeventlistener click this fakehandlercallback 0 this fakeelem document createelement textarea this fakeelem style fontsize 12pt this fakeelem style border 0 this fakeelem style padding 0 this fakeelem style margin 0 this fakeelem style position absolute this fakeelem style t right left 9999px var n window pageyoffset document documentelement scrolltop this fakeelem style top n px this fakeelem setattribute readonly this fakeelem value this text this container appendchild this fakeelem this selectedtext 0 r default this fakeelem this copytext key removefake value function this fakehandler this container removeeventlistener click this fakehandlercallback this fakehandler null this fakehandlercallback null this fakeelem this container removechild this fakeelem this fakeelem null key selecttarget value function this selectedtext 0 r default this target this copytext key copytext value function var e void 0 try e document execcommand this action catch t e 1 this handleresult e key handleresult value function e this emitter emit e success error action this action text this selectedtext trigger this trigger clearselection this clearselection bind this key clearselection value function this trigger this trigger focus window getselection removeallranges key destroy value function this removefake key action set function var e arguments length 0 void 0 arguments 0 arguments 0 copy if this action e copy this action cut this action throw new error invalid action value use either copy or cut get function return this action key target set function e if void 0 e if e object void 0 e undefined i e 1 e nodetype throw new error invalid target value use a valid element if copy this action e hasattribute disabled throw new error invalid target attribute please use readonly instead of disabled attribute if cut this action e hasattribute readonly e hasattribute disabled throw new error invalid target attribute you can t cut text from elements with readonly or disabled attributes this target e get function return this target e e exports a function e t n function r e t n if e t n throw new error missing required arguments if s string t throw new typeerror second argument must be a string if s fn n throw new typeerror third argument must be a function if s node e return i e t n if s nodelist e return o e t n if s string e return a e t n throw new typeerror first argument must be a string htmlelement htmlcollection or nodelist function i e t n return e addeventlistener t n destroy function e removeeventlistener t n function o e t n return array prototype foreach call e function e e addeventlistener t n destroy function array prototype foreach call e function e e removeeventlistener t n function a e t n return c document body e t n var s n 6 c n 5 e exports r function e t function n n prototype on function e t n var r this e this e return r e r e push fn t ctx n this once function e t n function r i off e r t apply n arguments var i this return r t this on e r n emit function e var t slice call arguments 1 n this e this e e slice r 0 i n length for r r 0 void 0 arguments 0 arguments 0 this action function typeof e action e action this defaultaction this target function typeof e target e target this defaulttarget this text function typeof e text e text this defaulttext this container object f e container e container document body key listenclick value function e var t this this listener 0 d default e click function e return t onclick e key onclick value function e var t e delegatetarget e currenttarget this clipboardaction this clipboardaction null this clipboardaction new u default action this action t target this target t text this text t container this container trigger t emitter this key defaultaction value function e return c action e key defaulttarget value function e var t c target e if t return document queryselector t key defaulttext value function e return c text e key destroy value function this listener destroy this clipboardaction this clipboardaction destroy this clipboardaction null key issupported value function var e arguments length 0 void 0 arguments 0 arguments 0 copy cut t string typeof e e e n document querycommandsupported return t foreach function e n n document querycommandsupported e n t l default e exports p function e t function n e t for e e nodetype r if function typeof e matches e matches t return e e e parentnode var r 9 if undefined typeof element element prototype matches var i element prototype i matches i matchesselector i mozmatchesselector i msmatchesselector i omatchesselector i webkitmatchesselector e exports n function e t n function r e t n r i var a o apply this arguments return e addeventlistener n a i destroy function e removeeventlistener n a i function i e t n i o return function typeof e addeventlistener r apply null arguments function typeof n r bind null document apply null arguments string typeof e e document queryselectorall e array prototype map call e function e return r e t n i o function o e t n r return function n n delegatetarget a n target t n delegatetarget r call e n var a n 4 e exports i function e t t node function e return void 0 e e instanceof htmlelement 1 e nodetype t nodelist function e var n object prototype tostring call e return void 0 e object nodelist n object htmlcollection n length in e 0 e length t node e 0 t string function e return string typeof e e instanceof string t fn function e return object function object prototype tostring call e function e t function n e var t if select e nodename e focus t e value else if input e nodename textarea e nodename var n e hasattribute readonly n e setattribute readonly e select e setselectionrange 0 e value length n e removeattribute readonly t e value else e hasattribute contenteditable e focus var r window getselection i document createrange i selectnodecontents e r removeallranges r addrange i t r tostring return t e exports n function e t n var r function use strict function i e t var n if t t this trackingclick 1 this trackingclickstart 0 this targetelement null this touchstartx 0 this touchstarty 0 this lasttouchidentifier 0 this touchboundary t touchboundary 10 this layer e this tapdelay t tapdelay 200 this taptimeout t taptimeout 700 i notneeded e for var r onmouse onclick ontouchstart ontouchmove ontouchend ontouchcancel o this s 0 c r length s 0 a navigator useragent indexof android 0 o s ip ad hone od test navigator useragent o c s os 4 d d test navigator useragent u s os 6 7 d test navigator useragent l navigator useragent indexof bb10 0 i prototype needsclick function e switch e nodename tolowercase case button case select case textarea if e disabled return 0 break case input if s file e type e disabled return 0 break case label case iframe case video return 0 return bneedsclick b test e classname i prototype needsfocus function e switch e nodename tolowercase case textarea return 0 case select return a case input switch e type case button case checkbox case file case image case radio case submit return 1 return e disabled e readonly default return bneedsfocus b test e classname i prototype sendclick function e t var n r document activeelement document activeelement e document activeelement blur r t changedtouches 0 n document createevent mouseevents n initmouseevent this determineeventtype e 0 0 window 1 r screenx r screeny r clientx r clienty 1 1 1 1 0 null n forwardedtouchevent 0 e dispatchevent n i prototype determineeventtype function e return a select e tagname tolowercase mousedown click i prototype focus function e var t s e setselectionrange 0 e type indexof date time e type month e type t e value length e setselectionrange t t e focus i prototype updatescrollparent function e var t n if t e fastclickscrollparent t contains e n e do if n scrollheight n offsetheight t n e fastclickscrollparent n break n n parentelement while n t t fastclicklastscrolltop t scrolltop i prototype gettargetelementfromeventtarget function e return e nodetype node text node e parentnode e i prototype ontouchstart function e var t n r if e targettouches length 1 return 0 if t this gettargetelementfromeventtarget e target n e targettouches 0 s if r window getselection r rangecount r iscollapsed return 0 if c if n identifier n identifier this lasttouchidentifier return e preventdefault 1 this lasttouchidentifier n identifier this updatescrollparent t return this trackingclick 0 this trackingclickstart e timestamp this targetelement t this touchstartx n pagex this touchstarty n pagey e timestamp this lastclicktime n math abs t pagey this touchstarty n i prototype ontouchmove function e return this trackingclick this targetelement this gettargetelementfromeventtarget e target this touchhasmoved e this trackingclick 1 this targetelement null 0 i prototype findcontrol function e return void 0 e control e control e htmlfor document getelementbyid e htmlfor e queryselector button input not type hidden keygen meter output progress select textarea i prototype ontouchend function e var t n r i o l this targetelement if this trackingclick return 0 if e timestamp this lastclicktime this taptimeout return 0 if this cancelnextclick 1 this lastclicktime e timestamp n this trackingclickstart this trackingclick 1 this trackingclickstart 0 u o e changedtouches 0 l document elementfrompoint o pagex window pagexoffset o pagey window pageyoffset l l fastclickscrollparent this targetelement fastclickscrollparent label r l tagname tolowercase if t this findcontrol l if this focus l a return 1 l t else if this needsfocus l return e timestamp n 100 s window top window input r this targetelement null 1 this focus l this sendclick l e s select r this targetelement null e preventdefault 1 return s c i l fastclickscrollparent i fastclicklastscrolltop i scrolltop this needsclick l e preventdefault this sendclick l e 1 i prototype ontouchcancel function this trackingclick 1 this targetelement null i prototype onmouse function e return this targetelement e forwardedtouchevent e cancelable this needsclick this targetelement this cancelnextclick e stopimmediatepropagation e stopimmediatepropagation e propagationstopped 0 e stoppropagation e preventdefault 1 i prototype onclick function e var t return this trackingclick this targetelement null this trackingclick 1 0 submit e target type 0 e detail t this onmouse e t this targetelement null t i prototype destroy function var e this layer a e removeeventlistener mouseover this onmouse 0 e removeeventlistener mousedown this onmouse 0 e removeeventlistener mouseup this onmouse 0 e removeeventlistener click this onclick 0 e removeeventlistener touchstart this ontouchstart 1 e removeeventlistener touchmove this ontouchmove 1 e removeeventlistener touchend this ontouchend 1 e removeeventlistener touchcancel this ontouchcancel 1 i notneeded function e var t n r if void 0 window ontouchstart return 0 if n chrome 0 9 exec navigator useragent 0 1 if a return 0 if t document queryselector meta name viewport if 1 t content indexof user scalable no return 0 if n 31 document documentelement scrollwidth 10 r 2 3 t document queryselector meta name viewport if 1 t content indexof user scalable no return 0 if document documentelement scrollwidth 27 t document queryselector meta name viewport 1 t content indexof user scalable no document documentelement scrollwidth this height t this active this header dataset mdstate this active t shadow else this height 0 this setup e prototype reset function this header dataset mdstate this height 0 this active 1 e t default i function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i function function e t n r this e var i string typeof t document queryselector t t if i instanceof htmlelement throw new referenceerror if this el i i string typeof n document queryselector n n instanceof htmlheadingelement throw new referenceerror this header i this active 1 return e prototype setup function var e this array prototype foreach call this el children function t t style width e el offsetwidth 20 px e prototype update function e var t this n window pageyoffset this header offsettop n this active this el dataset mdstate this active n active resize e type orientationchange e type array prototype foreach call this el children function e e style width t el offsetwidth 20 px e prototype reset function this el dataset mdstate this el style width this active 1 e t default i function e t n use strict function r e return e e esmodule e default e t esmodule 0 var i n 28 o r i a n 29 s r a c n 30 u r c t default blur o default collapse s default scrolling u default function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i function function e t r this e this els string typeof t document queryselectorall t t this index 0 this offset window pageyoffset this dir 1 this anchors reduce call this els function e t return e concat document getelementbyid t hash substring 1 return e prototype setup function this update e prototype update function var e window pageyoffset t this offset e 0 this els n 1 dataset mdstate blur this index n else for var r this index r 0 r if this anchors r offsettop 80 e this index r break r 0 this els r 1 dataset mdstate this offset e this dir t e prototype reset function array prototype foreach call this els function e e dataset mdstate this index 0 this offset window pageyoffset e t default i function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i function function e t r this e var n string typeof t document queryselector t t if n instanceof htmlelement throw new referenceerror this el n return e prototype setup function var e this el getboundingclientrect height this el style display e block none this el style overflow e visible hidden e prototype update function var e this t this el getboundingclientrect height if this el style display block this el style overflow t this el style maxheight t px requestanimationframe function e el setattribute data md state animate e el style maxheight 0px else this el setattribute data md state expand this el style maxheight var n this el getboundingclientrect height this el removeattribute data md state this el style maxheight 0px requestanimationframe function e el setattribute data md state animate e el style maxheight n px var r function e n var r n target if r instanceof htmlelement throw new referenceerror r removeattribute data md state r style maxheight r style display t none block r style overflow t hidden visible r removeeventlistener transitionend e this el addeventlistener transitionend r 1 e prototype reset function this el dataset mdstate this el style maxheight this el style display this el style overflow e t default i function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i function function e t r this e var n string typeof t document queryselector t t if n instanceof htmlelement throw new referenceerror this el n return e prototype setup function this el children this el children length 1 style webkitoverflowscrolling touch var e this el queryselectorall data md toggle array prototype foreach call e function e if e instanceof htmlinputelement throw new referenceerror if e checked var t e nextelementsibling if t instanceof htmlelement throw new referenceerror for nav t tagname t nextelementsibling t t nextelementsibling if e parentnode instanceof htmlelement e parentnode parentnode instanceof htmlelement throw new referenceerror var n e parentnode parentnode r t children t children length 1 n style webkitoverflowscrolling r style webkitoverflowscrolling touch e prototype update function e var t e target if t instanceof htmlelement throw new referenceerror var n t nextelementsibling if n instanceof htmlelement throw new referenceerror for nav n tagname n nextelementsibling n n nextelementsibling if t parentnode instanceof htmlelement t parentnode parentnode instanceof htmlelement throw new referenceerror var r t parentnode parentnode i n children n children length 1 if r style webkitoverflowscrolling i style webkitoverflowscrolling t checked var o function e n instanceof htmlelement r style webkitoverflowscrolling touch n removeeventlistener transitionend e n addeventlistener transitionend o 1 if t checked var a function e n instanceof htmlelement i style webkitoverflowscrolling touch n removeeventlistener transitionend e n addeventlistener transitionend a 1 e prototype reset function this el children 1 style webkitoverflowscrolling var e this el queryselectorall data md toggle array prototype foreach call e function e if e instanceof htmlinputelement throw new referenceerror if e checked var t e nextelementsibling if t instanceof htmlelement throw new referenceerror for nav t tagname t nextelementsibling t t nextelementsibling if e parentnode instanceof htmlelement e parentnode parentnode instanceof htmlelement throw new referenceerror var n e parentnode parentnode r t children t children length 1 n style webkitoverflowscrolling r style webkitoverflowscrolling e t default i function e t n use strict function r e return e e esmodule e default e t esmodule 0 var i n 32 o r i a n 33 s r a t default lock o default result s default function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i function function e t r this e var n string typeof t document queryselector t t if n instanceof htmlinputelement throw new referenceerror if this el n document body throw new referenceerror this lock document body return e prototype setup function this update e prototype update function var e this this el checked this offset window pageyoffset settimeout function window scrollto 0 0 e el checked e lock dataset mdstate lock 400 this lock dataset mdstate settimeout function void 0 e offset window scrollto 0 e offset 100 e prototype reset function lock this lock dataset mdstate window scrollto 0 this offset this lock dataset mdstate e t default i function e t n use strict function e function r e return e e esmodule e default e function i e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var o n 34 a r o s n 35 c r s u function e t var n t if e length n for e n n 0 return e substring 0 n return e l function e var t document getelementsbyname lang e 0 if t instanceof htmlmetaelement throw new referenceerror return t content d function function t e n i this t var r string typeof e document queryselector e e if r instanceof htmlelement throw new referenceerror this el r var o array prototype slice call this el children a o 0 s o 1 this data n this meta a this list s this message placeholder this meta textcontent none l search result none one l search result one other l search result other var u l search tokenizer u length c default tokenizer separator u this lang l search language split filter boolean map function e return e trim return t prototype update function t var n this if focus t type this index if focus t type keyup t type var r t target if r instanceof htmlinputelement throw new referenceerror if this index r value this value return for this list firstchild this list removechild this list firstchild if this value r value 0 this value length return void this meta textcontent this message placeholder var i this index query function e n value tolowercase split filter boolean foreach function t e term t wildcard c default query wildcard trailing reduce function e t var r n docs get t ref if r parent var i r parent location e set i e get i concat t else var o r location e set o e get o return e new map o 0 a default this value trim replace new regexp c default tokenizer separator img s new regexp c default tokenizer separator o img d function e t n return t n this stack i foreach function t r var i o n docs get r a e createelement li class md search result item e createelement a href o location title o title class md search result link tabindex 1 e createelement article class md search result article md search result article document e createelement h1 class md search result title html o title replace s d o text length e createelement p class md search result teaser html o text replace s d c t map function t return function var r n docs get t ref a appendchild e createelement a href r location title r title class md search result link data md rel anchor tabindex 1 e createelement article class md search result article e createelement h1 class md search result title html r title replace s d r text length e createelement p class md search result teaser html u r text replace s d 400 i n stack push apply i function return n list appendchild a concat c var f this el parentnode if f instanceof htmlelement throw new referenceerror for this stack length f offsetheight f scrollheight 16 this stack shift var h this list queryselectorall data md rel anchor switch array prototype foreach call h function e click keydown foreach function t e addeventlistener t function n if keydown t 13 n keycode var r document queryselector data md toggle search if r instanceof htmlinputelement throw new referenceerror r checked r checked 1 r dispatchevent new customevent change n preventdefault settimeout function document location href e href 100 i size case 0 this meta textcontent this message none break case 1 this meta textcontent this message one break default this meta textcontent this message other replace i size else var p function e n docs e reduce function e t var n t location split r n 0 return n 1 t parent e get r t parent t parent done t parent title t title t parent text t text t parent done 0 t text t text replace n g replace s g replace s g function e t return t t parent t parent title t title e set t location t e new map var t n docs r n lang n stack n index 0 c default function var e n this i search pipeline trimmer c default trimmer search pipeline stopwords c default stopwordfilter o object keys i reduce function e t return l t match false i e push i t e this pipeline reset o e this pipeline add apply e o 1 r length en r 0 c default r 0 this use c default r 0 r length 1 this use c default multilanguage apply c default r this field title boost 10 this field text this ref location t foreach function e return n add e var i n el parentnode if i instanceof htmlelement throw new referenceerror i addeventlistener scroll function for n stack length i scrolltop i offsetheight i scrollheight 16 n stack splice 0 10 foreach function e return e settimeout function return function typeof n data n data then p p n data 250 t t default d call t n 0 function e t n use strict var r g e exports function e if string typeof e throw new typeerror expected a string return e replace r function e t n function t e exports t lunr n 36 call t n 1 function e t n var r i function var o function e var t new o builder return t pipeline add o trimmer o stopwordfilter o stemmer t searchpipeline add o stemmer e call t t t build o version 2 1 5 o utils o utils warn function e return function t e console console warn console warn t this o utils asstring function e return void 0 e null e e tostring o fieldref function e t n this docref e this fieldname t this stringvalue n o fieldref joiner o fieldref fromstring function e var t e indexof o fieldref joiner if 1 t throw malformed field ref string var n e slice 0 t r e slice t 1 return new o fieldref r n e o fieldref prototype tostring function return void 0 this stringvalue this stringvalue this fieldname o fieldref joiner this docref this stringvalue o idf function e t var n 0 for var r in e index r n object keys e r length var i t n 5 n 5 return math log 1 math abs i o token function e t this str e this metadata t o token prototype tostring function return this str o token prototype update function e return this str e this str this metadata this o token prototype clone function e return e e function e return e new o token e this str this metadata this metadata o tokenizer function e if null e void 0 e return if array isarray e return e map function e return new o token o utils asstring e tolowercase for var t e tostring trim tolowercase n t length r i 0 a 0 i 0 r push new o token t slice a i position a c index r length a i 1 return r o tokenizer separator s o pipeline function this stack o pipeline registeredfunctions object create null o pipeline registerfunction function e t t in this registeredfunctions o utils warn overwriting existing registered function t e label t o pipeline registeredfunctions e label e o pipeline warniffunctionnotregistered function e e label e label in this registeredfunctions o utils warn function is not registered with pipeline this may cause problems when serialising the index n e o pipeline load function e var t new o pipeline return e foreach function e var n o pipeline registeredfunctions e if n throw new error cannot load unregistered function e t add n t o pipeline prototype add function array prototype slice call arguments foreach function e o pipeline warniffunctionnotregistered e this stack push e this o pipeline prototype after function e t o pipeline warniffunctionnotregistered t var n this stack indexof e if 1 n throw new error cannot find existingfn n 1 this stack splice n 0 t o pipeline prototype before function e t o pipeline warniffunctionnotregistered t var n this stack indexof e if 1 n throw new error cannot find existingfn this stack splice n 0 t o pipeline prototype remove function e var t this stack indexof e 1 t this stack splice t 1 o pipeline prototype run function e for var t this stack length n 0 n 1 o e n i o e r n t i t math floor r 2 o this elements 2 i return o e 2 i o e 2 i o s u 2 a s t n c 1 r u 1 c 2 u 2 return t o vector prototype similarity function e return this dot e this magnitude e magnitude o vector prototype toarray function for var e new array this elements length 2 t 1 n 0 t 0 var a s i str charat 0 s in i node edges a i node edges s a new o tokenset i node edges s a 1 i str length a final 0 r push node a editsremaining i editsremaining str i str slice 1 if i editsremaining 0 i str length 1 var c s i str charat 1 s in i node edges c i node edges s c new o tokenset i node edges s c i str length 0 1 i str length i node final 0 i editsremaining 0 i str length 1 if in i node edges var u i node edges else var u new o tokenset i node edges u 1 i str length u final 0 r push node u editsremaining i editsremaining 1 str i str slice 1 if i editsremaining 0 if in i node edges var l i node edges else var l new o tokenset i node edges l 0 i str length l final 0 r push node l editsremaining i editsremaining 1 str i str if i editsremaining 0 i str length 1 var d f i str charat 0 h i str charat 1 h in i node edges d i node edges h d new o tokenset i node edges h d 1 i str length d final 0 r push node d editsremaining i editsremaining 1 str f i str slice 2 return n o tokenset fromstring function e for var t new o tokenset n t r 1 i 0 a e length i e t var n this uncheckednodes t r n child tostring r in this minimizednodes n parent edges n char this minimizednodes r n child str r this minimizednodes r n child this uncheckednodes pop o index function e this invertedindex e invertedindex this fieldvectors e fieldvectors this tokenset e tokenset this fields e fields this pipeline e pipeline o index prototype search function e return this query function t new o queryparser e t parse o index prototype query function e var t new o query this fields n object create null r object create null i object create null e call t t for var a 0 a 1 1 e o builder prototype k1 function e this k1 e o builder prototype add function e var t e this ref this documentcount 1 for var n 0 n this length return o querylexer eos var e this str charat this pos return this pos 1 e o querylexer prototype width function return this pos this start o querylexer prototype ignore function this start this pos this pos 1 this start this pos o querylexer prototype backup function this pos 1 o querylexer prototype acceptdigitrun function var e t do e this next t e charcodeat 0 while t 47 t 1 e backup e emit o querylexer term e ignore e more return o querylexer lextext o querylexer lexeditdistance function e return e ignore e acceptdigitrun e emit o querylexer edit distance o querylexer lextext o querylexer lexboost function e return e ignore e acceptdigitrun e emit o querylexer boost o querylexer lextext o querylexer lexeos function e e width 0 e emit o querylexer term o querylexer termseparator o tokenizer separator o querylexer lextext function e for var t e next if t o querylexer eos return o querylexer lexeos if 92 t charcodeat 0 if t return o querylexer lexfield if t return e backup e width 0 e emit o querylexer term o querylexer lexeditdistance if t return e backup e width 0 e emit o querylexer term o querylexer lexboost if t match o querylexer termseparator return o querylexer lexterm else e escapecharacter o queryparser function e t this lexer new o querylexer e this query t this currentclause this lexemeidx 0 o queryparser prototype parse function this lexer run this lexemes this lexer lexemes for var e o queryparser parsefieldorterm e e e this return this query o queryparser prototype peeklexeme function return this lexemes this lexemeidx o queryparser prototype consumelexeme function var e this peeklexeme return this lexemeidx 1 e o queryparser prototype nextclause function var e this currentclause this query clause e this currentclause o queryparser parsefieldorterm function e var t e peeklexeme if void 0 t switch t type case o querylexer field return o queryparser parsefield case o querylexer term return o queryparser parseterm default var n expected either a field or a term found t type throw t str length 1 n with value t str new o queryparseerror n t start t end o queryparser parsefield function e var t e consumelexeme if void 0 t if 1 e query allfields indexof t str var n e query allfields map function e return e join r unrecognised field t str possible fields n throw new o queryparseerror r t start t end e currentclause fields t str var i e peeklexeme if void 0 i var r expecting term found nothing throw new o queryparseerror r t start t end switch i type case o querylexer term return o queryparser parseterm default var r expecting term found i type throw new o queryparseerror r i start i end o queryparser parseterm function e var t e consumelexeme if void 0 t e currentclause term t str tolowercase 1 t str indexof e currentclause usepipeline 1 var n e peeklexeme if void 0 n return void e nextclause switch n type case o querylexer term return e nextclause o queryparser parseterm case o querylexer field return e nextclause o queryparser parsefield case o querylexer edit distance return o queryparser parseeditdistance case o querylexer boost return o queryparser parseboost default var r unexpected lexeme type n type throw new o queryparseerror r n start n end o queryparser parseeditdistance function e var t e consumelexeme if void 0 t var n parseint t str 10 if isnan n var r edit distance must be numeric throw new o queryparseerror r t start t end e currentclause editdistance n var i e peeklexeme if void 0 i return void e nextclause switch i type case o querylexer term return e nextclause o queryparser parseterm case o querylexer field return e nextclause o queryparser parsefield case o querylexer edit distance return o queryparser parseeditdistance case o querylexer boost return o queryparser parseboost default var r unexpected lexeme type i type throw new o queryparseerror r i start i end o queryparser parseboost function e var t e consumelexeme if void 0 t var n parseint t str 10 if isnan n var r boost must be numeric throw new o queryparseerror r t start t end e currentclause boost n var i e peeklexeme if void 0 i return void e nextclause switch i type case o querylexer term return e nextclause o queryparser parseterm case o querylexer field return e nextclause o queryparser parsefield case o querylexer edit distance return o queryparser parseeditdistance case o querylexer boost return o queryparser parseboost default var r unexpected lexeme type i type throw new o queryparseerror r i start i end function o a r a void 0 i function typeof r r call t n t e r e exports i 0 function return o function e t n use strict t esmodule 0 var r n 38 i function e return e e esmodule e default e r t default position i default function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i function function e t n r this e var i string typeof t document queryselector t t if i instanceof htmlelement i parentnode instanceof htmlelement throw new referenceerror if this el i this parent i parentnode i string typeof n document queryselector n n instanceof htmlelement throw new referenceerror this header i this height 0 this pad fixed window getcomputedstyle this header position return e prototype setup function var e array prototype reduce call this parent children function e t return math max e t offsettop 0 this offset e this pad this header offsetheight 0 this update e prototype update function e var t window pageyoffset n window innerheight e resize e type this setup var r top this pad this header offsetheight 0 bottom this parent offsettop this parent offsetheight i n r top math max 0 this offset t math max 0 t n r bottom i this height this el style height this height i px t this offset lock this el dataset mdstate this el dataset mdstate lock lock this el dataset mdstate this el dataset mdstate e prototype reset function this el dataset mdstate this el style height this height 0 e t default i function e t n use strict function r e return e e esmodule e default e t esmodule 0 var i n 40 o r i a n 44 s r a t default adapter o default repository s default function e t n use strict t esmodule 0 var r n 41 i function e return e e esmodule e default e r t default github i default function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function function i e t if e throw new referenceerror this hasn t been initialised super hasn t been called return t object typeof t function typeof t e t function o e t if function typeof t null t throw new typeerror super expression must either be null or a function not typeof t e prototype object create t t prototype constructor value e enumerable 1 writable 0 configurable 0 t object setprototypeof object setprototypeof e t e proto t t esmodule 0 var a n 42 s function e return e e esmodule e default e a c function e function t n r this t var o i this e call this n a github com exec o base if a 3 a length var s a 1 c a 2 console log username s console log repository c o base https api github com users s repos o name c return o return o t e t prototype fetch function var e this return function t var n arguments length 0 void 0 arguments 0 arguments 0 0 return fetch e base per page 30 page n then function e return e json then function r if r instanceof array throw new typeerror if e name var i r find function t return t name e name return i 30 r length i e format i stargazers count stars e format i forks count forks t n 1 return r length repositories t s default t default c function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i n 43 o function e return e e esmodule e default e i a function function e t r this e var n string typeof t document queryselector t t if n instanceof htmlanchorelement throw new referenceerror this el n this base this el href this salt this hash this base return e prototype fetch function var e this return new promise function t var n o default getjson e salt cache source void 0 n t n e fetch then function n o default set e salt cache source n expires 1 96 t n e prototype fetch function throw new error fetch not implemented e prototype format function e return e 1e4 e 1e3 tofixed 0 k e 1e3 e 1e3 tofixed 1 k e e prototype hash function e var t 0 if 0 e length return t for var n 0 r e length n 1 if o e path r defaults o number typeof o expires var s new date s setmilliseconds s getmilliseconds 864e5 o expires o expires s o expires o expires o expires toutcstring try a json stringify i test a i a catch e i n write n write i t encodeuricomponent string i replace 23 24 26 2b 3a 3c 3e 3d 2f 3f 40 5b 5d 5e 60 7b 7d 7c g decodeuricomponent t encodeuricomponent string t t t replace 23 24 26 2b 5e 60 7c g decodeuricomponent t t replace g escape var c for var u in o o u c u 0 o u c o u return document cookie t i c t a for var l document cookie document cookie split d 0 9a z 2 g f 0 f this el children 0 offsettop 43 e this active this el dataset mdstate this active e hidden e prototype reset function this el dataset mdstate this active 1 e t default i", "title": ""},{"location": "/archive/", "text": "news archive for post in site posts capture this year post date date y endcapture capture next year post previous date date y endcapture if forloop first this year endif post date date b d y post title if forloop last else if this year next year next year endif endif endfor", "title": "Articles"},{"location": "/feed.xml", "text": "site title xml escape site description xml escape site url site baseurl site time date to rfc822 site time date to rfc822 jekyll v jekyll version for post in site posts limit 10 post title xml escape post content xml escape post date date to rfc822 post url prepend site baseurl prepend site url post url prepend site baseurl prepend site url for tag in post tags tag xml escape endfor for cat in post categories cat xml escape endfor endfor", "title": ""},{"location": "/", "text": "turing jl bayesian inference with probabilistic programming for f in page main feature row f title f excerpt markdownify endfor hello world in turing linear gaussian model page code sample excerpt markdownify quick start highlight julia page code sample snippet endhighlight news feed for post in site posts limit 10 post title post date date b d y endfor news advanced markov chain monte carlo samplers page samplers excerpt markdownify samplers interoperable with deep learning libraries page flux excerpt markdownify bayesian neural network tutorial page community title page community subtitle for f in page community comunities f title f text markdownify go to f title endfor page ecosystem title page ecosystem subtitle for f in page ecosystem ecosystems f title f text go to f title endfor", "title": "Turing.jl - Turing.jl"},{"location": "/news/", "text": "newssubscribe with rss to keep up with the latest news about turing for post in site posts limit 10 if post draft null or post draft false post title post date date b d y if post badges for badge in post badges badge tag endfor endif post excerpt read more endif endfor want to see more see the news archive", "title": "News"},{"location": "/search/search_index.json", "text": "config lang en prebuild index false separator s docs for page in site pages unless page excluded in search if added endif assign added false location page url text page content strip html strip newlines slugify ascii replace title page title assign added true endunless endfor for post in site posts unless page excluded in search if added endif assign added false location post url text post content strip html strip newlines slugify ascii replace title post title assign added true endunless endfor for doc in site docs unless doc excluded in search if added endif assign added false location doc url text doc content strip html strip newlines slugify ascii replace title doc title assign added true endunless endfor", "title": ""},{"location": "/sitemap.xml", "text": "now date y m d daily for section in site data toc site baseurl section url now date y m d daily endfor", "title": ""},{"location": "/robots.txt", "text": "sitemap sitemap xml absolute url", "title": ""},{"location": "/feed.xml", "text": "if page xsl endif jekyll site time date to xmlschema page url absolute url xml escape assign title site title default site name if page collection posts assign collection page collection capitalize assign title title append append collection endif if page category assign category page category capitalize assign title title append append category endif if title title smartify xml escape endif if site description site description xml escape endif if site author site author name default site author xml escape if site author email site author email xml escape endif if site author uri site author uri xml escape endif endif if page tags assign posts site tags page tags else assign posts site page collection endif if page category assign posts posts where category page category endif unless site show drafts assign posts posts where exp post post draft true endunless assign posts posts sort date reverse assign posts limit site feed posts limit default 10 for post in posts limit posts limit assign post title post title smartify strip html normalize whitespace xml escape post title post date date to xmlschema post last modified at default post date date to xmlschema post id absolute url xml escape assign excerpt only post feed excerpt only default site feed excerpt only unless excerpt only post content strip xml escape endunless assign post author post author default post authors 0 default site author assign post author site data authors post author default post author assign post author email post author email default nil assign post author uri post author uri default nil assign post author name post author name default post author post author name default xml escape if post author email post author email xml escape endif if post author uri post author uri xml escape endif if post category elsif post categories for category in post categories endfor endif for tag in post tags endfor if post excerpt and post excerpt empty post excerpt strip html normalize whitespace xml escape endif assign post image post image path default post image if post image unless post image contains assign post image post image absolute url endunless endif endfor", "title": ""},{"location": "/posts/2022-02-17-gsoc", "text": "it is another year of the google summer of code time and we have compiled an updated list of exciting turing projects projects that the turing team would be interested in working with students on over the summer are listed below this information is also cross posted at julia s turing project page if you are interested in exploring any of these projects or have any questions please reach out to the listed project mentors you can find their contact information at turing ml team more real world bayesian models in turing juliamentors kai xu tor e fjelde hong geproject difficulty mediumproject length 175 hrs or 350 hrsdescription there are many real world bayesian models out there and they deserve a turing julia implementation examples include but not limited toforecasting prophet datasets recommender system probabilistic matrix factorisation dataset ranking trueskill dataset bayesian revenue estimation example political forecasting model example topic mining latent dirichlet allocation and new variants multiple annotators combining unreliable observations dawid and skene 1979 for each model we would consider the following tasks as part of a gsoc project correctness test correctness of the implementation can be tested by doing inference for prior samples for which we know the ground truth latent variables performance benchmark this includes i time per mcmc step and ii time per effective sample if the model is differentiable a further break down of i into i 1 time per forward pass and i 2 time per gradient pass are needed real world results if available the final step is to apply the model to a real world dataset if such an experiment has been done in the literature consistency of inference results needs to be checkedimproving the integration between turing and turing s mcmc inference packagesmentors cameron pfiffer mohamed tarek david widmannproject difficulty easyproject length 175 hrsdescription turing jl is based on a set of inference packages maintained by the turinglang group this project is about making use of improvements in dynamicppl to create a generic integration between turing jl and the abstractmcmc jl sampling api the ultimate goal is to remove or substantially reduce algorithm specific glue code inside turing jl the project would also involve improving data structures for storing model parameters in dynamicppl directed graphical model support for the abstract probabilistic programming librarymentors philipp gabler hong geproject difficulty hardproject length 350 hrsdescription we want to have a very light weight representation of probabilistic models of static graphs similar to bugs which can serve as a representation target of other front end dsls or be dynamically built the representation should consist of the model and node representations stochastic and deterministic perhaps hyperparameters and conform to the abstractppl model interface with basic functions evaluation of density sampling conditioning at later stages some static analysis like extraction of markov blankets the model should also contain the state of the variables and implement the abstractppl trace interface dictionary functions querying of variable names the result should be able to work with existing sampling packages through the abstract interfaces a modular tape caching mechanism for reversediffmentors qingliang zhuo mohamed tarekproject difficulty mediumproject length 175 hrsdescription tape caching often leads to significant performance improvements for gradient based sampling algorithms e g hmc nuts tape caching is only possible at the complete computational level for reversediff at the moment this project is about implementing a more modular i e function as a caching barrier tape caching mechanism for reversediff jl benchmarking amp improving performance of the juliagaussianprocesses librariesmentors theo galy fajou will tebbutt st johnproject difficulty mediumproject length 350 hrsdescription although kernelfunctions jl has extensive correctness testing our performance testing is lacking this project aims to resolve this and resolve performance issues wherever they are found the student would first need to extend our existing benchmarking coverage and debug any obvious performance problems the next phase of the work would be to construct end to end examples of kernelfunctions being used in practice profile them to determine where performance problems lie and fix them iterative methods for inference in gaussian processesmentors will tebbutt s t john ross viljoenproject difficulty mediumproject length 175 hrsdescription there has recently been quite a bit of work on inference methods for gps that use iterative methods rather than the cholesky factorisation they look quite promising but no one has implemented any of these within the julia gp ecosystem yet but they should fit nicely within the abstractgps framework if you re interested in improving the gp ecosystem in julia this project might be for you approximate inference methods for non gaussian likelihoods in gaussian processesmentors s t john ross viljoen theo galy fajouproject difficulty hardproject length 350 hrsdescription adding approximate inference methods for non gaussian likelihoods which are available in other gp packages but not yet within juliagps the project would start by determining which approximate inference method s to implement there s lots to do and we re happy to work with a student on whichever method they are most interested in or to suggest one if they have no strong preference gpu integration in the juliagps ecosystemmentors ross viljoen theo galy fajou will tebbuttproject difficulty mediumproject length 350 hrsdescription this would involve first ensuring that common models are able to run fully on the gpu then identifying and improving gpu specific performance bottlenecks this would begin by implementing a limited end to end example involving a gp with a standard kernel and profiling it to debug any substantial performance bottlenecks from there support for a wider range of the functionality available in kernelfunctions jl and abstractgps jl can be added stretch goal extension of gpu support to some functionality in approximategps jl", "title": "Google Summer of Code 2022"},{"location": "/posts/2021-02-04-gsoc", "text": "it s about time for us to start thinking about projects we d like to see at turing jl for the google summer of code 2021 below is a list of projects the turing team would be interested in working with students on for the summer if you are interested in exploring any of these projects please reach out to the listed project mentors you can find their contact information at turing ml team mcmcchains improvementsmentors cameron pfiffer hong geproject difficulty easydescription mcmcchains is a key component of the turing jl ecosystem it is the package that determines how to analyze and store mcmc samples provided by packages like turing it s also used outside of turing for this project a student might improve the performance of the various statistical functions provided by mcmcchains changing the back end to use a data storage format that maintains the shape of parameter samples or improve the general plotting functionality of the package there s lots of fun little things to do for mcmcchains check out this meta issue for more details and dicussions particle filtering methodsmentors hong ge cameron pfifferproject difficulty mediumdescription turing s support for particle sampling methods is slowing being improved with the addition of advancedps jl if you re interested in implementing or improving particle sampling methods this is a great project for you nested samplingmentors miles lucas cameron pfiffer hong geproject difficulty harddescription nestedsamplers jl is an excellent package which implements nested sampling methods as of yet it is not connected to turing jl for this project a student would connect the nestedsamplers jl library to turing jl gpu accelerationmentors mohamed tarek hong ge kai xu tor fjeldeproject difficulty mediumdescription turing s native gpu support is limited in that the metropolis hastings and hmc samplers do not implement gpu sampling methods this can and should be done gpu methods are awesome if you are interested with working on parallelism and gpus this project is for you students will work with the code at advancedmh or advancedhmc depending on their interests documentation and tutorial improvementsmentors cameron pfiffer martin trappproject difficulty easydescription turing s documentation and tutorials need a bit of an overhaul turing has changed significantly since the last time the documentation was written and it s beginning to show students would use their knowledge of probabilistic programming languages and turing to shore up or rewrite documentation and tutorials iterative methods for inference in gaussian processesmentors will tebbutt s t john theo galy fajouproject difficulty mediumdescription there has recently been quite a bit of work on inference methods for gps that use iterative methods rather than the cholesky factorisation they look quite promising but no one has implemented any of these within the julia gp ecosystem yet but they should fit nicely within the abstractgps framework if you re interested in improving the gp ecosystem in julia this project might be for you implement advanced variational gaussian process modelsmentors st john will tebbutt theo galy fajouproject difficulty easy to mediumdescription sparse variational gaussian process models provide the flexibility to scale to large datasets handle arbitrary non conjugate likelihoods and to be used as building blocks for composite models such as deep gps this project is about making such models more readily available within the julia gp ecosystem depending on your interests you can focus on making it easier for end users and providing good tutorials or on the implementations of these models to give us the same or better performance as with established python packages such as gpflow integrating with flux jl etc", "title": "Google Summer of Code 2021"},{"location": "/posts/2020-09-11-gsoc", "text": "as the 2020 google summer of code comes to a close the turing team thought it would be a good opportunity to reflect on the work that was done by our superb students this summer saranjeet kaur s project focused primarily on expanding nestedsamplers jl nestedsamplers jl now supports polychord style nested sampling natively which is an absolute delight saranjeet wrote about this here she also provided a good tutorial on how to use nestedsamplers jl here the nestedsamplers jl integration with turing is still on going integrating new samplers with turing is one of the more difficult tasks if you are interested to see the progress on this check out the relevant pull request arthur lui s project was to provide a much needed set of benchmarks of bayesian nonparametric models between turing and other ppls arthur s work spawned a github repository with good practices for benchmarking as well as three blog posts with some very cool statistics on turing s performance dirichlet process gaussian mixture model via the stick breaking construction in various pplsgaussian process regression model in various pplsgaussian process classification model in various pplsfinally sharan yalburgi a returning gsoc student completed an epic amount of work turing s growing suite of gaussian process tools in particular the github organization juliagaussianprocesses was founded and serves as an effort to build a robust gaussian process framework for the julia ecosystem the framework consists of multiple gp related julia packages kernelfunctions jl provides kernel functions for gps as well as efficient ad for these kernels kernelfunctions jl also supports multi output gps by providing necessary data abstractions and multi output kernels abstractgps jl defines gp abstractions and provides exact posteriors it provides support for induced points based gp posteriors and for efficient sequential online sparse gp updates gplikelihoods jl defines alternate likelihoods for non gaussian gps gpmlj jl provides a julia interface for gpflow a gp library written in python using tensorflow special thanks to our three gsoc students for this summer who all did excellent work additional thanks to google for supporting open source software development and the julia language", "title": "Google Summer of Code 2020"},{"location": "/posts/2020-05-04-Imperial-Report13-analysis", "text": "the turing jl team is currently exploring possibilities in an attempt to help with the ongoing sars cov 2 crisis as preparation for this and to get our feet wet we decided to perform a replication study of the imperial report 13 which attempts to estimate the real number of infections and impact of non pharmaceutical interventions on covid 19 in the report the inference was performed using the probabilistic programming language ppl stan we have explicated their model and inference in turing jl a julia based ppl we believe the results and analysis of our study are relevant for the public and for other researchers who are actively working on epidemiological models to that end our implementation and results are available here in summary we replicated the imperial covid 19 model using turing jl subsequently we compared the inference results between turing and stan and our comparison indicates that results are reproducible with two different implementations in particular we performed 4 sets of simulations using the imperial covid 19 model the resulting estimates of the expected real number of cases in contrast to the recorded number of cases the reproduction number r t and the expected number of deaths as a function of time and non pharmaceutical interventions npis for each simulation are shown below simulation a hypothetical simulation from the model without data prior predictive or non pharmaceutical interventions under the prior assumptions of the imperial covid 19 model there is a very wide range of epidemic progressions with expected cases from almost 0 to 100 of the population over time the black bar corresponds to the date of the last observation note that r t has a different time range than the other plots following the original report this shows the 100 days following the country specific epidemic start which is defined to be 31 days prior to the first date of 10 cumulative deaths while the other plots show the last 60 days simulation b future simulation with non pharmaceutical interventions kept in place posterior predictive after incorporating the observed infection data we can see a substantially more refined range of epidemic progression the reproduction rate estimate lies in the range of 3 5 5 6 before any intervention is introduced the dotted lines correspond to observations and the black bar corresponds to the date of the last observation simulation c future simulation with non pharmaceutical interventions removed now we see the hypothetical scenarios after incorporating infection data but with non pharmaceutical interventions removed this plot looks similar to simulation a but with a more rapid progression of the pandemic since the estimated reproduction rate is bigger than the prior assumptions the dotted lines correspond to observations and the black bar corresponds to the date of the last observation simulation d future simulation with when lockdown is lifted two weeks before the last observation predictive posterior as a result there is a clear rapid rebound of the reproduction rate comparing with simulation b we do not observe an immediate increase in the number of expected cases and deaths upon lifting lockdown but there is a significant difference in the number of cases and deaths in the last few days in the plot simulation d results in both greater number of cases and deaths as expected this demonstrates how the effects of lifting an intervention might not become apparent in the measurable variables e g deaths until several weeks later the dotted lines correspond to observations the black bar corresponds to the date of the last observation and the red bar indicates when lockdown was lifted overall simulation a shows the prior modelling assumptions and how these prior assumptions determine the predicted number of cases etc before seeing any data simulation b predicts the trend of the number of cases etc using estimated parameters and by keeping all the non pharmaceutical interventions in place simulation c shows the estimate in the case where none of the intervention measures are ever put in place simulation d shows the estimates in the case when the lockdown was lifted two weeks prior to the last observation while keeping all the other non pharmaceutical interventions in place we want to emphasise that we do not provide additional analysis of the imperial model yet nor are we aiming to make any claims about the validity or the implications of the model instead we refer to imperial report 13 for more details and analysis the purpose of this post is solely to add validation to the inference performed in the paper by obtaining the same results using a different probabilistic programming language ppl and by exploring whether or not turing jl can be useful for researchers working on these problems for our next steps we re looking at collaboration with other researchers and further developments of this and similar models there are some immediate directions to explore incoporation of more sources of data e g national mobility seasonal changes and behavior changes in individuals how the assumptions incorporated into the priors and their parameters change resulting posterior the current model does not directly include recovery as a possibility and assumes that if a person has been infected once then he she will be infectious until death number of recovered cases suffers from the same issues as the number of cases it cannot be directly observed but we can also deal with it in a similar manner as is done with number of cases and incorporate this into the model for a potential improvement this will result in a plethora of different models from which we can select the most realistic one using different model comparions techniques e g leave one out cross validation loo cv such model refinement can be potentially valuable given the high impact of this pandemic and the uncertainty and debates in the potential outcomes acknowledgement we would like to thank the julia community for creating such an excellent platform for scientific computing and for the continuous feedback that we have received we also thank researchers from computational and biological laboratory at cambridge university for their feedback on an early version of the post", "title": "Replication study: Estimating number of infections and impact of NPIs on COVID-19 in European countries (Imperial Report 13)"},{"location": "/posts/2020-02-12-jsoc", "text": "last year turing participated in the google summer of code gsoc through the julia language organization it was a fun time and the project was better for it turing plans to participate in the upcoming gsoc and we wanted to outline some potential projects and expectations we have for applicants if you are not aware google provides funds to students around the world to develop a project of their choice over the summer students receive funds from google and spend three months on any open source project the turing development team has prepared a list of possible projects that we have deemed valuable to the project and easy enough that it could feasibly be created in the three month limit this list is not exlusive if you have a good idea you can write it up in your proposal though it is recommend that you reach out to any of the turing team on julia s slack you can get an invite here or discourse messages on discourse should be posted to the quot probabilistic programming quot category we ll find you possible project ideas benchmarking turing s performance has been sporadically benchmarked against various other probabilistic programming languages e g turing stan pymc3 tensorflow prob but a systemic approach to studying where turing excels and where it falls short would be useful a gsoc student would implement identical models in many ppls and build tools to benchmark all ppls against one another nested sampling integration turing focuses on modularity in inference methods and the development team would like to see more inference methods particularly the popular nested sampling method a julia package nestedsamplers jl but it is not hooked up to turing and does not currently have a stable api a gsoc student would either integrate that package or construct their own nested sampling method and build it into turing automated function memoization by model annotation function memoization is a way to reduce costly function evaluation by caching the output when the same inputs are given turing s gibbs sampler often ends up rerunning expensive functions multiple times and it would be a significant performance improvement to allow turing s model compiler to automatically memoize functions where appropriate a student working on this project would become intimately familiar with turing s model compiler and build in various automated improvements making distributions gpu compatible julia s gpu tooling is generally quite good but currently turing is not able to reliably use gpus while sampling because distributions jl is not gpu compatible a student on this project would work with the turing developers and the distributions developers to allow the use of gpu parallelism where possible in turing static distributions small fixed size vectors and matrices are fairly common in turing models this means that sampling in turing can probably benefit from using statically sized vectors and matrices from staticarrays jl instead of the dynamic normal julia arrays beside the often superior performance of small static vectors and matrices static arrays are also automatically compatible with the gpu stack in julia currently the main obstacle to using staticarrays jl is that distributions in distributions jl are not compatible with staticarrays a gsoc student would adapt the multivariate and matrix variate distributions as well as the univariate distribution with vector parameters in distributions jl to make a spin off package called staticdistributions jl the student would then benchmark staticdistributions jl against distributions jl and showcase an example of using staticdistributions jl together with cuarrays jl and or cudanative jl for gpu acceleration gpnet extensions one of turing s sattelite packages gpnet is designed to provide a comprehensive suite of gaussian process tools see this issue for potential tasks there s a lot of interesting stuff going on with gps and this task in particular may have some creative freedom to it better chains and model diagnostics one package that turing and many others rely on heavily is mcmcchains jl a package designed to format store and analyze parameter samples generated during mcmc inference mcmcchains is currently showing its age a little and has many bad design choices that need to be fixed alternatively a student could contstruct a far more lightweight chain system model comparison tools turing and its sattelite packages do not currently provide a comprehensive suite of model comparison tools a critical tool for the applied statistician a student who worked on this project would implement various model comparison tools like loo and waic among others mle map tools maximum likelihood estimates mle and maximum a posteriori map estimates can currently only be done by users through a clunky set of workarounds a streamlined function like mle model or map model would be very useful for many of turing s users who want to see what the mle or map estimates look like and it may be valuable to allow for functionality that allows mcmc sampling to begin from the mle or map estimates students working on this project will work with optimization packages such as optim jl to make mle and map estimation straightforward for turing models particle sampler improvements turing s development team has spent a lot of time and energy to make inference methods more modular but turing s particle samplers have not yet been modernized and spun off into a separate package two packages that resulted from this were advancedhmc for hamiltonian mcmc methods and advancedmh for metropolis hastings style inference methods a student who worked on this project would become very familiar with turing s inference backend and with particle sampling methods this is a good project for people who love making things efficient and easily extendable other projects are welcome but we do strongly recommend discussing any potential projects with members of the turing team as they will end up mentoring gsoc students for the duration of the project we re looking forward to what people are interested in", "title": "Google Summer of Code/Julia Summer of Code"},{"location": "/posts/2019-12-14-initial-post", "text": "all good open source projects should have a blog and turing is one such project later on members of the turing team may be populating this feed with posts on topics likeinteresting things you can do with turing or interesting things we have seen others do development updates and major release announcements research updates explorations of turing s internals updates to turing s sattelite projects advancedhmc jl or bijectors jl stay tuned", "title": "Turing's Blog"},{"location": "/docs/library/advancedhmc/", "text": "indexadvancedhmc abstractintegratoradvancedhmc abstractmcmckerneladvancedhmc abstractmetricadvancedhmc abstractterminationcriterionadvancedhmc abstracttrajectorysampleradvancedhmc binarytreeadvancedhmc classicnouturnadvancedhmc dynamicterminationcriterionadvancedhmc endpointtsadvancedhmc fixedintegrationtimeadvancedhmc fixednstepsadvancedhmc fullmomentumrefreshmentadvancedhmc generalisednouturnadvancedhmc hmcadvancedhmc hmcdaadvancedhmc hmcprogresscallbackadvancedhmc hmcsampleradvancedhmc hmcstateadvancedhmc jitteredleapfrogadvancedhmc leapfrogadvancedhmc multinomialts advancedhmc multinomialts dev docs library advancedhmc advancedhmc multinomialts tuple multinomialts abstractfloat advancedhmc phasepoint advancedhmc multinomialts dev docs library advancedhmc advancedhmc multinomialts tuple random abstractrng advancedhmc phasepoint advancedhmc nutsadvancedhmc partialmomentumrefreshmentadvancedhmc slicets advancedhmc slicets dev docs library advancedhmc advancedhmc slicets tuple random abstractrng advancedhmc phasepoint advancedhmc slicets dev docs library advancedhmc advancedhmc slicets tuple slicets abstractfloat advancedhmc phasepoint advancedhmc staticterminationcriterionadvancedhmc strictgeneralisednouturnadvancedhmc temperedleapfrog advancedhmc termination dev docs library advancedhmc advancedhmc termination union tuple f tuple slicets trajectory f f where f lt abstractfloat advancedhmc termination dev docs library advancedhmc advancedhmc termination union tuple f tuple multinomialts trajectory f f where f lt abstractfloat advancedhmc terminationadvancedhmc trajectoryadvancedhmc transition advancedhmc a dev docs library advancedhmc advancedhmc a tuple any any any advancedhmc build tree dev docs library advancedhmc advancedhmc build tree union tuple tc tuple i tuple ts tuple random abstractrng trajectory ts i tc hamiltonian advancedhmc phasepoint advancedhmc abstracttrajectorysampler int64 int64 abstractfloat where ts lt advancedhmc abstracttrajectorysampler i lt advancedhmc abstractintegrator tc lt advancedhmc dynamicterminationcriterion advancedhmc check left subtree dev docs library advancedhmc advancedhmc check left subtree union tuple t tuple hamiltonian t t t where t lt advancedhmc binarytree advancedhmc check right subtree dev docs library advancedhmc advancedhmc check right subtree union tuple t tuple hamiltonian t t t where t lt advancedhmc binarytree advancedhmc combine dev docs library advancedhmc advancedhmc combine tuple advancedhmc binarytree advancedhmc binarytree advancedhmc determine sampler eltype advancedhmc find good stepsize dev docs library advancedhmc advancedhmc find good stepsize union tuple t tuple random abstractrng hamiltonian abstractvector t where t lt real advancedhmc isterminated dev docs library advancedhmc advancedhmc isterminated tuple classicnouturn hamiltonian advancedhmc binarytree advancedhmc isterminated dev docs library advancedhmc advancedhmc isterminated tuple strictgeneralisednouturn hamiltonian any any any advancedhmc isterminated dev docs library advancedhmc advancedhmc isterminated tuple generalisednouturn hamiltonian advancedhmc binarytree advancedhmc maxabs dev docs library advancedhmc advancedhmc maxabs tuple any any advancedhmc mh accept ratio dev docs library advancedhmc advancedhmc mh accept ratio union tuple t tuple random abstractrng t t where t lt abstractfloat advancedhmc nom step size advancedhmc pm next dev docs library advancedhmc advancedhmc pm next tuple any namedtuple advancedhmc randcat dev docs library advancedhmc advancedhmc randcat union tuple t tuple union random abstractrng abstractvector var quot s9 quot where var quot s9 quot lt random abstractrng abstractmatrix t where t advancedhmc sampler eltype advancedhmc simple pm next dev docs library advancedhmc advancedhmc simple pm next tuple any namedtuple advancedhmc statadvancedhmc step size advancedhmc temper dev docs library advancedhmc advancedhmc temper tuple temperedleapfrog any namedtuple i is half var quot s17 quot where var quot s17 quot lt tuple integer bool int64 advancedhmc transition dev docs library advancedhmc advancedhmc transition tuple trajectory hamiltonian advancedhmc phasepoint advancedhmc update nom step sizefunctions advancedhmc a method a single hamiltonian integration step note this function is intended to be used in find good stepsize only advancedhmc build tree method recursivly build a tree for a given depth j advancedhmc check left subtree method check left subtree h t tleft tright do a u turn check between the leftmost phase point of t and the leftmost phase point of tright the right subtree advancedhmc check right subtree method check right subtree h t tleft tright do a u turn check between the rightmost phase point of t and the rightmost phase point of tleft the left subtree advancedhmc combine method combine treeleft treeright merge a left tree treeleft and a right tree treeright under given hamiltonian h then draw a new candidate sample and update related statistics for the resulting tree advancedhmc determine sampler eltype method determine sampler eltype xs determine the element type to use for the given arguments symbols are either resolved to the default float type or simply dropped in favour of determined types from the other arguments advancedhmc find good stepsize method find a good initial leap frog step size via heuristic search advancedhmc isterminated method isterminated h t detect u turn for two phase points zleft and zright under given hamiltonian h using the original no u turn cirterion ref https arxiv org abs 1111 4246 https arxiv org abs 1701 02434 advancedhmc isterminated method isterminated h t detect u turn for two phase points zleft and zright under given hamiltonian h using the generalised no u turn criterion ref https arxiv org abs 1701 02434 advancedhmc isterminated method isterminated tc h t tleft tright detect u turn for two phase points zleft and zright under given hamiltonian h using the generalised no u turn criterion with additional u turn checks ref https arxiv org abs 1701 02434 https github com stan dev stan pull 2800 advancedhmc maxabs method maxabs a b return the value with the largest absolute value advancedhmc mh accept ratio method perform mh acceptance based on energy i e negative log probability advancedhmc nom step size method nom step size abstractintegrator get the nominal integration step size the current integration step size may differ from this for example if the step size is jittered nominal step size is usually used in adaptation advancedhmc pm next method progress meter update with all trajectory stats iteration number and metric shown advancedhmc randcat method randcat rng p abstractmatrix generating categorical random variables in a vectorized mode p is supposed to be a matrix of d n where each column is a probability vector examplep 0 5 0 3 0 4 0 6 0 1 0 1 u 0 3 0 4 c 0 5 0 3 0 9 0 9 1 0 1 0 then c lt u is 0 1 0 0 0 0 thus convert int vec sum c lt u dims 1 1 equals 1 2 advancedhmc sampler eltype function sampler eltype sampler return the element type of the sampler advancedhmc simple pm next method simple progress meter update without any show values advancedhmc stat method returns the statistics for transition t advancedhmc step size function step size abstractintegrator get the current integration step size advancedhmc temper method temper lf temperedleapfrog r step namedtuple i is half lt tuple integer bool n steps int tempering step step is a named tuple withi being the current leapfrog iteration andis half indicating whether or not it s the first half momentum tempering step advancedhmc transition method transition h z make a mcmc transition from phase point z using the trajectory under hamiltonian h note this is a rng implicit fallback function for transition global rng h z advancedhmc update nom step size function update nom step size i abstractintegrator gt abstractintegratorreturn a copy of the integrator i with the new nominal step size nom step size statsbase sample method sample rng abstractrng h hamiltonian abstractmcmckernel abstractvecormat t n samples int adaptor abstractadaptor noadaptation n adapts int min div n samples 10 1 000 drop warmup bool false verbose bool true progress bool false sample n samples samples using the proposal under hamiltonian h the randomness is controlled by rng if rng is not provided global rng will be used the initial point is given by the adaptor is set by adaptor for which the default is no adaptation it will perform n adapts steps of adaptation for which the default is the minimum of 1 000 and 10 of n samplesdrop warmup controls to drop the samples during adaptation phase or notverbose controls the verbosityprogress controls whether to show the progress meter or nottypes advancedhmc abstractintegrator type abstract type abstractintegratorrepresents an integrator used to simulate the hamiltonian system implementationa abstractintegrator is expected to have the following implementations stat ref nom step size ref step size ref advancedhmc abstractmcmckernel type abstract type abstractmcmckernelabstract type for hmc kernels advancedhmc abstractmetric type abstract type abstractmetricabstract type for preconditioning metrics advancedhmc abstractterminationcriterion type abstract type abstractterminationcriterionabstract type for termination criteria for hamiltonian trajectories e g no u turn and fixed number of leapfrog integration steps advancedhmc abstracttrajectorysampler type how to sample a phase point from the simulated trajectory advancedhmc binarytree type a full binary tree trajectory with only necessary leaves and information stored advancedhmc classicnouturn type struct classicnouturn f lt abstractfloat lt advancedhmc dynamicterminationcriterionclassic no u turn criterion as described in eq 9 in 1 informally this will terminate the trajectory expansion if continuing the simulation either forwards or backwards in time will decrease the distance between the left most and right most positions fieldsmax depth int64 max abstractfloatreferenceshoffman m d amp gelman a 2014 the no u turn sampler adaptively setting path lengths in hamiltonian monte carlo journal of machine learning research 15 1 1593 1623 arxiv advancedhmc dynamicterminationcriterion type abstract type dynamicterminationcriterion lt advancedhmc abstractterminationcriterionabstract type for dynamic hamiltonian trajectory termination criteria advancedhmc endpointts type samples the end point of the trajectory advancedhmc fixedintegrationtime type struct fixedintegrationtime f lt abstractfloat lt advancedhmc staticterminationcriterionstandard hmc implementation with a fixed integration time fields abstractfloat total length of the trajectory i e take floor integrator step size number of leapfrog steps referencesneal r m 2011 mcmc using hamiltonian dynamics handbook of markov chain monte carlo 2 11 2 arxiv advancedhmc fixednsteps type struct fixednsteps lt advancedhmc staticterminationcriterionstatic hmc with a fixed number of leapfrog steps fieldsl int64 number of steps to simulate i e length of trajectory will be l 1 referencesneal r m 2011 mcmc using hamiltonian dynamics handbook of markov chain monte carlo 2 11 2 arxiv advancedhmc fullmomentumrefreshment type completly resample new momentum advancedhmc generalisednouturn type struct generalisednouturn f lt abstractfloat lt advancedhmc dynamicterminationcriteriongeneralised no u turn criterion as described in section a 4 2 in 1 fieldsmax depth int64 max abstractfloatreferencesbetancourt m 2017 a conceptual introduction to hamiltonian monte carlo arxiv preprint arxiv 1701 02434 advancedhmc hmc type hmc real n leapfrog int hamiltonian monte carlo sampler with static trajectory fieldsn leapfrog number of leapfrog steps integrator choice of integrator specified either using a symbol or abstractintegratormetric choice of initial metric symbol means it is automatically initialised the metric type will be preserved during automatic initialisation and adaption advancedhmc hmcda type hmcda real real integrator leapfrog metric diagonal hamiltonian monte carlo sampler with dual averaging algorithm fields target acceptance rate for dual averaging target leapfrog length integrator choice of integrator specified either using a symbol or abstractintegratormetric choice of initial metric symbol means it is automatically initialised the metric type will be preserved during automatic initialisation and adaption notesfor more information please view the following paper arxiv link hoffman matthew d and andrew gelman quot the no u turn sampler adaptively setting path lengths in hamiltonian monte carlo quot journal of machine learning research 15 no 1 2014 1593 1623 advancedhmc hmcprogresscallback type hmcprogresscallbacka callback to be used with abstractmcmc jl s interface replicating the logging behavior of the non abstractmcmc sample dev docs library advancedhmc statsbase sample union tuple t tuple union random abstractrng abstractvector var quot s318 quot where var quot s318 quot lt random abstractrng hamiltonian hmckernel t int64 tuple union random abstractrng abstractvector var quot s319 quot where var quot s319 quot lt random abstractrng hamiltonian hmckernel t int64 advancedhmc adaptation abstractadaptor tuple union random abstractrng abstractvector var quot s320 quot where var quot s320 quot lt random abstractrng hamiltonian hmckernel t int64 advancedhmc adaptation abstractadaptor int64 where t lt abstractvecormat var quot s317 quot where var quot s317 quot lt abstractfloat fieldspm progress meter from progressmeters jl progress specifies whether or not to use display a progress bar verbose if progress is not specified and this is true some information will be logged upon completion of adaptation num divergent transitions number of divergent transitions fo far num divergent transitions during adaption advancedhmc hmcsampler type hmcsampleran abstractmcmc abstractsampler for kernels in advancedhmc jl fields abstractmcmckernel metric choice of initial metric abstractmetric the metric type will be preserved during adaption adaptor advancedhmc adaptation abstractadaptor notesnote that all the fields have the prefix initial to indicate that these will not necessarily correspond to the kernel metric and adaptor after sampling to access the updated fields use the resulting hmcstate advancedhmc hmcstate type hmcstaterepresents the state of a hmcsampler fieldsi index of current iteration transition current transition metric current abstractmetric possibly adapted current abstractmcmckernel adaptor current abstractadaptor advancedhmc jitteredleapfrog type struct jitteredleapfrog ft lt abstractfloat t lt union abstractarray ft lt abstractfloat 1 ft lt abstractfloat lt advancedhmc abstractleapfrog t lt union abstractarray ft lt abstractfloat 1 ft lt abstractfloat leapfrog integrator with randomly quot jittered quot step size for every trajectory fields 0 union abstractvector ft ft where ft lt abstractfloat nominal non jittered step size jitter abstractfloat the proportion of the nominal step size 0 that may be added or subtracted union abstractvector ft ft where ft lt abstractfloat current jittered step size descriptionthis is the same as leapfrog ref but with a quot jittered quot step size this means that at the beginning of each trajectory we sample a step size by adding or subtracting from the nominal base step size 0 some random proportion of 0 with the proportion specified by jitter i e 0 jitter 0 rand p jittering might help alleviate issues related to poor interactions with a fixed step size in regions with high quot curvature quot the current choice of step size might mean over shoot leading to almost all steps being rejected randomly sampling the step size at the beginning of the trajectories can therefore increase the probability of escaping such high curvature regions exact periodicity of the simulated trajectories might occur i e you might be so unlucky as to simulate the trajectory forwards in time l and ending up at the same point which results in non ergodicity see section 3 2 in 1 if momentum is refreshed before each trajectory then this should not happen exactly but it can still be an issue in practice randomly choosing the step size might help alleviate such problems referencesneal r m 2011 mcmc using hamiltonian dynamics handbook of markov chain monte carlo 2 11 2 arxiv advancedhmc leapfrog type struct leapfrog t lt union abstractvector var s29 var s29 where var s29 lt abstractfloat lt advancedhmc abstractleapfrog t lt union abstractvector var s29 var s29 where var s29 lt abstractfloat leapfrog integrator with fixed step size fields union abstractvector var quot s29 quot var quot s29 quot where var quot s29 quot lt abstractfloat step size advancedhmc multinomialts type struct multinomialts f lt abstractfloat lt advancedhmc abstracttrajectorysamplermultinomial trajectory sampler carried during the building of the tree it contains the weight of the tree defined as the total probabilities of the leaves fieldszcand advancedhmc phasepoint sampled candidate phasepoint w abstractfloat total energy for the given tree i e the sum of energies of all leaves advancedhmc multinomialts method struct multinomialts f lt abstractfloat lt advancedhmc abstracttrajectorysamplermultinomial sampler for a trajectory consisting only a leaf node tree weight is the unnormalised energy of the leaf advancedhmc multinomialts method struct multinomialts f lt abstractfloat lt advancedhmc abstracttrajectorysamplermultinomial sampler for the starting single leaf tree log weights for leaf nodes are their unnormalised hamiltonian energies ref https github com stan dev stan blob develop src stan mcmc hmc nuts base nuts hpp l226 advancedhmc nuts type nuts real max depth int 10 max real 1000 integrator leapfrog metric diagonal no u turn sampler nuts sampler fields target acceptance rate for dual averaging max depth maximum doubling tree depth max maximum divergence during doubling tree integrator choice of integrator specified either using a symbol or abstractintegratormetric choice of initial metric symbol means it is automatically initialised the metric type will be preserved during automatic initialisation and adaption advancedhmc partialmomentumrefreshment type struct partialmomentumrefreshment f lt abstractfloat lt advancedhmc abstractmomentumrefreshmentpartial momentum refreshment with refresh rate fields abstractfloatsee equation 5 19 1 r r sqrt 1 gwhere r is the momentum and g is a gaussian random variable referencesneal radford m quot mcmc using hamiltonian dynamics quot handbook of markov chain monte carlo 2 11 2011 2 advancedhmc slicets type struct slicets f lt abstractfloat lt advancedhmc abstracttrajectorysamplertrajectory slice sampler carried during the building of the tree it contains the slice variable and the number of acceptable condidates in the tree fieldszcand advancedhmc phasepoint sampled candidate phasepoint u abstractfloat slice variable in log space n int64 number of acceptable candidates i e those with probability larger than slice variable u advancedhmc slicets method struct slicets f lt abstractfloat lt advancedhmc abstracttrajectorysamplerslice sampler for the starting single leaf tree slice variable is initialized advancedhmc slicets method struct slicets f lt abstractfloat lt advancedhmc abstracttrajectorysamplercreate a slice sampler for a single leaf tree the slice variable is copied from the passed in sampler s andthe number of acceptable candicates is computed by comparing the slice variable against the current energy advancedhmc staticterminationcriterion type abstract type staticterminationcriterion lt advancedhmc abstractterminationcriterionabstract type for a fixed number of leapfrog integration steps advancedhmc strictgeneralisednouturn type struct strictgeneralisednouturn f lt abstractfloat lt advancedhmc dynamicterminationcriteriongeneralised no u turn criterion as described in section a 4 2 in 1 with added u turn check as described in 2 fieldsmax depth int64 max abstractfloatreferencesbetancourt m 2017 a conceptual introduction to hamiltonian monte carlo arxiv preprint arxiv 1701 02434 https github com stan dev stan pull 2800 advancedhmc temperedleapfrog type struct temperedleapfrog ft lt abstractfloat t lt union abstractarray ft lt abstractfloat 1 ft lt abstractfloat lt advancedhmc abstractleapfrog t lt union abstractarray ft lt abstractfloat 1 ft lt abstractfloat tempered leapfrog integrator with fixed step size and quot temperature quot fields union abstractvector ft ft where ft lt abstractfloat step size abstractfloat temperature parameter descriptiontempering can potentially allow greater exploration of the posterior e g in a multi modal posterior jumps between the modes can be more likely to occur advancedhmc termination type terminationtermination reasonsdynamic due to stoping criterianumerical due to large energy deviation from starting possibly numerical errors advancedhmc termination method termination s nt h0 h check termination of a hamiltonian trajectory advancedhmc termination method termination s nt h0 h check termination of a hamiltonian trajectory advancedhmc trajectory type struct trajectory ts lt advancedhmc abstracttrajectorysampler i lt advancedhmc abstractintegrator tc lt advancedhmc abstractterminationcriterion numerically simulated hamiltonian trajectories advancedhmc transition type struct transition p lt advancedhmc phasepoint nt lt namedtuple a transition that contains the phase point and other statistics of the transition fieldsz advancedhmc phasepoint phase point for the transition stat namedtuple statistics related to the transition e g energy", "title": "AdvancedHMC"},{"location": "/docs/library/", "text": "indexturing binomiallogitturing flatturing flatposturing orderedlogisticturing inference gibbsturing inference hmcturing inference hmcdaturing inference isturing inference mhturing inference nutsturing inference pgturing inference smcmodelling dynamicppl model macro model expr warn false macro to specify a probabilistic model if warn is true a warning is displayed if internal variable names are used in the model definition examplesmodel definition model function model x y 42 endto generate a model call model xvalue or model xvalue yvalue samplers dynamicppl sampler type sampler t generic sampler type for inference algorithms of type t in dynamicppl sampler should implement the abstractmcmc interface and in particular abstractmcmc step a default implementation of the initial sampling step is provided that supports resuming sampling from a previous state and setting initial parameter values it requires to overload loadstate and initialstep for loading previous states and actually performing the initial sampling step respectively additionally sometimes one might want to implement initialsampler that specifies how the initial parameter values are sampled if they are not provided by default values are sampled from the prior turing inference gibbs type gibbs algs compositional mcmc interface gibbs sampling combines one or more sampling algorithms each of which samples from a different set of variables in a model example model function gibbs example x v1 normal 0 1 v2 categorical 5 end use pg for a v2 variable and use hmc for the v1 variable note that v2 is discrete so the pg sampler is more appropriate than is hmc alg gibbs hmc 0 2 3 v1 pg 20 v2 one can also pass the number of iterations for each gibbs component using the following syntax alg gibbs hmc 0 2 3 v1 n hmc pg 20 v2 n pg where n hmc and n pg are the number of hmc and pg iterations for each gibbs iteration tips hmc and nuts are fast samplers and can throw off particle basedmethods like particle gibbs you can increase the effectiveness of particle sampling by including more particles in the particle sampler source turing inference hmc type hmc float64 n leapfrog int adtype adtypes abstractadtype autoforwarddiff chunksize 0 hamiltonian monte carlo sampler with static trajectory arguments the leapfrog step size to use n leapfrog the number of leapfrog steps to use adtype the automatic differentiation ad backend if not specified forwarddiff is used with its chunksize automatically determined usagehmc 0 05 10 tipsif you are receiving gradient errors when using hmc try reducing the leapfrog step size e g original step sizesample gdemo 1 5 2 hmc 0 1 10 1000 reduced step sizesample gdemo 1 5 2 hmc 0 01 10 1000 source turing inference hmcda type hmcda n adapts int float64 float64 float64 0 0 adtype adtypes abstractadtype autoforwarddiff chunksize 0 hamiltonian monte carlo sampler with dual averaging algorithm usagehmcda 200 0 65 0 3 argumentsn adapts numbers of samples to use for adaptation target acceptance rate 65 is often recommended target leapfrog length initial step size 0 means automatically search by turing adtype the automatic differentiation ad backend if not specified forwarddiff is used with its chunksize automatically determined referencefor more information please view the following paper arxiv link hoffman matthew d and andrew gelman quot the no u turn sampler adaptively setting path lengths in hamiltonian monte carlo quot journal of machine learning research 15 no 1 2014 1593 1623 source turing inference is type is importance sampling algorithm usage is example define a simple normal model with unknown mean and variance model function gdemo x s inversegamma 2 3 m normal 0 sqrt s x 1 normal m sqrt s x 2 normal m sqrt s return s mendsample gdemo 1 5 2 is 1000 source turing inference mh type mh space construct a metropolis hastings algorithm the arguments space can beblank i e mh in which case mh defaults to using the prior for each parameter as the proposal distribution a set of one or more symbols to sample with mh in conjunction with gibbs i e gibbs mh m pg 10 s an iterable of pairs or tuples mapping a symbol to a advancedmh proposal distribution or function that generates returns a conditional proposal distribution a covariance matrix to use as for mean zero multivariate normal proposals examplesthe default mh will use propose samples from the prior distribution using advancedmh staticproposal model function gdemo x y s inversegamma 2 3 m normal 0 sqrt s x normal m sqrt s y normal m sqrt s endchain sample gdemo 1 5 2 0 mh 1 000 mean chain alternatively you can specify particular parameters to sample if you want to combine sampling from multiple samplers model function gdemo x y s inversegamma 2 3 m normal 0 sqrt s x normal m sqrt s y normal m sqrt s end samples s with mh and m with pgchain sample gdemo 1 5 2 0 gibbs mh s pg 10 m 1 000 mean chain using custom distributions defaults to using static mh model function gdemo x y s inversegamma 2 3 m normal 0 sqrt s x normal m sqrt s y normal m sqrt s end use a static proposal for s and random walk with proposal standard deviation of 0 25 for m chain sample gdemo 1 5 2 0 mh s gt inversegamma 2 3 m gt normal 0 1 1 000 mean chain specifying explicit proposals using the advancedmh interface model function gdemo x y s inversegamma 2 3 m normal 0 sqrt s x normal m sqrt s y normal m sqrt s end use a static proposal for s and random walk with proposal standard deviation of 0 25 for m chain sample gdemo 1 5 2 0 mh s gt advancedmh staticproposal inversegamma 2 3 m gt advancedmh randomwalkproposal normal 0 0 25 1 000 mean chain using a custom function to specify a conditional distribution model function gdemo x y s inversegamma 2 3 m normal 0 sqrt s x normal m sqrt s y normal m sqrt s end use a static proposal for s and and a conditional proposal for m where the proposal is centered around the current sample chain sample gdemo 1 5 2 0 mh s gt inversegamma 2 3 m gt x gt normal x 1 1 000 mean chain providing a covariance matrix will cause mh to perform random walk sampling in the transformed space with proposals drawn from a multivariate normal distribution the provided matrix must be positive semi definite and square usage model function gdemo x y s inversegamma 2 3 m normal 0 sqrt s x normal m sqrt s y normal m sqrt s end providing a custom variance covariance matrixchain sample gdemo 1 5 2 0 mh 0 25 0 05 0 05 0 50 1 000 mean chain source turing inference nuts type nuts n adapts int float64 max depth int 10 max float64 1000 0 init float64 0 0 adtype adtypes abstractadtype autoforwarddiff chunksize 0 no u turn sampler nuts sampler usage nuts use default nuts configuration nuts 1000 0 65 use 1000 adaption steps and target accept ratio 0 65 arguments n adapts int the number of samples to use with adaptation float64 target acceptance rate for dual averaging max depth int maximum doubling tree depth max float64 maximum divergence during doubling tree init float64 initial step size 0 means automatically searching using a heuristic procedure adtype adtypes abstractadtype the automatic differentiation ad backend if not specified forwarddiff is used with its chunksize automatically determined source turing inference pg type struct pg space r lt turing inference particleinferenceparticle gibbs sampler fieldsnparticles int64 number of particles resampler any resampling algorithm source turing inference smc type struct smc space r lt turing inference particleinferencesequential monte carlo sampler fieldsresampler anysourcedistributions turing flat type flat the flat distribution is the improper distribution of real numbers that has the improper probability density function f x 1 source turing flatpos type flatpos l real the positive flat distribution with real valued parameter l is the improper distribution of real numbers that has the improper probability density function f x begin cases 0 amp text if x leq l 1 amp text otherwise end cases source turing binomiallogit type binomiallogit n logitp the binomial distribution with logit parameterization characterizes the number of successes in a sequence of independent trials it has two parameters n the number of trials and logitp the logit of the probability of success in an individual trial with the distribution p x k n choose k text logistic logitp k 1 text logistic logitp n k quad text for k 0 1 2 ldots n see also binomialsource warning quot missing docstring quot missing docstring for vecbinomiallogit check documenter s build log for details turing orderedlogistic type orderedlogistic c abstractvector the ordered logistic distribution with real valued parameter and cutpoints c has the probability mass function p x k begin cases 1 text logistic eta c 1 amp text if k 1 text logistic eta c k 1 text logistic eta c k amp text if 1 lt k lt k text logistic eta c k 1 amp text if k k end cases where k length c 1 source", "title": "API"},{"location": "/docs/library/bijectors/", "text": "indexbijectors bijectorbijectors corrbijectorbijectors couplingbijectors inversebijectors leakyrelubijectors namedcouplingbijectors namedtransformbijectors orderedbijector bijectors partitionmask dev docs library bijectors bijectors partitionmask union tuple t tuple int64 any where t bijectors partitionmaskbijectors permutebijectors rationalquadraticsplinebijectors reshapebijectors stackedbijectors transformbijectors veccholeskybijectorbijectors veccorrbijector bijectors inv link chol lkj dev docs library bijectors bijectors inv link chol lkj tuple abstractmatrix t where t bijectors link chol lkj dev docs library bijectors bijectors link chol lkj tuple abstractmatrix t where t bijectors bijector bijectors cholesky lower dev docs library bijectors bijectors cholesky lower tuple abstractmatrix t where t bijectors cholesky upper dev docs library bijectors bijectors cholesky upper tuple abstractmatrix t where t bijectors columnwise bijectors combine dev docs library bijectors bijectors combine tuple bijectors partitionmask any any any bijectors compute r dev docs library bijectors bijectors compute r tuple abstractvector var quot s46 quot where var quot s46 quot lt real any any bijectors couple dev docs library bijectors bijectors couple tuple coupling abstractvector t where t bijectors couplingbijectors elementwise bijectors find alpha dev docs library bijectors bijectors find alpha tuple real real real bijectors get u hat dev docs library bijectors bijectors get u hat tuple abstractvector var quot s35 quot where var quot s35 quot lt real abstractvector var quot s34 quot where var quot s34 quot lt real bijectors has constant bijectorbijectors isclosedformbijectors isinvertible bijectors logabsdetjac dev docs library bijectors bijectors logabsdetjac tuple any any bijectors logabsdetjac dev docs library bijectors bijectors logabsdetjac tuple any any bijectors logabsdetjacinv dev docs library bijectors bijectors logabsdetjacinv tuple any any bijectors ordered dev docs library bijectors bijectors ordered tuple distribution multivariate continuous bijectors output length dev docs library bijectors bijectors output length tuple any int64 bijectors output size dev docs library bijectors bijectors output size tuple any any bijectors partition dev docs library bijectors bijectors partition tuple bijectors partitionmask any bijectors transform dev docs library bijectors bijectors transform union tuple f tuple f any where f lt function bijectors transform dev docs library bijectors bijectors transform tuple any any bijectors transformed dev docs library bijectors bijectors transformed tuple distribution any bijectors triu1 to vec dev docs library bijectors bijectors triu1 to vec tuple abstractmatrix t where t bijectors triu mask dev docs library bijectors bijectors triu mask tuple abstractmatrix t where t int64 bijectors triu to vec dev docs library bijectors bijectors triu to vec tuple abstractmatrix t where t bijectors vec to triu dev docs library bijectors bijectors vec to triu tuple abstractvector t where t bijectors vec to triu1 dev docs library bijectors bijectors vec to triu1 tuple abstractvector t where t bijectors with logabsdet jacobian dev docs library bijectors bijectors with logabsdet jacobian tuple any any functions bijectors inv link chol lkj method inv link chol lkj y inverse link function for cholesky factor bijectors link chol lkj method function link chol lkj w link function for cholesky factor an alternative and maybe more efficient implementation was considered for i 2 k j i 1 k z i j w i j w i 1 j z i 1 j sqrt 1 z i 1 j 2 endbut this implementation will not work when w i 1 j 0 though it is a zero measure set unit matrix initialization will not work for equivalence following explanations is given by torfjelde for i j in the loop below we definez w 1 1 z and soz w 1 1 z w 1 z 1 1 z w 1 z w 1 1 z w w 1 z z w w w z 1 z which is the above implementation bijectors bijector method bijector d distribution returns the constrained to unconstrained bijector for distribution d bijectors cholesky lower method cholesky lower x return the lower triangular cholesky factor of x as a matrix rather than lowertriangular notethis is a thin wrapper around cholesky hermitian x l that returns a matrix rather than lowertriangular bijectors cholesky upper method cholesky upper x return the upper triangular cholesky factor of x as a matrix rather than uppertriangular notethis is a thin wrapper around cholesky hermitian x u that returns a matrix rather than uppertriangular bijectors columnwise method alias for base fix1 eachcolmaphcat f represents a function f which is applied to each column of an input bijectors combine method combine m partitionmask x 1 x 2 x 3 combines x 1 x 2 and x 3 into a single vector bijectors compute r method compute r y minus z0 abstractvector lt real plus hat compute the unique solution r to the equation y minus z0 2 r left 1 frac plus hat r right subject to r 0 and r since gt 0 and plus hat gt 0 the solution is unique and given by r sqrt plus hat 2 4 plus hat 2 where y minus z0 2 for details see appendix a 2 of the reference referencesd rezende s mohamed 2015 variational inference with normalizing flows arxiv 1505 05770 bijectors couple method returns the coupling law constructed from x bijectors coupling method returns the constructor of the coupling law bijectors elementwise method elementwise f alias for base fix1 broadcast f in the case where f composedfunction the result is base fix1 broadcast f outer base fix1 broadcast f inner rather than base fix1 broadcast f bijectors find alpha method find alpha wt y wt u hat b compute an approximate real valued solution to the equation wt y wt u hat tanh b the uniqueness of the solution is guaranteed since wt u hat 1 for details see appendix a 1 of the reference initial bracketfor all we have wt u hat wt y leq wt u hat tanh b wt y leq wt u hat wt y thus wt u hat wt y leq 0 leq wt u hat wt y which implies wt y wt u hat wt y wt u hat to avoid floating point issues if wt y wt u hat we use the more conservative interval wt y 2 wt u hat wt y 2 wt u hat as initial bracket at the cost of one additional iteration step referencesd rezende s mohamed 2015 variational inference with normalizing flows arxiv 1505 05770 bijectors get u hat method get u hat u abstractvector lt real w abstractvector lt real return a tuple of vector u that guarantees invertibility of the planar layer and scalar w u mathematical backgroundaccording to appendix a 1 vector u defined by u w u u log 1 exp w u 1 w u frac w w guarantees that the planar layer f z z u tanh w z b is invertible for all w u and b we can rewrite u as u u log 1 exp w u 1 frac w w additionally we obtain w u w u log 1 exp w u 1 log 1 exp w u 1 referencesd rezende s mohamed 2015 variational inference with normalizing flows arxiv 1505 05770 bijectors has constant bijector method has constant bijector dist type type returns true if the distribution type dist type has a constant bijector i e the return value of bijector does not depend on runtime information bijectors isclosedform method isclosedform b transform boolisclosedform b inverse lt transform boolreturns true or false depending on whether or not evaluation of b has a closed form implementation most transformations have closed form evaluations but there are cases where this is not the case for example the inverse evaluation of planarlayer requires an iterative procedure to evaluate bijectors isinvertible method isinvertible t return true if t is invertible and false otherwise bijectors logabsdetjac method logabsdetjac b x logjac compute log abs det j b x and store the result in logjac where j b x is the jacobian of b at x bijectors logabsdetjac method logabsdetjac b x return log abs det j b x where j b x is the jacobian of b at x bijectors logabsdetjacinv method logabsdetjacinv b y just an alias for logabsdetjac inverse b y bijectors ordered method ordered d distribution return a distribution whose support are ordered vectors i e vectors with increasingly ordered elements this transformation is currently only supported for otherwise unconstrained distributions bijectors output length method output length f len int returns the output length of f given the input length len bijectors output size method output size f sz returns the output size of f given the input size sz bijectors partition method partition m partitionmask x partitions x into 3 disjoint subvectors bijectors transform method transform b x y transform x using b storing the result in y if y is not provided x is used as the output bijectors transform method transform b x transform x using b treating x as a single input bijectors transformed method transformed d distribution transformed d distribution b bijector couples distribution d with the bijector b by returning a transformeddistribution if no bijector is provided i e transformed d is called then transformed d bijector d is returned bijectors triu1 to vec method triu1 to vec x abstractmatrix lt real extracts elements from upper triangle of x with offset 1 and returns them as a vector bijectors triu mask method triu mask x abstractmatrix k int return a mask for elements of x above the kth diagonal bijectors triu to vec method triu to vec x abstractmatrix lt real extracts elements from upper triangle of x and returns them as a vector bijectors vec to triu method vec to triu x abstractvector lt real constructs a matrix from a vector x by filling the upper triangle bijectors vec to triu1 method vec to triu1 x abstractvector lt real constructs a matrix from a vector x by filling the upper triangle with offset 1 bijectors with logabsdet jacobian method with logabsdet jacobian b x y logjac compute transform b x and logabsdetjac b x storing the result in y and logjac respetively if y is not provided then x will be used in its place defaults to calling with logabsdet jacobian b x and updating y and logjac with the result inversefunctions inverse method inverse t transform returns the inverse of transform t types bijectors bijector type abstract type of a bijector i e differentiable bijection with differentiable inverse bijectors corrbijector type corrbijector lt bijectora bijector implementation of stan s parametrization method for correlation matrix https mc stan org docs 2 23 reference manual correlation matrix transform section htmlbasically a unconstrained strictly upper triangular matrix y is transformed to a correlation matrix by following readable but not that efficient form k size y 1 z tanh y for j 1 k i 1 k if i gt j w i j 0 elseif 1 i j w i j 1 elseif 1 lt i j w i j prod sqrt 1 z 1 i 1 j 2 elseif 1 i lt j w i j z i j elseif 1 lt i lt j w i j z i j prod sqrt 1 z 1 i 1 j 2 endendit is easy to see that every column is a unit vector for example w3 w3 w 1 3 2 w 2 3 2 w 3 3 2 z 1 3 2 z 2 3 sqrt 1 z 1 3 2 2 sqrt 1 z 1 3 2 sqrt 1 z 2 3 2 2 z 1 3 2 z 2 3 2 1 z 1 3 2 1 z 1 3 2 1 z 2 3 2 z 1 3 2 z 2 3 2 z 2 3 2 z 1 3 2 1 z 1 3 2 z 2 3 2 z 1 3 2 z 2 3 2 1and diagonal elements are positive so w is a cholesky factor for a positive matrix x w wconsider block matrix representation for xx w1 w2 wn w1 w2 wn w1 w1 w1 w2 w1 wn w2 w1 w2 w2 w2 wn the diagonal elements are given by wk wk 1 thus x is a correlation matrix every step is invertible so this is a bijection bijector note the implementation doesn t follow their quot manageable expression quot directly because their equation seems wrong 7 30 2020 insteadly it follows definition above the quot manageable expression quot directly which is also described in above doc bijectors coupling type coupling f m f mask m implements a coupling layer as defined in 1 examples julia gt using bijectors shift coupling partitionmask coupling couplejulia gt m partitionmask 3 1 2 lt going to use x 2 to parameterize transform of x 1 julia gt cl coupling shift m lt will do y 1 1 x 1 1 x 2 2 julia gt x 1 2 3 julia gt cl x 3 element vector float64 3 0 2 0 3 0julia gt inverse cl cl x 3 element vector float64 1 0 2 0 3 0julia gt coupling cl get the bijector map gt b shiftjulia gt couple cl x get the bijector resulting from x shift 2 0 julia gt with logabsdet jacobian cl x 3 0 2 0 3 0 0 0 references 1 kobyzev i prince s amp brubaker m a normalizing flows introduction and ideas corr 2019 bijectors inverse type inverse b transform inverse b transform a transform representing the inverse transform of b bijectors leakyrelu type leakyrelu t t lt bijectordefines the invertible mappingx x if x 0 else xwhere gt 0 bijectors namedcoupling type namedcoupling target deps f lt abstractnamedtransformimplements a coupling layer for named bijectors see also couplingexamples julia gt using bijectors namedcoupling scalejulia gt b namedcoupling b a c a c gt scale a c julia gt x a 1 b 2 c 3 julia gt b x a 1 0 b 8 0 c 3 0 julia gt a x a b x a x c x b c x c a 1 0 b 8 0 c 3 0 bijectors namedtransform type namedtransform lt abstractnamedtransformwraps a namedtuple of key gt bijector pairs implementing evaluation inversion etc examples julia gt using bijectors namedtransform scalejulia gt b namedtransform a scale 2 0 b exp julia gt x a 1 b 0 c 42 julia gt b x a 2 0 b 1 0 c 42 0 julia gt a 2 x a b exp x b c x c a 2 0 b 1 0 c 42 0 bijectors orderedbijector type orderedbijector a bijector mapping ordered vectors in to unordered vectors in see alsostan s documentationnote that this transformation and its inverse are the opposite of in this reference bijectors partitionmask type partitionmask a a 1 a a 2 a a 3 a where a this is used to partition and recombine a vector into 3 disjoint quot subvectors quot implementspartition m partitionmask x partitions x into 3 disjoint quot subvectors quot combine m partitionmask x 1 x 2 x 3 combines 3 disjoint vectors into a single onenote that partitionmask is not a bijector it is indeed a bijection but does not follow the bijector interface its main use is in coupling where we want to partition the input into 3 parts one part to transform one part to map into the parameter space of the transform applied to the first part and the last part of the vector is not used for anything examples julia gt using bijectors partitionmask partition combinejulia gt m partitionmask 3 1 2 lt assumes input length 3partitionmask bool sparsearrays sparsematrixcsc bool int64 1 1 true 2 1 true 3 1 true julia gt partition into 3 parts the last part is inferred to be indices 3 from the fact that 1 and 2 does not make up all indices in 1 3 x1 x2 x3 partition m 1 2 3 1 0 2 0 3 0 julia gt recombines the partitions into a vector combine m x1 x2 x3 3 element array float64 1 1 0 2 0 3 0note that the underlying sparsematrix is using bool as the element type we can also specify this to be some other type using the sp type keyword julia gt m partitionmask float32 3 1 2 partitionmask float32 sparsearrays sparsematrixcsc float32 int64 1 1 1 0 2 1 1 0 3 1 1 0 bijectors partitionmask method partitionmask n int indices assumes you want to split the vector where indices refer to the parts of the vector you want to apply the bijector to bijectors permute type permute a lt bijectora bijector implementation of a permutation the permutation is performed using a matrix of type a there are a couple of different ways to construct permute permute 0 1 1 0 will map 1 2 gt 2 1 permute 2 1 will map 1 2 gt 2 1 permute 2 2 gt 1 1 gt 2 will map 1 2 gt 2 1 permute 2 1 2 gt 2 1 will map 1 2 gt 2 1 if this is not clear the examples might be of help examplesa simple example is permuting a vector of size 3 julia gt b1 permute 0 1 0 1 0 0 0 0 1 permute array int64 2 0 1 0 1 0 0 0 0 1 julia gt b2 permute 2 1 3 specify all elements at oncepermute sparsearrays sparsematrixcsc float64 int64 2 1 1 0 1 2 1 0 3 3 1 0 julia gt b3 permute 3 2 gt 1 1 gt 2 element wisepermute sparsearrays sparsematrixcsc float64 int64 2 1 1 0 1 2 1 0 3 3 1 0 julia gt b4 permute 3 1 2 gt 2 1 block wisepermute sparsearrays sparsematrixcsc float64 int64 2 1 1 0 1 2 1 0 3 3 1 0 julia gt b1 a b2 a b3 a b4 atruejulia gt b1 1 2 3 3 element array float64 1 2 0 1 0 3 0julia gt b2 1 2 3 3 element array float64 1 2 0 1 0 3 0julia gt b3 1 2 3 3 element array float64 1 2 0 1 0 3 0julia gt b4 1 2 3 3 element array float64 1 2 0 1 0 3 0julia gt inverse b1 permute linearalgebra transpose int64 array int64 2 0 1 0 1 0 0 0 0 1 julia gt inverse b1 b1 1 2 3 3 element array float64 1 1 0 2 0 3 0 bijectors rationalquadraticspline type rationalquadraticspline t lt bijectorimplementation of the rational quadratic spline flow 1 outside of the interval minimum widths maximum widths this mapping is given by the identity map inside the interval it s given by a monotonic spline i e monotonic polynomials connected at intermediate points with endpoints fixed so as to continuously transform into the identity map for the sake of efficiency there are separate implementations for 0 dimensional and 1 dimensional inputs notesthere are two constructors for rationalquadraticspline rationalquadraticspline widths heights derivatives it is assumed that widths heights and derivatives satisfy the constraints that makes this a valid bijector i e widths monotonically increasing and length widths k heights monotonically increasing and length heights k derivatives non negative and derivatives 1 derivatives end 1 rationalquadraticspline widths heights derivatives b other than than the lengths no assumptions are made on parameters therefore we will transform the parameters s t widths new b b where k length widths heights new b b where k length heights derivatives new 0 with derivatives new 1 derivates new end 1 where k 1 length derivatives examplesunivariate julia gt using stablerngs stablerng rng stablerng 42 for reproducibility julia gt using bijectors rationalquadraticsplinejulia gt k 3 b 2 julia gt monotonic spline on b b with k intermediate knots quot connection points quot b rationalquadraticspline randn rng k randn rng k randn rng k 1 b julia gt b 0 5 inside of b b transformed1 1943325397834206julia gt b 5 outside of b b not transformed5 0julia gt b rationalquadraticspline b widths b heights b derivatives julia gt b 0 5 inside of b b transformed1 1943325397834206julia gt d 2 k 3 b 2 julia gt b rationalquadraticspline randn rng d k randn rng d k randn rng d k 1 b julia gt b 1 1 2 element vector float64 1 5660106244288925 0 5384702734738573julia gt b 5 5 2 element vector float64 5 0 5 0julia gt b 1 5 2 element vector float64 1 5660106244288925 5 0references 1 durkan c bekasov a murray i amp papamakarios g neural spline flows corr arxiv 1906 04032 stat ml 2019 bijectors reshape type reshape in shape out shape a bijector that reshapes the input to the output shape example julia gt b reshape 2 3 3 2 reshape tuple int64 int64 tuple int64 int64 2 3 3 2 julia gt array transform b reshape 1 6 2 3 3 2 matrix int64 1 4 2 5 3 6 lt a id bijectors stacked href bijectors stacked gt lt a gt bijectors stacked amp mdash type juliastacked bs stacked bs ranges stack bs bijector a bijector which stacks bijectors together which can then be applied to a vector where bs i bijector is applied to x ranges i unitrange int argumentsbs can be either a tuple or an abstractarray of 0 and or 1 dimensional bijectorsif bs is a tuple implementations are type stable using generated functionsif bs is an abstractarray implementations are not type stable and use iterative methodsranges needs to be an iterable consisting of unitrange int length bs length ranges needs to be true examplesb1 logit 0 0 1 0 b2 identityb stack b1 b2 b 0 0 1 0 b1 0 0 1 0 gt true bijectors transform type abstract type for a transformation implementinga subtype of transform of should at least implement transform b x dev docs library bijectors bijectors transform union tuple f tuple f any where f lt function if the transform is also invertible required either of the following transform inverse lt mytransform x the transform for its inverse inversefunctions inverse b mytransform returns an existing transform logabsdetjac dev docs library bijectors bijectors logabsdetjac tuple any any computes the log abs det jacobian factor optional with logabsdet jacobian transform and logabsdetjac combined useful in cases where we can exploit shared computation in the two for the above methods there are mutating versions which can optionally be implemented with logabsdet jacobian dev docs library bijectors bijectors with logabsdet jacobian tuple any any logabsdetjac dev docs library bijectors bijectors logabsdetjac tuple any any with logabsdet jacobian dev docs library bijectors bijectors with logabsdet jacobian tuple any any bijectors veccholeskybijector type veccholeskybijector lt bijectora bijector to transform a cholesky factor of a correlation matrix to an unconstrained vector fieldsmode symbol controls the inverse tranformation if mode u returns a linearalgebra cholesky holding the uppertriangular factorif mode l returns a linearalgebra cholesky holding the lowertriangular factorreferencehttps mc stan org docs reference manual cholesky factors of correlation matrices 1see also veccorrbijectorexample julia gt using stablerngs rng stablerng 42 julia gt b bijectors veccholeskybijector u julia gt x rand rng lkjcholesky 3 1 u sample a correlation matrix cholesky float64 matrix float64 u factor 3 3 uppertriangular float64 matrix float64 1 0 0 937494 0 865891 0 348002 0 320442 0 384122julia gt y b x transform to unconstrained vector representation 3 element vector float64 0 8777149781928181 0 3638927608636788 0 29813769428942216julia gt x inv inverse b y julia gt x inv u x u round trip through b and its inverse true julia gt x inv l x l also works for the lower triangular factor true lt a id bijectors veccorrbijector href bijectors veccorrbijector gt lt a gt bijectors veccorrbijector amp mdash type juliaveccorrbijector lt bijectora bijector to transform a correlation matrix to an unconstrained vector referencehttps mc stan org docs reference manual correlation matrix transform htmlsee also corrbijector and veccholeskybijector example julia gt using stablerngs rng stablerng 42 julia gt b bijectors veccorrbijector julia gt x rand rng lkj 3 1 sample a correlation matrix 3 3 matrix float64 1 0 0 705273 0 348638 0 705273 1 0 0 0534538 0 348638 0 0534538 1 0julia gt y b x transform to unconstrained vector representation 3 element vector float64 0 8777149781928181 0 3638927608636788 0 29813769428942216julia gt inverse b y x round trip through b and its inverse true", "title": "Bijectors"}]} +{"config":{"lang":["en"],"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location": "/assets/js/application.js", "text": "function e t for var n in t e n t n window function e function t r if n r return n r exports var i n r i r l 1 exports return e r call i exports i i exports t i l 0 i exports var n return t m e t c n t d function e n r t o e n object defineproperty e n configurable 1 enumerable 0 get r t n function e var n e e esmodule function return e default function return e return t d n a n n t o function e t return object prototype hasownproperty call e t t p t t s 6 function e t n use strict t esmodule 0 t default createelement function e t var n document createelement e t array prototype foreach call object keys t function e n setattribute e t e for var r arguments length i array r 2 r 2 0 o 2 o pre pre code array prototype foreach call n function t n var r code n i e createelement button class md clipboard title h clipboard copy data clipboard target r pre r code e createelement span class md clipboard message o t parentnode o id r o insertbefore i t new c default md clipboard on success function e var t e trigger queryselector md clipboard message if t instanceof htmlelement throw new referenceerror e clearselection t dataset mdtimer cleartimeout parseint t dataset mdtimer 10 t classlist add md clipboard message active t innerhtml h clipboard copied t dataset mdtimer settimeout function t classlist remove md clipboard message active t dataset mdtimer 2e3 tostring if modernizr details var r document queryselectorall details summary array prototype foreach call r function e e addeventlistener click function e var t e target parentnode t hasattribute open t removeattribute open t setattribute open var i function if document location hash var e document getelementbyid document location hash substring 1 if e return for var t e parentnode t t instanceof htmldetailselement t t parentnode if t t open t open 0 var n location hash location hash location hash n if window addeventlistener hashchange i i modernizr ios var o document queryselectorall data md scrollfix array prototype foreach call o function e e addeventlistener touchstart function var t e scrolltop 0 t e scrolltop 1 t e offsetheight e scrollheight e scrolltop t 1 listen new f default event listener window scroll resize orientationchange new f default header shadow data md component container data md component header listen new f default event listener window scroll resize orientationchange new f default header title data md component title md typeset h1 listen document queryselector data md component hero new f default event listener window scroll resize orientationchange new f default tabs toggle data md component hero listen document queryselector data md component tabs new f default event listener window scroll resize orientationchange new f default tabs toggle data md component tabs listen new f default event matchmedia min width 1220px new f default event listener window scroll resize orientationchange new f default sidebar position data md component navigation data md component header document queryselector data md component toc new f default event matchmedia min width 960px new f default event listener window scroll resize orientationchange new f default sidebar position data md component toc data md component header new f default event matchmedia min width 960px new f default event listener window scroll new f default nav blur data md component toc href var n document queryselectorall data md component collapsible array prototype foreach call n function e new f default event matchmedia min width 1220px new f default event listener e previouselementsibling click new f default nav collapse e new f default event matchmedia max width 1219px new f default event listener data md component navigation data md toggle change new f default nav scrolling data md component navigation nav document queryselector data md component search new f default event matchmedia max width 959px new f default event listener data md toggle search change new f default search lock data md toggle search new f default event listener data md component query focus keyup change new f default search result data md component result function return fetch t url base search search index json credentials same origin then function e return e json then function e return e docs map function e return e location t url base e location e listen new f default event listener data md component reset click function settimeout function var e document queryselector data md component query if e instanceof htmlinputelement throw new referenceerror e focus 10 listen new f default event listener data md toggle search change function e settimeout function e if e instanceof htmlinputelement throw new referenceerror if e checked var t document queryselector data md component query if t instanceof htmlinputelement throw new referenceerror t focus 400 e target listen new f default event matchmedia min width 960px new f default event listener data md component query focus function var e document queryselector data md toggle search if e instanceof htmlinputelement throw new referenceerror e checked e checked 0 e dispatchevent new customevent change new f default event listener window keydown function e var t document queryselector data md toggle search if t instanceof htmlinputelement throw new referenceerror var n document queryselector data md component query if n instanceof htmlinputelement throw new referenceerror if e metakey e ctrlkey if t checked if 13 e keycode if n document activeelement e preventdefault var r document queryselector data md component search href data md state active r instanceof htmllinkelement window location r getattribute href t checked 1 t dispatchevent new customevent change n blur else if 9 e keycode 27 e keycode t checked 1 t dispatchevent new customevent change n blur else if 1 8 37 39 indexof e keycode n document activeelement n focus else if 1 38 40 indexof e keycode var i e keycode o array prototype slice call document queryselectorall data md component query data md component search href a o find function e if e instanceof htmlelement throw new referenceerror return active e dataset mdstate a a dataset mdstate var s math max 0 o indexof a o length 38 i 1 1 o length return o s o s dataset mdstate active o s focus e preventdefault e stoppropagation 1 else document activeelement document activeelement form 70 e keycode 83 e keycode n focus e preventdefault listen new f default event listener window keypress function var e document queryselector data md toggle search if e instanceof htmlinputelement throw new referenceerror if e checked var t document queryselector data md component query if t instanceof htmlinputelement throw new referenceerror t document activeelement t focus listen new f default event listener document body keydown function e if 9 e keycode var t document queryselectorall data md component navigation md nav link for not tabindex array prototype foreach call t function e e offsetheight e tabindex 0 listen new f default event listener document body mousedown function var e document queryselectorall data md component navigation md nav link tabindex array prototype foreach call e function e e removeattribute tabindex listen document body addeventlistener click function tabbing document body dataset mdstate document body dataset mdstate new f default event matchmedia max width 959px new f default event listener data md component navigation href click function var e document queryselector data md toggle drawer if e instanceof htmlinputelement throw new referenceerror e checked e checked 1 e dispatchevent new customevent change function var e document queryselector data md source if e return a default resolve if e instanceof htmlanchorelement throw new referenceerror switch e dataset mdsource case github return new f default source adapter github e fetch default return a default resolve then function e var t document queryselectorall data md source array prototype foreach call t function t new f default source repository t initialize e t esmodule 0 t app void 0 n 7 n 8 n 9 n 10 n 11 n 12 n 13 var o n 14 a r o s n 19 c r s u n 20 l r u d n 21 f r d window promise window promise a default var h function e var t document getelementsbyname lang e 0 if t instanceof htmlmetaelement throw new referenceerror return t content p initialize i t app p call t n 0 function e t n e exports n p assets images icons bitbucket 1b09e088 svg function e t n e exports n p assets images icons github f0b8504a svg function e t n e exports n p assets images icons gitlab 6dd19c00 svg function e t function e t function e t try var n new window customevent test if n preventdefault 0 n defaultprevented throw new error could not prevent default catch e var r function e t var n r return t t bubbles 1 cancelable 1 detail void 0 n document createevent customevent n initcustomevent e t bubbles t cancelable t detail r n preventdefault n preventdefault function r call this try object defineproperty this defaultprevented get function return 0 catch e this defaultprevented 0 n r prototype window event prototype window customevent r function e t n window fetch window fetch n 2 default n 2 function e t n use strict object defineproperty t esmodule value 0 function e function r function i e t return function e apply t arguments function o e if this instanceof o throw new typeerror promises must be constructed via new if function typeof e throw new typeerror not a function this state 0 this handled 1 this value void 0 this deferreds d e this function a e t for 3 e state e e value if 0 e state return void e deferreds push t e handled 0 o immediatefn function var n 1 e state t onfulfilled t onrejected if null n return void 1 e state s c t promise e value var r try r n e value catch e return void c t promise e s t promise r function s e t try if t e throw new typeerror a promise cannot be resolved with itself if t object typeof t function typeof t var n t then if t instanceof o return e state 3 e value t void u e if function typeof n return void d i n t e e state 1 e value t u e catch t c e t function c e t e state 2 e value t u e function u e 2 e state 0 e deferreds length o immediatefn function e handled o unhandledrejectionfn e value for var t 0 n e deferreds length t 0 e idletimeoutid settimeout function e ontimeout e ontimeout t n 16 t setimmediate undefined typeof self self setimmediate void 0 e e setimmediate this this setimmediate t clearimmediate undefined typeof self self clearimmediate void 0 e e clearimmediate this this clearimmediate call t n 1 function e t n function e t function e n use strict function r e function typeof e e new function e for var t new array arguments length 1 n 0 n 1 for var n 1 n 0 void 0 arguments 0 arguments 0 this action e action this container e container this emitter e emitter this target e target this text e text this trigger e trigger this selectedtext key initselection value function this text this selectfake this target this selecttarget key selectfake value function var e this t rtl document documentelement getattribute dir this removefake this fakehandlercallback function return e removefake this fakehandler this container addeventlistener click this fakehandlercallback 0 this fakeelem document createelement textarea this fakeelem style fontsize 12pt this fakeelem style border 0 this fakeelem style padding 0 this fakeelem style margin 0 this fakeelem style position absolute this fakeelem style t right left 9999px var n window pageyoffset document documentelement scrolltop this fakeelem style top n px this fakeelem setattribute readonly this fakeelem value this text this container appendchild this fakeelem this selectedtext 0 r default this fakeelem this copytext key removefake value function this fakehandler this container removeeventlistener click this fakehandlercallback this fakehandler null this fakehandlercallback null this fakeelem this container removechild this fakeelem this fakeelem null key selecttarget value function this selectedtext 0 r default this target this copytext key copytext value function var e void 0 try e document execcommand this action catch t e 1 this handleresult e key handleresult value function e this emitter emit e success error action this action text this selectedtext trigger this trigger clearselection this clearselection bind this key clearselection value function this trigger this trigger focus window getselection removeallranges key destroy value function this removefake key action set function var e arguments length 0 void 0 arguments 0 arguments 0 copy if this action e copy this action cut this action throw new error invalid action value use either copy or cut get function return this action key target set function e if void 0 e if e object void 0 e undefined i e 1 e nodetype throw new error invalid target value use a valid element if copy this action e hasattribute disabled throw new error invalid target attribute please use readonly instead of disabled attribute if cut this action e hasattribute readonly e hasattribute disabled throw new error invalid target attribute you can t cut text from elements with readonly or disabled attributes this target e get function return this target e e exports a function e t n function r e t n if e t n throw new error missing required arguments if s string t throw new typeerror second argument must be a string if s fn n throw new typeerror third argument must be a function if s node e return i e t n if s nodelist e return o e t n if s string e return a e t n throw new typeerror first argument must be a string htmlelement htmlcollection or nodelist function i e t n return e addeventlistener t n destroy function e removeeventlistener t n function o e t n return array prototype foreach call e function e e addeventlistener t n destroy function array prototype foreach call e function e e removeeventlistener t n function a e t n return c document body e t n var s n 6 c n 5 e exports r function e t function n n prototype on function e t n var r this e this e return r e r e push fn t ctx n this once function e t n function r i off e r t apply n arguments var i this return r t this on e r n emit function e var t slice call arguments 1 n this e this e e slice r 0 i n length for r r 0 void 0 arguments 0 arguments 0 this action function typeof e action e action this defaultaction this target function typeof e target e target this defaulttarget this text function typeof e text e text this defaulttext this container object f e container e container document body key listenclick value function e var t this this listener 0 d default e click function e return t onclick e key onclick value function e var t e delegatetarget e currenttarget this clipboardaction this clipboardaction null this clipboardaction new u default action this action t target this target t text this text t container this container trigger t emitter this key defaultaction value function e return c action e key defaulttarget value function e var t c target e if t return document queryselector t key defaulttext value function e return c text e key destroy value function this listener destroy this clipboardaction this clipboardaction destroy this clipboardaction null key issupported value function var e arguments length 0 void 0 arguments 0 arguments 0 copy cut t string typeof e e e n document querycommandsupported return t foreach function e n n document querycommandsupported e n t l default e exports p function e t function n e t for e e nodetype r if function typeof e matches e matches t return e e e parentnode var r 9 if undefined typeof element element prototype matches var i element prototype i matches i matchesselector i mozmatchesselector i msmatchesselector i omatchesselector i webkitmatchesselector e exports n function e t n function r e t n r i var a o apply this arguments return e addeventlistener n a i destroy function e removeeventlistener n a i function i e t n i o return function typeof e addeventlistener r apply null arguments function typeof n r bind null document apply null arguments string typeof e e document queryselectorall e array prototype map call e function e return r e t n i o function o e t n r return function n n delegatetarget a n target t n delegatetarget r call e n var a n 4 e exports i function e t t node function e return void 0 e e instanceof htmlelement 1 e nodetype t nodelist function e var n object prototype tostring call e return void 0 e object nodelist n object htmlcollection n length in e 0 e length t node e 0 t string function e return string typeof e e instanceof string t fn function e return object function object prototype tostring call e function e t function n e var t if select e nodename e focus t e value else if input e nodename textarea e nodename var n e hasattribute readonly n e setattribute readonly e select e setselectionrange 0 e value length n e removeattribute readonly t e value else e hasattribute contenteditable e focus var r window getselection i document createrange i selectnodecontents e r removeallranges r addrange i t r tostring return t e exports n function e t n var r function use strict function i e t var n if t t this trackingclick 1 this trackingclickstart 0 this targetelement null this touchstartx 0 this touchstarty 0 this lasttouchidentifier 0 this touchboundary t touchboundary 10 this layer e this tapdelay t tapdelay 200 this taptimeout t taptimeout 700 i notneeded e for var r onmouse onclick ontouchstart ontouchmove ontouchend ontouchcancel o this s 0 c r length s 0 a navigator useragent indexof android 0 o s ip ad hone od test navigator useragent o c s os 4 d d test navigator useragent u s os 6 7 d test navigator useragent l navigator useragent indexof bb10 0 i prototype needsclick function e switch e nodename tolowercase case button case select case textarea if e disabled return 0 break case input if s file e type e disabled return 0 break case label case iframe case video return 0 return bneedsclick b test e classname i prototype needsfocus function e switch e nodename tolowercase case textarea return 0 case select return a case input switch e type case button case checkbox case file case image case radio case submit return 1 return e disabled e readonly default return bneedsfocus b test e classname i prototype sendclick function e t var n r document activeelement document activeelement e document activeelement blur r t changedtouches 0 n document createevent mouseevents n initmouseevent this determineeventtype e 0 0 window 1 r screenx r screeny r clientx r clienty 1 1 1 1 0 null n forwardedtouchevent 0 e dispatchevent n i prototype determineeventtype function e return a select e tagname tolowercase mousedown click i prototype focus function e var t s e setselectionrange 0 e type indexof date time e type month e type t e value length e setselectionrange t t e focus i prototype updatescrollparent function e var t n if t e fastclickscrollparent t contains e n e do if n scrollheight n offsetheight t n e fastclickscrollparent n break n n parentelement while n t t fastclicklastscrolltop t scrolltop i prototype gettargetelementfromeventtarget function e return e nodetype node text node e parentnode e i prototype ontouchstart function e var t n r if e targettouches length 1 return 0 if t this gettargetelementfromeventtarget e target n e targettouches 0 s if r window getselection r rangecount r iscollapsed return 0 if c if n identifier n identifier this lasttouchidentifier return e preventdefault 1 this lasttouchidentifier n identifier this updatescrollparent t return this trackingclick 0 this trackingclickstart e timestamp this targetelement t this touchstartx n pagex this touchstarty n pagey e timestamp this lastclicktime n math abs t pagey this touchstarty n i prototype ontouchmove function e return this trackingclick this targetelement this gettargetelementfromeventtarget e target this touchhasmoved e this trackingclick 1 this targetelement null 0 i prototype findcontrol function e return void 0 e control e control e htmlfor document getelementbyid e htmlfor e queryselector button input not type hidden keygen meter output progress select textarea i prototype ontouchend function e var t n r i o l this targetelement if this trackingclick return 0 if e timestamp this lastclicktime this taptimeout return 0 if this cancelnextclick 1 this lastclicktime e timestamp n this trackingclickstart this trackingclick 1 this trackingclickstart 0 u o e changedtouches 0 l document elementfrompoint o pagex window pagexoffset o pagey window pageyoffset l l fastclickscrollparent this targetelement fastclickscrollparent label r l tagname tolowercase if t this findcontrol l if this focus l a return 1 l t else if this needsfocus l return e timestamp n 100 s window top window input r this targetelement null 1 this focus l this sendclick l e s select r this targetelement null e preventdefault 1 return s c i l fastclickscrollparent i fastclicklastscrolltop i scrolltop this needsclick l e preventdefault this sendclick l e 1 i prototype ontouchcancel function this trackingclick 1 this targetelement null i prototype onmouse function e return this targetelement e forwardedtouchevent e cancelable this needsclick this targetelement this cancelnextclick e stopimmediatepropagation e stopimmediatepropagation e propagationstopped 0 e stoppropagation e preventdefault 1 i prototype onclick function e var t return this trackingclick this targetelement null this trackingclick 1 0 submit e target type 0 e detail t this onmouse e t this targetelement null t i prototype destroy function var e this layer a e removeeventlistener mouseover this onmouse 0 e removeeventlistener mousedown this onmouse 0 e removeeventlistener mouseup this onmouse 0 e removeeventlistener click this onclick 0 e removeeventlistener touchstart this ontouchstart 1 e removeeventlistener touchmove this ontouchmove 1 e removeeventlistener touchend this ontouchend 1 e removeeventlistener touchcancel this ontouchcancel 1 i notneeded function e var t n r if void 0 window ontouchstart return 0 if n chrome 0 9 exec navigator useragent 0 1 if a return 0 if t document queryselector meta name viewport if 1 t content indexof user scalable no return 0 if n 31 document documentelement scrollwidth 10 r 2 3 t document queryselector meta name viewport if 1 t content indexof user scalable no return 0 if document documentelement scrollwidth 27 t document queryselector meta name viewport 1 t content indexof user scalable no document documentelement scrollwidth this height t this active this header dataset mdstate this active t shadow else this height 0 this setup e prototype reset function this header dataset mdstate this height 0 this active 1 e t default i function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i function function e t n r this e var i string typeof t document queryselector t t if i instanceof htmlelement throw new referenceerror if this el i i string typeof n document queryselector n n instanceof htmlheadingelement throw new referenceerror this header i this active 1 return e prototype setup function var e this array prototype foreach call this el children function t t style width e el offsetwidth 20 px e prototype update function e var t this n window pageyoffset this header offsettop n this active this el dataset mdstate this active n active resize e type orientationchange e type array prototype foreach call this el children function e e style width t el offsetwidth 20 px e prototype reset function this el dataset mdstate this el style width this active 1 e t default i function e t n use strict function r e return e e esmodule e default e t esmodule 0 var i n 28 o r i a n 29 s r a c n 30 u r c t default blur o default collapse s default scrolling u default function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i function function e t r this e this els string typeof t document queryselectorall t t this index 0 this offset window pageyoffset this dir 1 this anchors reduce call this els function e t return e concat document getelementbyid t hash substring 1 return e prototype setup function this update e prototype update function var e window pageyoffset t this offset e 0 this els n 1 dataset mdstate blur this index n else for var r this index r 0 r if this anchors r offsettop 80 e this index r break r 0 this els r 1 dataset mdstate this offset e this dir t e prototype reset function array prototype foreach call this els function e e dataset mdstate this index 0 this offset window pageyoffset e t default i function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i function function e t r this e var n string typeof t document queryselector t t if n instanceof htmlelement throw new referenceerror this el n return e prototype setup function var e this el getboundingclientrect height this el style display e block none this el style overflow e visible hidden e prototype update function var e this t this el getboundingclientrect height if this el style display block this el style overflow t this el style maxheight t px requestanimationframe function e el setattribute data md state animate e el style maxheight 0px else this el setattribute data md state expand this el style maxheight var n this el getboundingclientrect height this el removeattribute data md state this el style maxheight 0px requestanimationframe function e el setattribute data md state animate e el style maxheight n px var r function e n var r n target if r instanceof htmlelement throw new referenceerror r removeattribute data md state r style maxheight r style display t none block r style overflow t hidden visible r removeeventlistener transitionend e this el addeventlistener transitionend r 1 e prototype reset function this el dataset mdstate this el style maxheight this el style display this el style overflow e t default i function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i function function e t r this e var n string typeof t document queryselector t t if n instanceof htmlelement throw new referenceerror this el n return e prototype setup function this el children this el children length 1 style webkitoverflowscrolling touch var e this el queryselectorall data md toggle array prototype foreach call e function e if e instanceof htmlinputelement throw new referenceerror if e checked var t e nextelementsibling if t instanceof htmlelement throw new referenceerror for nav t tagname t nextelementsibling t t nextelementsibling if e parentnode instanceof htmlelement e parentnode parentnode instanceof htmlelement throw new referenceerror var n e parentnode parentnode r t children t children length 1 n style webkitoverflowscrolling r style webkitoverflowscrolling touch e prototype update function e var t e target if t instanceof htmlelement throw new referenceerror var n t nextelementsibling if n instanceof htmlelement throw new referenceerror for nav n tagname n nextelementsibling n n nextelementsibling if t parentnode instanceof htmlelement t parentnode parentnode instanceof htmlelement throw new referenceerror var r t parentnode parentnode i n children n children length 1 if r style webkitoverflowscrolling i style webkitoverflowscrolling t checked var o function e n instanceof htmlelement r style webkitoverflowscrolling touch n removeeventlistener transitionend e n addeventlistener transitionend o 1 if t checked var a function e n instanceof htmlelement i style webkitoverflowscrolling touch n removeeventlistener transitionend e n addeventlistener transitionend a 1 e prototype reset function this el children 1 style webkitoverflowscrolling var e this el queryselectorall data md toggle array prototype foreach call e function e if e instanceof htmlinputelement throw new referenceerror if e checked var t e nextelementsibling if t instanceof htmlelement throw new referenceerror for nav t tagname t nextelementsibling t t nextelementsibling if e parentnode instanceof htmlelement e parentnode parentnode instanceof htmlelement throw new referenceerror var n e parentnode parentnode r t children t children length 1 n style webkitoverflowscrolling r style webkitoverflowscrolling e t default i function e t n use strict function r e return e e esmodule e default e t esmodule 0 var i n 32 o r i a n 33 s r a t default lock o default result s default function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i function function e t r this e var n string typeof t document queryselector t t if n instanceof htmlinputelement throw new referenceerror if this el n document body throw new referenceerror this lock document body return e prototype setup function this update e prototype update function var e this this el checked this offset window pageyoffset settimeout function window scrollto 0 0 e el checked e lock dataset mdstate lock 400 this lock dataset mdstate settimeout function void 0 e offset window scrollto 0 e offset 100 e prototype reset function lock this lock dataset mdstate window scrollto 0 this offset this lock dataset mdstate e t default i function e t n use strict function e function r e return e e esmodule e default e function i e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var o n 34 a r o s n 35 c r s u function e t var n t if e length n for e n n 0 return e substring 0 n return e l function e var t document getelementsbyname lang e 0 if t instanceof htmlmetaelement throw new referenceerror return t content d function function t e n i this t var r string typeof e document queryselector e e if r instanceof htmlelement throw new referenceerror this el r var o array prototype slice call this el children a o 0 s o 1 this data n this meta a this list s this message placeholder this meta textcontent none l search result none one l search result one other l search result other var u l search tokenizer u length c default tokenizer separator u this lang l search language split filter boolean map function e return e trim return t prototype update function t var n this if focus t type this index if focus t type keyup t type var r t target if r instanceof htmlinputelement throw new referenceerror if this index r value this value return for this list firstchild this list removechild this list firstchild if this value r value 0 this value length return void this meta textcontent this message placeholder var i this index query function e n value tolowercase split filter boolean foreach function t e term t wildcard c default query wildcard trailing reduce function e t var r n docs get t ref if r parent var i r parent location e set i e get i concat t else var o r location e set o e get o return e new map o 0 a default this value trim replace new regexp c default tokenizer separator img s new regexp c default tokenizer separator o img d function e t n return t n this stack i foreach function t r var i o n docs get r a e createelement li class md search result item e createelement a href o location title o title class md search result link tabindex 1 e createelement article class md search result article md search result article document e createelement h1 class md search result title html o title replace s d o text length e createelement p class md search result teaser html o text replace s d c t map function t return function var r n docs get t ref a appendchild e createelement a href r location title r title class md search result link data md rel anchor tabindex 1 e createelement article class md search result article e createelement h1 class md search result title html r title replace s d r text length e createelement p class md search result teaser html u r text replace s d 400 i n stack push apply i function return n list appendchild a concat c var f this el parentnode if f instanceof htmlelement throw new referenceerror for this stack length f offsetheight f scrollheight 16 this stack shift var h this list queryselectorall data md rel anchor switch array prototype foreach call h function e click keydown foreach function t e addeventlistener t function n if keydown t 13 n keycode var r document queryselector data md toggle search if r instanceof htmlinputelement throw new referenceerror r checked r checked 1 r dispatchevent new customevent change n preventdefault settimeout function document location href e href 100 i size case 0 this meta textcontent this message none break case 1 this meta textcontent this message one break default this meta textcontent this message other replace i size else var p function e n docs e reduce function e t var n t location split r n 0 return n 1 t parent e get r t parent t parent done t parent title t title t parent text t text t parent done 0 t text t text replace n g replace s g replace s g function e t return t t parent t parent title t title e set t location t e new map var t n docs r n lang n stack n index 0 c default function var e n this i search pipeline trimmer c default trimmer search pipeline stopwords c default stopwordfilter o object keys i reduce function e t return l t match false i e push i t e this pipeline reset o e this pipeline add apply e o 1 r length en r 0 c default r 0 this use c default r 0 r length 1 this use c default multilanguage apply c default r this field title boost 10 this field text this ref location t foreach function e return n add e var i n el parentnode if i instanceof htmlelement throw new referenceerror i addeventlistener scroll function for n stack length i scrolltop i offsetheight i scrollheight 16 n stack splice 0 10 foreach function e return e settimeout function return function typeof n data n data then p p n data 250 t t default d call t n 0 function e t n use strict var r g e exports function e if string typeof e throw new typeerror expected a string return e replace r function e t n function t e exports t lunr n 36 call t n 1 function e t n var r i function var o function e var t new o builder return t pipeline add o trimmer o stopwordfilter o stemmer t searchpipeline add o stemmer e call t t t build o version 2 1 5 o utils o utils warn function e return function t e console console warn console warn t this o utils asstring function e return void 0 e null e e tostring o fieldref function e t n this docref e this fieldname t this stringvalue n o fieldref joiner o fieldref fromstring function e var t e indexof o fieldref joiner if 1 t throw malformed field ref string var n e slice 0 t r e slice t 1 return new o fieldref r n e o fieldref prototype tostring function return void 0 this stringvalue this stringvalue this fieldname o fieldref joiner this docref this stringvalue o idf function e t var n 0 for var r in e index r n object keys e r length var i t n 5 n 5 return math log 1 math abs i o token function e t this str e this metadata t o token prototype tostring function return this str o token prototype update function e return this str e this str this metadata this o token prototype clone function e return e e function e return e new o token e this str this metadata this metadata o tokenizer function e if null e void 0 e return if array isarray e return e map function e return new o token o utils asstring e tolowercase for var t e tostring trim tolowercase n t length r i 0 a 0 i 0 r push new o token t slice a i position a c index r length a i 1 return r o tokenizer separator s o pipeline function this stack o pipeline registeredfunctions object create null o pipeline registerfunction function e t t in this registeredfunctions o utils warn overwriting existing registered function t e label t o pipeline registeredfunctions e label e o pipeline warniffunctionnotregistered function e e label e label in this registeredfunctions o utils warn function is not registered with pipeline this may cause problems when serialising the index n e o pipeline load function e var t new o pipeline return e foreach function e var n o pipeline registeredfunctions e if n throw new error cannot load unregistered function e t add n t o pipeline prototype add function array prototype slice call arguments foreach function e o pipeline warniffunctionnotregistered e this stack push e this o pipeline prototype after function e t o pipeline warniffunctionnotregistered t var n this stack indexof e if 1 n throw new error cannot find existingfn n 1 this stack splice n 0 t o pipeline prototype before function e t o pipeline warniffunctionnotregistered t var n this stack indexof e if 1 n throw new error cannot find existingfn this stack splice n 0 t o pipeline prototype remove function e var t this stack indexof e 1 t this stack splice t 1 o pipeline prototype run function e for var t this stack length n 0 n 1 o e n i o e r n t i t math floor r 2 o this elements 2 i return o e 2 i o e 2 i o s u 2 a s t n c 1 r u 1 c 2 u 2 return t o vector prototype similarity function e return this dot e this magnitude e magnitude o vector prototype toarray function for var e new array this elements length 2 t 1 n 0 t 0 var a s i str charat 0 s in i node edges a i node edges s a new o tokenset i node edges s a 1 i str length a final 0 r push node a editsremaining i editsremaining str i str slice 1 if i editsremaining 0 i str length 1 var c s i str charat 1 s in i node edges c i node edges s c new o tokenset i node edges s c i str length 0 1 i str length i node final 0 i editsremaining 0 i str length 1 if in i node edges var u i node edges else var u new o tokenset i node edges u 1 i str length u final 0 r push node u editsremaining i editsremaining 1 str i str slice 1 if i editsremaining 0 if in i node edges var l i node edges else var l new o tokenset i node edges l 0 i str length l final 0 r push node l editsremaining i editsremaining 1 str i str if i editsremaining 0 i str length 1 var d f i str charat 0 h i str charat 1 h in i node edges d i node edges h d new o tokenset i node edges h d 1 i str length d final 0 r push node d editsremaining i editsremaining 1 str f i str slice 2 return n o tokenset fromstring function e for var t new o tokenset n t r 1 i 0 a e length i e t var n this uncheckednodes t r n child tostring r in this minimizednodes n parent edges n char this minimizednodes r n child str r this minimizednodes r n child this uncheckednodes pop o index function e this invertedindex e invertedindex this fieldvectors e fieldvectors this tokenset e tokenset this fields e fields this pipeline e pipeline o index prototype search function e return this query function t new o queryparser e t parse o index prototype query function e var t new o query this fields n object create null r object create null i object create null e call t t for var a 0 a 1 1 e o builder prototype k1 function e this k1 e o builder prototype add function e var t e this ref this documentcount 1 for var n 0 n this length return o querylexer eos var e this str charat this pos return this pos 1 e o querylexer prototype width function return this pos this start o querylexer prototype ignore function this start this pos this pos 1 this start this pos o querylexer prototype backup function this pos 1 o querylexer prototype acceptdigitrun function var e t do e this next t e charcodeat 0 while t 47 t 1 e backup e emit o querylexer term e ignore e more return o querylexer lextext o querylexer lexeditdistance function e return e ignore e acceptdigitrun e emit o querylexer edit distance o querylexer lextext o querylexer lexboost function e return e ignore e acceptdigitrun e emit o querylexer boost o querylexer lextext o querylexer lexeos function e e width 0 e emit o querylexer term o querylexer termseparator o tokenizer separator o querylexer lextext function e for var t e next if t o querylexer eos return o querylexer lexeos if 92 t charcodeat 0 if t return o querylexer lexfield if t return e backup e width 0 e emit o querylexer term o querylexer lexeditdistance if t return e backup e width 0 e emit o querylexer term o querylexer lexboost if t match o querylexer termseparator return o querylexer lexterm else e escapecharacter o queryparser function e t this lexer new o querylexer e this query t this currentclause this lexemeidx 0 o queryparser prototype parse function this lexer run this lexemes this lexer lexemes for var e o queryparser parsefieldorterm e e e this return this query o queryparser prototype peeklexeme function return this lexemes this lexemeidx o queryparser prototype consumelexeme function var e this peeklexeme return this lexemeidx 1 e o queryparser prototype nextclause function var e this currentclause this query clause e this currentclause o queryparser parsefieldorterm function e var t e peeklexeme if void 0 t switch t type case o querylexer field return o queryparser parsefield case o querylexer term return o queryparser parseterm default var n expected either a field or a term found t type throw t str length 1 n with value t str new o queryparseerror n t start t end o queryparser parsefield function e var t e consumelexeme if void 0 t if 1 e query allfields indexof t str var n e query allfields map function e return e join r unrecognised field t str possible fields n throw new o queryparseerror r t start t end e currentclause fields t str var i e peeklexeme if void 0 i var r expecting term found nothing throw new o queryparseerror r t start t end switch i type case o querylexer term return o queryparser parseterm default var r expecting term found i type throw new o queryparseerror r i start i end o queryparser parseterm function e var t e consumelexeme if void 0 t e currentclause term t str tolowercase 1 t str indexof e currentclause usepipeline 1 var n e peeklexeme if void 0 n return void e nextclause switch n type case o querylexer term return e nextclause o queryparser parseterm case o querylexer field return e nextclause o queryparser parsefield case o querylexer edit distance return o queryparser parseeditdistance case o querylexer boost return o queryparser parseboost default var r unexpected lexeme type n type throw new o queryparseerror r n start n end o queryparser parseeditdistance function e var t e consumelexeme if void 0 t var n parseint t str 10 if isnan n var r edit distance must be numeric throw new o queryparseerror r t start t end e currentclause editdistance n var i e peeklexeme if void 0 i return void e nextclause switch i type case o querylexer term return e nextclause o queryparser parseterm case o querylexer field return e nextclause o queryparser parsefield case o querylexer edit distance return o queryparser parseeditdistance case o querylexer boost return o queryparser parseboost default var r unexpected lexeme type i type throw new o queryparseerror r i start i end o queryparser parseboost function e var t e consumelexeme if void 0 t var n parseint t str 10 if isnan n var r boost must be numeric throw new o queryparseerror r t start t end e currentclause boost n var i e peeklexeme if void 0 i return void e nextclause switch i type case o querylexer term return e nextclause o queryparser parseterm case o querylexer field return e nextclause o queryparser parsefield case o querylexer edit distance return o queryparser parseeditdistance case o querylexer boost return o queryparser parseboost default var r unexpected lexeme type i type throw new o queryparseerror r i start i end function o a r a void 0 i function typeof r r call t n t e r e exports i 0 function return o function e t n use strict t esmodule 0 var r n 38 i function e return e e esmodule e default e r t default position i default function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i function function e t n r this e var i string typeof t document queryselector t t if i instanceof htmlelement i parentnode instanceof htmlelement throw new referenceerror if this el i this parent i parentnode i string typeof n document queryselector n n instanceof htmlelement throw new referenceerror this header i this height 0 this pad fixed window getcomputedstyle this header position return e prototype setup function var e array prototype reduce call this parent children function e t return math max e t offsettop 0 this offset e this pad this header offsetheight 0 this update e prototype update function e var t window pageyoffset n window innerheight e resize e type this setup var r top this pad this header offsetheight 0 bottom this parent offsettop this parent offsetheight i n r top math max 0 this offset t math max 0 t n r bottom i this height this el style height this height i px t this offset lock this el dataset mdstate this el dataset mdstate lock lock this el dataset mdstate this el dataset mdstate e prototype reset function this el dataset mdstate this el style height this height 0 e t default i function e t n use strict function r e return e e esmodule e default e t esmodule 0 var i n 40 o r i a n 44 s r a t default adapter o default repository s default function e t n use strict t esmodule 0 var r n 41 i function e return e e esmodule e default e r t default github i default function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function function i e t if e throw new referenceerror this hasn t been initialised super hasn t been called return t object typeof t function typeof t e t function o e t if function typeof t null t throw new typeerror super expression must either be null or a function not typeof t e prototype object create t t prototype constructor value e enumerable 1 writable 0 configurable 0 t object setprototypeof object setprototypeof e t e proto t t esmodule 0 var a n 42 s function e return e e esmodule e default e a c function e function t n r this t var o i this e call this n a github com exec o base if a 3 a length var s a 1 c a 2 console log username s console log repository c o base https api github com users s repos o name c return o return o t e t prototype fetch function var e this return function t var n arguments length 0 void 0 arguments 0 arguments 0 0 return fetch e base per page 30 page n then function e return e json then function r if r instanceof array throw new typeerror if e name var i r find function t return t name e name return i 30 r length i e format i stargazers count stars e format i forks count forks t n 1 return r length repositories t s default t default c function e t n use strict function r e t if e instanceof t throw new typeerror cannot call a class as a function t esmodule 0 var i n 43 o function e return e e esmodule e default e i a function function e t r this e var n string typeof t document queryselector t t if n instanceof htmlanchorelement throw new referenceerror this el n this base this el href this salt this hash this base return e prototype fetch function var e this return new promise function t var n o default getjson e salt cache source void 0 n t n e fetch then function n o default set e salt cache source n expires 1 96 t n e prototype fetch function throw new error fetch not implemented e prototype format function e return e 1e4 e 1e3 tofixed 0 k e 1e3 e 1e3 tofixed 1 k e e prototype hash function e var t 0 if 0 e length return t for var n 0 r e length n 1 if o e path r defaults o number typeof o expires var s new date s setmilliseconds s getmilliseconds 864e5 o expires o expires s o expires o expires o expires toutcstring try a json stringify i test a i a catch e i n write n write i t encodeuricomponent string i replace 23 24 26 2b 3a 3c 3e 3d 2f 3f 40 5b 5d 5e 60 7b 7d 7c g decodeuricomponent t encodeuricomponent string t t t replace 23 24 26 2b 5e 60 7c g decodeuricomponent t t replace g escape var c for var u in o o u c u 0 o u c o u return document cookie t i c t a for var l document cookie document cookie split d 0 9a z 2 g f 0 f this el children 0 offsettop 43 e this active this el dataset mdstate this active e hidden e prototype reset function this el dataset mdstate this active 1 e t default i", "title": ""},{"location": "/archive/", "text": "news archive for post in site posts capture this year post date date y endcapture capture next year post previous date date y endcapture if forloop first this year endif post date date b d y post title if forloop last else if this year next year next year endif endif endfor", "title": "Articles"},{"location": "/feed.xml", "text": "site title xml escape site description xml escape site url site baseurl site time date to rfc822 site time date to rfc822 jekyll v jekyll version for post in site posts limit 10 post title xml escape post content xml escape post date date to rfc822 post url prepend site baseurl prepend site url post url prepend site baseurl prepend site url for tag in post tags tag xml escape endfor for cat in post categories cat xml escape endfor endfor", "title": ""},{"location": "/", "text": "turing jl bayesian inference with probabilistic programming for f in page main feature row f title f excerpt markdownify endfor hello world in turing linear gaussian model page code sample excerpt markdownify quick start highlight julia page code sample snippet endhighlight news feed for post in site posts limit 10 post title post date date b d y endfor news advanced markov chain monte carlo samplers page samplers excerpt markdownify samplers interoperable with deep learning libraries page flux excerpt markdownify bayesian neural network tutorial page community title page community subtitle for f in page community comunities f title f text markdownify go to f title endfor page ecosystem title page ecosystem subtitle for f in page ecosystem ecosystems f title f text go to f title endfor", "title": "Turing.jl - Turing.jl"},{"location": "/news/", "text": "newssubscribe with rss to keep up with the latest news about turing for post in site posts limit 10 if post draft null or post draft false post title post date date b d y if post badges for badge in post badges badge tag endfor endif post excerpt read more endif endfor want to see more see the news archive", "title": "News"},{"location": "/search/search_index.json", "text": "config lang en prebuild index false separator s docs for page in site pages unless page excluded in search if added endif assign added false location page url text page content strip html strip newlines slugify ascii replace title page title assign added true endunless endfor for post in site posts unless page excluded in search if added endif assign added false location post url text post content strip html strip newlines slugify ascii replace title post title assign added true endunless endfor for doc in site docs unless doc excluded in search if added endif assign added false location doc url text doc content strip html strip newlines slugify ascii replace title doc title assign added true endunless endfor", "title": ""},{"location": "/sitemap.xml", "text": "now date y m d daily for section in site data toc site baseurl section url now date y m d daily endfor", "title": ""},{"location": "/robots.txt", "text": "sitemap sitemap xml absolute url", "title": ""},{"location": "/feed.xml", "text": "if page xsl endif jekyll site time date to xmlschema page url absolute url xml escape assign title site title default site name if page collection posts assign collection page collection capitalize assign title title append append collection endif if page category assign category page category capitalize assign title title append append category endif if title title smartify xml escape endif if site description site description xml escape endif if site author site author name default site author xml escape if site author email site author email xml escape endif if site author uri site author uri xml escape endif endif if page tags assign posts site tags page tags else assign posts site page collection endif if page category assign posts posts where category page category endif unless site show drafts assign posts posts where exp post post draft true endunless assign posts posts sort date reverse assign posts limit site feed posts limit default 10 for post in posts limit posts limit assign post title post title smartify strip html normalize whitespace xml escape post title post date date to xmlschema post last modified at default post date date to xmlschema post id absolute url xml escape assign excerpt only post feed excerpt only default site feed excerpt only unless excerpt only post content strip xml escape endunless assign post author post author default post authors 0 default site author assign post author site data authors post author default post author assign post author email post author email default nil assign post author uri post author uri default nil assign post author name post author name default post author post author name default xml escape if post author email post author email xml escape endif if post author uri post author uri xml escape endif if post category elsif post categories for category in post categories endfor endif for tag in post tags endfor if post excerpt and post excerpt empty post excerpt strip html normalize whitespace xml escape endif assign post image post image path default post image if post image unless post image contains assign post image post image absolute url endunless endif endfor", "title": ""},{"location": "/posts/2022-02-17-gsoc", "text": "it is another year of the google summer of code time and we have compiled an updated list of exciting turing projects projects that the turing team would be interested in working with students on over the summer are listed below this information is also cross posted at julia s turing project page if you are interested in exploring any of these projects or have any questions please reach out to the listed project mentors you can find their contact information at turing ml team more real world bayesian models in turing juliamentors kai xu tor e fjelde hong geproject difficulty mediumproject length 175 hrs or 350 hrsdescription there are many real world bayesian models out there and they deserve a turing julia implementation examples include but not limited toforecasting prophet datasets recommender system probabilistic matrix factorisation dataset ranking trueskill dataset bayesian revenue estimation example political forecasting model example topic mining latent dirichlet allocation and new variants multiple annotators combining unreliable observations dawid and skene 1979 for each model we would consider the following tasks as part of a gsoc project correctness test correctness of the implementation can be tested by doing inference for prior samples for which we know the ground truth latent variables performance benchmark this includes i time per mcmc step and ii time per effective sample if the model is differentiable a further break down of i into i 1 time per forward pass and i 2 time per gradient pass are needed real world results if available the final step is to apply the model to a real world dataset if such an experiment has been done in the literature consistency of inference results needs to be checkedimproving the integration between turing and turing s mcmc inference packagesmentors cameron pfiffer mohamed tarek david widmannproject difficulty easyproject length 175 hrsdescription turing jl is based on a set of inference packages maintained by the turinglang group this project is about making use of improvements in dynamicppl to create a generic integration between turing jl and the abstractmcmc jl sampling api the ultimate goal is to remove or substantially reduce algorithm specific glue code inside turing jl the project would also involve improving data structures for storing model parameters in dynamicppl directed graphical model support for the abstract probabilistic programming librarymentors philipp gabler hong geproject difficulty hardproject length 350 hrsdescription we want to have a very light weight representation of probabilistic models of static graphs similar to bugs which can serve as a representation target of other front end dsls or be dynamically built the representation should consist of the model and node representations stochastic and deterministic perhaps hyperparameters and conform to the abstractppl model interface with basic functions evaluation of density sampling conditioning at later stages some static analysis like extraction of markov blankets the model should also contain the state of the variables and implement the abstractppl trace interface dictionary functions querying of variable names the result should be able to work with existing sampling packages through the abstract interfaces a modular tape caching mechanism for reversediffmentors qingliang zhuo mohamed tarekproject difficulty mediumproject length 175 hrsdescription tape caching often leads to significant performance improvements for gradient based sampling algorithms e g hmc nuts tape caching is only possible at the complete computational level for reversediff at the moment this project is about implementing a more modular i e function as a caching barrier tape caching mechanism for reversediff jl benchmarking amp improving performance of the juliagaussianprocesses librariesmentors theo galy fajou will tebbutt st johnproject difficulty mediumproject length 350 hrsdescription although kernelfunctions jl has extensive correctness testing our performance testing is lacking this project aims to resolve this and resolve performance issues wherever they are found the student would first need to extend our existing benchmarking coverage and debug any obvious performance problems the next phase of the work would be to construct end to end examples of kernelfunctions being used in practice profile them to determine where performance problems lie and fix them iterative methods for inference in gaussian processesmentors will tebbutt s t john ross viljoenproject difficulty mediumproject length 175 hrsdescription there has recently been quite a bit of work on inference methods for gps that use iterative methods rather than the cholesky factorisation they look quite promising but no one has implemented any of these within the julia gp ecosystem yet but they should fit nicely within the abstractgps framework if you re interested in improving the gp ecosystem in julia this project might be for you approximate inference methods for non gaussian likelihoods in gaussian processesmentors s t john ross viljoen theo galy fajouproject difficulty hardproject length 350 hrsdescription adding approximate inference methods for non gaussian likelihoods which are available in other gp packages but not yet within juliagps the project would start by determining which approximate inference method s to implement there s lots to do and we re happy to work with a student on whichever method they are most interested in or to suggest one if they have no strong preference gpu integration in the juliagps ecosystemmentors ross viljoen theo galy fajou will tebbuttproject difficulty mediumproject length 350 hrsdescription this would involve first ensuring that common models are able to run fully on the gpu then identifying and improving gpu specific performance bottlenecks this would begin by implementing a limited end to end example involving a gp with a standard kernel and profiling it to debug any substantial performance bottlenecks from there support for a wider range of the functionality available in kernelfunctions jl and abstractgps jl can be added stretch goal extension of gpu support to some functionality in approximategps jl", "title": "Google Summer of Code 2022"},{"location": "/posts/2021-02-04-gsoc", "text": "it s about time for us to start thinking about projects we d like to see at turing jl for the google summer of code 2021 below is a list of projects the turing team would be interested in working with students on for the summer if you are interested in exploring any of these projects please reach out to the listed project mentors you can find their contact information at turing ml team mcmcchains improvementsmentors cameron pfiffer hong geproject difficulty easydescription mcmcchains is a key component of the turing jl ecosystem it is the package that determines how to analyze and store mcmc samples provided by packages like turing it s also used outside of turing for this project a student might improve the performance of the various statistical functions provided by mcmcchains changing the back end to use a data storage format that maintains the shape of parameter samples or improve the general plotting functionality of the package there s lots of fun little things to do for mcmcchains check out this meta issue for more details and dicussions particle filtering methodsmentors hong ge cameron pfifferproject difficulty mediumdescription turing s support for particle sampling methods is slowing being improved with the addition of advancedps jl if you re interested in implementing or improving particle sampling methods this is a great project for you nested samplingmentors miles lucas cameron pfiffer hong geproject difficulty harddescription nestedsamplers jl is an excellent package which implements nested sampling methods as of yet it is not connected to turing jl for this project a student would connect the nestedsamplers jl library to turing jl gpu accelerationmentors mohamed tarek hong ge kai xu tor fjeldeproject difficulty mediumdescription turing s native gpu support is limited in that the metropolis hastings and hmc samplers do not implement gpu sampling methods this can and should be done gpu methods are awesome if you are interested with working on parallelism and gpus this project is for you students will work with the code at advancedmh or advancedhmc depending on their interests documentation and tutorial improvementsmentors cameron pfiffer martin trappproject difficulty easydescription turing s documentation and tutorials need a bit of an overhaul turing has changed significantly since the last time the documentation was written and it s beginning to show students would use their knowledge of probabilistic programming languages and turing to shore up or rewrite documentation and tutorials iterative methods for inference in gaussian processesmentors will tebbutt s t john theo galy fajouproject difficulty mediumdescription there has recently been quite a bit of work on inference methods for gps that use iterative methods rather than the cholesky factorisation they look quite promising but no one has implemented any of these within the julia gp ecosystem yet but they should fit nicely within the abstractgps framework if you re interested in improving the gp ecosystem in julia this project might be for you implement advanced variational gaussian process modelsmentors st john will tebbutt theo galy fajouproject difficulty easy to mediumdescription sparse variational gaussian process models provide the flexibility to scale to large datasets handle arbitrary non conjugate likelihoods and to be used as building blocks for composite models such as deep gps this project is about making such models more readily available within the julia gp ecosystem depending on your interests you can focus on making it easier for end users and providing good tutorials or on the implementations of these models to give us the same or better performance as with established python packages such as gpflow integrating with flux jl etc", "title": "Google Summer of Code 2021"},{"location": "/posts/2020-09-11-gsoc", "text": "as the 2020 google summer of code comes to a close the turing team thought it would be a good opportunity to reflect on the work that was done by our superb students this summer saranjeet kaur s project focused primarily on expanding nestedsamplers jl nestedsamplers jl now supports polychord style nested sampling natively which is an absolute delight saranjeet wrote about this here she also provided a good tutorial on how to use nestedsamplers jl here the nestedsamplers jl integration with turing is still on going integrating new samplers with turing is one of the more difficult tasks if you are interested to see the progress on this check out the relevant pull request arthur lui s project was to provide a much needed set of benchmarks of bayesian nonparametric models between turing and other ppls arthur s work spawned a github repository with good practices for benchmarking as well as three blog posts with some very cool statistics on turing s performance dirichlet process gaussian mixture model via the stick breaking construction in various pplsgaussian process regression model in various pplsgaussian process classification model in various pplsfinally sharan yalburgi a returning gsoc student completed an epic amount of work turing s growing suite of gaussian process tools in particular the github organization juliagaussianprocesses was founded and serves as an effort to build a robust gaussian process framework for the julia ecosystem the framework consists of multiple gp related julia packages kernelfunctions jl provides kernel functions for gps as well as efficient ad for these kernels kernelfunctions jl also supports multi output gps by providing necessary data abstractions and multi output kernels abstractgps jl defines gp abstractions and provides exact posteriors it provides support for induced points based gp posteriors and for efficient sequential online sparse gp updates gplikelihoods jl defines alternate likelihoods for non gaussian gps gpmlj jl provides a julia interface for gpflow a gp library written in python using tensorflow special thanks to our three gsoc students for this summer who all did excellent work additional thanks to google for supporting open source software development and the julia language", "title": "Google Summer of Code 2020"},{"location": "/posts/2020-05-04-Imperial-Report13-analysis", "text": "the turing jl team is currently exploring possibilities in an attempt to help with the ongoing sars cov 2 crisis as preparation for this and to get our feet wet we decided to perform a replication study of the imperial report 13 which attempts to estimate the real number of infections and impact of non pharmaceutical interventions on covid 19 in the report the inference was performed using the probabilistic programming language ppl stan we have explicated their model and inference in turing jl a julia based ppl we believe the results and analysis of our study are relevant for the public and for other researchers who are actively working on epidemiological models to that end our implementation and results are available here in summary we replicated the imperial covid 19 model using turing jl subsequently we compared the inference results between turing and stan and our comparison indicates that results are reproducible with two different implementations in particular we performed 4 sets of simulations using the imperial covid 19 model the resulting estimates of the expected real number of cases in contrast to the recorded number of cases the reproduction number r t and the expected number of deaths as a function of time and non pharmaceutical interventions npis for each simulation are shown below simulation a hypothetical simulation from the model without data prior predictive or non pharmaceutical interventions under the prior assumptions of the imperial covid 19 model there is a very wide range of epidemic progressions with expected cases from almost 0 to 100 of the population over time the black bar corresponds to the date of the last observation note that r t has a different time range than the other plots following the original report this shows the 100 days following the country specific epidemic start which is defined to be 31 days prior to the first date of 10 cumulative deaths while the other plots show the last 60 days simulation b future simulation with non pharmaceutical interventions kept in place posterior predictive after incorporating the observed infection data we can see a substantially more refined range of epidemic progression the reproduction rate estimate lies in the range of 3 5 5 6 before any intervention is introduced the dotted lines correspond to observations and the black bar corresponds to the date of the last observation simulation c future simulation with non pharmaceutical interventions removed now we see the hypothetical scenarios after incorporating infection data but with non pharmaceutical interventions removed this plot looks similar to simulation a but with a more rapid progression of the pandemic since the estimated reproduction rate is bigger than the prior assumptions the dotted lines correspond to observations and the black bar corresponds to the date of the last observation simulation d future simulation with when lockdown is lifted two weeks before the last observation predictive posterior as a result there is a clear rapid rebound of the reproduction rate comparing with simulation b we do not observe an immediate increase in the number of expected cases and deaths upon lifting lockdown but there is a significant difference in the number of cases and deaths in the last few days in the plot simulation d results in both greater number of cases and deaths as expected this demonstrates how the effects of lifting an intervention might not become apparent in the measurable variables e g deaths until several weeks later the dotted lines correspond to observations the black bar corresponds to the date of the last observation and the red bar indicates when lockdown was lifted overall simulation a shows the prior modelling assumptions and how these prior assumptions determine the predicted number of cases etc before seeing any data simulation b predicts the trend of the number of cases etc using estimated parameters and by keeping all the non pharmaceutical interventions in place simulation c shows the estimate in the case where none of the intervention measures are ever put in place simulation d shows the estimates in the case when the lockdown was lifted two weeks prior to the last observation while keeping all the other non pharmaceutical interventions in place we want to emphasise that we do not provide additional analysis of the imperial model yet nor are we aiming to make any claims about the validity or the implications of the model instead we refer to imperial report 13 for more details and analysis the purpose of this post is solely to add validation to the inference performed in the paper by obtaining the same results using a different probabilistic programming language ppl and by exploring whether or not turing jl can be useful for researchers working on these problems for our next steps we re looking at collaboration with other researchers and further developments of this and similar models there are some immediate directions to explore incoporation of more sources of data e g national mobility seasonal changes and behavior changes in individuals how the assumptions incorporated into the priors and their parameters change resulting posterior the current model does not directly include recovery as a possibility and assumes that if a person has been infected once then he she will be infectious until death number of recovered cases suffers from the same issues as the number of cases it cannot be directly observed but we can also deal with it in a similar manner as is done with number of cases and incorporate this into the model for a potential improvement this will result in a plethora of different models from which we can select the most realistic one using different model comparions techniques e g leave one out cross validation loo cv such model refinement can be potentially valuable given the high impact of this pandemic and the uncertainty and debates in the potential outcomes acknowledgement we would like to thank the julia community for creating such an excellent platform for scientific computing and for the continuous feedback that we have received we also thank researchers from computational and biological laboratory at cambridge university for their feedback on an early version of the post", "title": "Replication study: Estimating number of infections and impact of NPIs on COVID-19 in European countries (Imperial Report 13)"},{"location": "/posts/2020-02-12-jsoc", "text": "last year turing participated in the google summer of code gsoc through the julia language organization it was a fun time and the project was better for it turing plans to participate in the upcoming gsoc and we wanted to outline some potential projects and expectations we have for applicants if you are not aware google provides funds to students around the world to develop a project of their choice over the summer students receive funds from google and spend three months on any open source project the turing development team has prepared a list of possible projects that we have deemed valuable to the project and easy enough that it could feasibly be created in the three month limit this list is not exlusive if you have a good idea you can write it up in your proposal though it is recommend that you reach out to any of the turing team on julia s slack you can get an invite here or discourse messages on discourse should be posted to the quot probabilistic programming quot category we ll find you possible project ideas benchmarking turing s performance has been sporadically benchmarked against various other probabilistic programming languages e g turing stan pymc3 tensorflow prob but a systemic approach to studying where turing excels and where it falls short would be useful a gsoc student would implement identical models in many ppls and build tools to benchmark all ppls against one another nested sampling integration turing focuses on modularity in inference methods and the development team would like to see more inference methods particularly the popular nested sampling method a julia package nestedsamplers jl but it is not hooked up to turing and does not currently have a stable api a gsoc student would either integrate that package or construct their own nested sampling method and build it into turing automated function memoization by model annotation function memoization is a way to reduce costly function evaluation by caching the output when the same inputs are given turing s gibbs sampler often ends up rerunning expensive functions multiple times and it would be a significant performance improvement to allow turing s model compiler to automatically memoize functions where appropriate a student working on this project would become intimately familiar with turing s model compiler and build in various automated improvements making distributions gpu compatible julia s gpu tooling is generally quite good but currently turing is not able to reliably use gpus while sampling because distributions jl is not gpu compatible a student on this project would work with the turing developers and the distributions developers to allow the use of gpu parallelism where possible in turing static distributions small fixed size vectors and matrices are fairly common in turing models this means that sampling in turing can probably benefit from using statically sized vectors and matrices from staticarrays jl instead of the dynamic normal julia arrays beside the often superior performance of small static vectors and matrices static arrays are also automatically compatible with the gpu stack in julia currently the main obstacle to using staticarrays jl is that distributions in distributions jl are not compatible with staticarrays a gsoc student would adapt the multivariate and matrix variate distributions as well as the univariate distribution with vector parameters in distributions jl to make a spin off package called staticdistributions jl the student would then benchmark staticdistributions jl against distributions jl and showcase an example of using staticdistributions jl together with cuarrays jl and or cudanative jl for gpu acceleration gpnet extensions one of turing s sattelite packages gpnet is designed to provide a comprehensive suite of gaussian process tools see this issue for potential tasks there s a lot of interesting stuff going on with gps and this task in particular may have some creative freedom to it better chains and model diagnostics one package that turing and many others rely on heavily is mcmcchains jl a package designed to format store and analyze parameter samples generated during mcmc inference mcmcchains is currently showing its age a little and has many bad design choices that need to be fixed alternatively a student could contstruct a far more lightweight chain system model comparison tools turing and its sattelite packages do not currently provide a comprehensive suite of model comparison tools a critical tool for the applied statistician a student who worked on this project would implement various model comparison tools like loo and waic among others mle map tools maximum likelihood estimates mle and maximum a posteriori map estimates can currently only be done by users through a clunky set of workarounds a streamlined function like mle model or map model would be very useful for many of turing s users who want to see what the mle or map estimates look like and it may be valuable to allow for functionality that allows mcmc sampling to begin from the mle or map estimates students working on this project will work with optimization packages such as optim jl to make mle and map estimation straightforward for turing models particle sampler improvements turing s development team has spent a lot of time and energy to make inference methods more modular but turing s particle samplers have not yet been modernized and spun off into a separate package two packages that resulted from this were advancedhmc for hamiltonian mcmc methods and advancedmh for metropolis hastings style inference methods a student who worked on this project would become very familiar with turing s inference backend and with particle sampling methods this is a good project for people who love making things efficient and easily extendable other projects are welcome but we do strongly recommend discussing any potential projects with members of the turing team as they will end up mentoring gsoc students for the duration of the project we re looking forward to what people are interested in", "title": "Google Summer of Code/Julia Summer of Code"},{"location": "/posts/2019-12-14-initial-post", "text": "all good open source projects should have a blog and turing is one such project later on members of the turing team may be populating this feed with posts on topics likeinteresting things you can do with turing or interesting things we have seen others do development updates and major release announcements research updates explorations of turing s internals updates to turing s sattelite projects advancedhmc jl or bijectors jl stay tuned", "title": "Turing's Blog"},{"location": "/docs/library/advancedhmc/", "text": "indexadvancedhmc abstractintegratoradvancedhmc abstractmcmckerneladvancedhmc abstractmetricadvancedhmc abstractterminationcriterionadvancedhmc abstracttrajectorysampleradvancedhmc binarytreeadvancedhmc classicnouturnadvancedhmc dynamicterminationcriterionadvancedhmc endpointtsadvancedhmc fixedintegrationtimeadvancedhmc fixednstepsadvancedhmc fullmomentumrefreshmentadvancedhmc generalisednouturnadvancedhmc hmcadvancedhmc hmcdaadvancedhmc hmcprogresscallbackadvancedhmc hmcsampleradvancedhmc hmcstateadvancedhmc jitteredleapfrogadvancedhmc leapfrog advancedhmc multinomialts dev docs library advancedhmc advancedhmc multinomialts tuple multinomialts abstractfloat advancedhmc phasepoint advancedhmc multinomialts advancedhmc multinomialts dev docs library advancedhmc advancedhmc multinomialts tuple random abstractrng advancedhmc phasepoint advancedhmc nutsadvancedhmc partialmomentumrefreshmentadvancedhmc slicets advancedhmc slicets dev docs library advancedhmc advancedhmc slicets tuple slicets abstractfloat advancedhmc phasepoint advancedhmc slicets dev docs library advancedhmc advancedhmc slicets tuple random abstractrng advancedhmc phasepoint advancedhmc staticterminationcriterionadvancedhmc strictgeneralisednouturnadvancedhmc temperedleapfrog advancedhmc termination dev docs library advancedhmc advancedhmc termination union tuple f tuple multinomialts trajectory f f where f lt abstractfloat advancedhmc termination dev docs library advancedhmc advancedhmc termination union tuple f tuple slicets trajectory f f where f lt abstractfloat advancedhmc terminationadvancedhmc trajectoryadvancedhmc transition advancedhmc a dev docs library advancedhmc advancedhmc a tuple any any any advancedhmc build tree dev docs library advancedhmc advancedhmc build tree union tuple tc tuple i tuple ts tuple random abstractrng trajectory ts i tc hamiltonian advancedhmc phasepoint advancedhmc abstracttrajectorysampler int64 int64 abstractfloat where ts lt advancedhmc abstracttrajectorysampler i lt advancedhmc abstractintegrator tc lt advancedhmc dynamicterminationcriterion advancedhmc check left subtree dev docs library advancedhmc advancedhmc check left subtree union tuple t tuple hamiltonian t t t where t lt advancedhmc binarytree advancedhmc check right subtree dev docs library advancedhmc advancedhmc check right subtree union tuple t tuple hamiltonian t t t where t lt advancedhmc binarytree advancedhmc combine dev docs library advancedhmc advancedhmc combine tuple advancedhmc binarytree advancedhmc binarytree advancedhmc determine sampler eltype advancedhmc find good stepsize dev docs library advancedhmc advancedhmc find good stepsize union tuple t tuple random abstractrng hamiltonian abstractvector t where t lt real advancedhmc isterminated dev docs library advancedhmc advancedhmc isterminated tuple generalisednouturn hamiltonian advancedhmc binarytree advancedhmc isterminated dev docs library advancedhmc advancedhmc isterminated tuple strictgeneralisednouturn hamiltonian any any any advancedhmc isterminated dev docs library advancedhmc advancedhmc isterminated tuple classicnouturn hamiltonian advancedhmc binarytree advancedhmc maxabs dev docs library advancedhmc advancedhmc maxabs tuple any any advancedhmc mh accept ratio dev docs library advancedhmc advancedhmc mh accept ratio union tuple t tuple random abstractrng t t where t lt abstractfloat advancedhmc nom step size advancedhmc pm next dev docs library advancedhmc advancedhmc pm next tuple any namedtuple advancedhmc randcat dev docs library advancedhmc advancedhmc randcat union tuple t tuple union random abstractrng abstractvector var quot s9 quot where var quot s9 quot lt random abstractrng abstractmatrix t where t advancedhmc sampler eltype advancedhmc simple pm next dev docs library advancedhmc advancedhmc simple pm next tuple any namedtuple advancedhmc statadvancedhmc step size advancedhmc temper dev docs library advancedhmc advancedhmc temper tuple temperedleapfrog any namedtuple i is half var quot s17 quot where var quot s17 quot lt tuple integer bool int64 advancedhmc transition dev docs library advancedhmc advancedhmc transition tuple trajectory hamiltonian advancedhmc phasepoint advancedhmc update nom step sizefunctions advancedhmc a method a single hamiltonian integration step note this function is intended to be used in find good stepsize only advancedhmc build tree method recursivly build a tree for a given depth j advancedhmc check left subtree method check left subtree h t tleft tright do a u turn check between the leftmost phase point of t and the leftmost phase point of tright the right subtree advancedhmc check right subtree method check right subtree h t tleft tright do a u turn check between the rightmost phase point of t and the rightmost phase point of tleft the left subtree advancedhmc combine method combine treeleft treeright merge a left tree treeleft and a right tree treeright under given hamiltonian h then draw a new candidate sample and update related statistics for the resulting tree advancedhmc determine sampler eltype method determine sampler eltype xs determine the element type to use for the given arguments symbols are either resolved to the default float type or simply dropped in favour of determined types from the other arguments advancedhmc find good stepsize method find a good initial leap frog step size via heuristic search advancedhmc isterminated method isterminated h t detect u turn for two phase points zleft and zright under given hamiltonian h using the original no u turn cirterion ref https arxiv org abs 1111 4246 https arxiv org abs 1701 02434 advancedhmc isterminated method isterminated h t detect u turn for two phase points zleft and zright under given hamiltonian h using the generalised no u turn criterion ref https arxiv org abs 1701 02434 advancedhmc isterminated method isterminated tc h t tleft tright detect u turn for two phase points zleft and zright under given hamiltonian h using the generalised no u turn criterion with additional u turn checks ref https arxiv org abs 1701 02434 https github com stan dev stan pull 2800 advancedhmc maxabs method maxabs a b return the value with the largest absolute value advancedhmc mh accept ratio method perform mh acceptance based on energy i e negative log probability advancedhmc nom step size method nom step size abstractintegrator get the nominal integration step size the current integration step size may differ from this for example if the step size is jittered nominal step size is usually used in adaptation advancedhmc pm next method progress meter update with all trajectory stats iteration number and metric shown advancedhmc randcat method randcat rng p abstractmatrix generating categorical random variables in a vectorized mode p is supposed to be a matrix of d n where each column is a probability vector examplep 0 5 0 3 0 4 0 6 0 1 0 1 u 0 3 0 4 c 0 5 0 3 0 9 0 9 1 0 1 0 then c lt u is 0 1 0 0 0 0 thus convert int vec sum c lt u dims 1 1 equals 1 2 advancedhmc sampler eltype function sampler eltype sampler return the element type of the sampler advancedhmc simple pm next method simple progress meter update without any show values advancedhmc stat method returns the statistics for transition t advancedhmc step size function step size abstractintegrator get the current integration step size advancedhmc temper method temper lf temperedleapfrog r step namedtuple i is half lt tuple integer bool n steps int tempering step step is a named tuple withi being the current leapfrog iteration andis half indicating whether or not it s the first half momentum tempering step advancedhmc transition method transition h z make a mcmc transition from phase point z using the trajectory under hamiltonian h note this is a rng implicit fallback function for transition global rng h z advancedhmc update nom step size function update nom step size i abstractintegrator gt abstractintegratorreturn a copy of the integrator i with the new nominal step size nom step size statsbase sample method sample rng abstractrng h hamiltonian abstractmcmckernel abstractvecormat t n samples int adaptor abstractadaptor noadaptation n adapts int min div n samples 10 1 000 drop warmup bool false verbose bool true progress bool false sample n samples samples using the proposal under hamiltonian h the randomness is controlled by rng if rng is not provided global rng will be used the initial point is given by the adaptor is set by adaptor for which the default is no adaptation it will perform n adapts steps of adaptation for which the default is the minimum of 1 000 and 10 of n samplesdrop warmup controls to drop the samples during adaptation phase or notverbose controls the verbosityprogress controls whether to show the progress meter or nottypes advancedhmc abstractintegrator type abstract type abstractintegratorrepresents an integrator used to simulate the hamiltonian system implementationa abstractintegrator is expected to have the following implementations stat ref nom step size ref step size ref advancedhmc abstractmcmckernel type abstract type abstractmcmckernelabstract type for hmc kernels advancedhmc abstractmetric type abstract type abstractmetricabstract type for preconditioning metrics advancedhmc abstractterminationcriterion type abstract type abstractterminationcriterionabstract type for termination criteria for hamiltonian trajectories e g no u turn and fixed number of leapfrog integration steps advancedhmc abstracttrajectorysampler type how to sample a phase point from the simulated trajectory advancedhmc binarytree type a full binary tree trajectory with only necessary leaves and information stored advancedhmc classicnouturn type struct classicnouturn f lt abstractfloat lt advancedhmc dynamicterminationcriterionclassic no u turn criterion as described in eq 9 in 1 informally this will terminate the trajectory expansion if continuing the simulation either forwards or backwards in time will decrease the distance between the left most and right most positions fieldsmax depth int64 max abstractfloatreferenceshoffman m d amp gelman a 2014 the no u turn sampler adaptively setting path lengths in hamiltonian monte carlo journal of machine learning research 15 1 1593 1623 arxiv advancedhmc dynamicterminationcriterion type abstract type dynamicterminationcriterion lt advancedhmc abstractterminationcriterionabstract type for dynamic hamiltonian trajectory termination criteria advancedhmc endpointts type samples the end point of the trajectory advancedhmc fixedintegrationtime type struct fixedintegrationtime f lt abstractfloat lt advancedhmc staticterminationcriterionstandard hmc implementation with a fixed integration time fields abstractfloat total length of the trajectory i e take floor integrator step size number of leapfrog steps referencesneal r m 2011 mcmc using hamiltonian dynamics handbook of markov chain monte carlo 2 11 2 arxiv advancedhmc fixednsteps type struct fixednsteps lt advancedhmc staticterminationcriterionstatic hmc with a fixed number of leapfrog steps fieldsl int64 number of steps to simulate i e length of trajectory will be l 1 referencesneal r m 2011 mcmc using hamiltonian dynamics handbook of markov chain monte carlo 2 11 2 arxiv advancedhmc fullmomentumrefreshment type completly resample new momentum advancedhmc generalisednouturn type struct generalisednouturn f lt abstractfloat lt advancedhmc dynamicterminationcriteriongeneralised no u turn criterion as described in section a 4 2 in 1 fieldsmax depth int64 max abstractfloatreferencesbetancourt m 2017 a conceptual introduction to hamiltonian monte carlo arxiv preprint arxiv 1701 02434 advancedhmc hmc type hmc real n leapfrog int hamiltonian monte carlo sampler with static trajectory fieldsn leapfrog number of leapfrog steps integrator choice of integrator specified either using a symbol or abstractintegratormetric choice of initial metric symbol means it is automatically initialised the metric type will be preserved during automatic initialisation and adaption advancedhmc hmcda type hmcda real real integrator leapfrog metric diagonal hamiltonian monte carlo sampler with dual averaging algorithm fields target acceptance rate for dual averaging target leapfrog length integrator choice of integrator specified either using a symbol or abstractintegratormetric choice of initial metric symbol means it is automatically initialised the metric type will be preserved during automatic initialisation and adaption notesfor more information please view the following paper arxiv link hoffman matthew d and andrew gelman quot the no u turn sampler adaptively setting path lengths in hamiltonian monte carlo quot journal of machine learning research 15 no 1 2014 1593 1623 advancedhmc hmcprogresscallback type hmcprogresscallbacka callback to be used with abstractmcmc jl s interface replicating the logging behavior of the non abstractmcmc sample dev docs library advancedhmc statsbase sample union tuple t tuple union random abstractrng abstractvector var quot s318 quot where var quot s318 quot lt random abstractrng hamiltonian hmckernel t int64 tuple union random abstractrng abstractvector var quot s319 quot where var quot s319 quot lt random abstractrng hamiltonian hmckernel t int64 advancedhmc adaptation abstractadaptor tuple union random abstractrng abstractvector var quot s320 quot where var quot s320 quot lt random abstractrng hamiltonian hmckernel t int64 advancedhmc adaptation abstractadaptor int64 where t lt abstractvecormat var quot s317 quot where var quot s317 quot lt abstractfloat fieldspm progress meter from progressmeters jl progress specifies whether or not to use display a progress bar verbose if progress is not specified and this is true some information will be logged upon completion of adaptation num divergent transitions number of divergent transitions fo far num divergent transitions during adaption advancedhmc hmcsampler type hmcsampleran abstractmcmc abstractsampler for kernels in advancedhmc jl fields abstractmcmckernel metric choice of initial metric abstractmetric the metric type will be preserved during adaption adaptor advancedhmc adaptation abstractadaptor notesnote that all the fields have the prefix initial to indicate that these will not necessarily correspond to the kernel metric and adaptor after sampling to access the updated fields use the resulting hmcstate advancedhmc hmcstate type hmcstaterepresents the state of a hmcsampler fieldsi index of current iteration transition current transition metric current abstractmetric possibly adapted current abstractmcmckernel adaptor current abstractadaptor advancedhmc jitteredleapfrog type struct jitteredleapfrog ft lt abstractfloat t lt union abstractarray ft lt abstractfloat 1 ft lt abstractfloat lt advancedhmc abstractleapfrog t lt union abstractarray ft lt abstractfloat 1 ft lt abstractfloat leapfrog integrator with randomly quot jittered quot step size for every trajectory fields 0 union abstractvector ft ft where ft lt abstractfloat nominal non jittered step size jitter abstractfloat the proportion of the nominal step size 0 that may be added or subtracted union abstractvector ft ft where ft lt abstractfloat current jittered step size descriptionthis is the same as leapfrog ref but with a quot jittered quot step size this means that at the beginning of each trajectory we sample a step size by adding or subtracting from the nominal base step size 0 some random proportion of 0 with the proportion specified by jitter i e 0 jitter 0 rand p jittering might help alleviate issues related to poor interactions with a fixed step size in regions with high quot curvature quot the current choice of step size might mean over shoot leading to almost all steps being rejected randomly sampling the step size at the beginning of the trajectories can therefore increase the probability of escaping such high curvature regions exact periodicity of the simulated trajectories might occur i e you might be so unlucky as to simulate the trajectory forwards in time l and ending up at the same point which results in non ergodicity see section 3 2 in 1 if momentum is refreshed before each trajectory then this should not happen exactly but it can still be an issue in practice randomly choosing the step size might help alleviate such problems referencesneal r m 2011 mcmc using hamiltonian dynamics handbook of markov chain monte carlo 2 11 2 arxiv advancedhmc leapfrog type struct leapfrog t lt union abstractvector var s29 var s29 where var s29 lt abstractfloat lt advancedhmc abstractleapfrog t lt union abstractvector var s29 var s29 where var s29 lt abstractfloat leapfrog integrator with fixed step size fields union abstractvector var quot s29 quot var quot s29 quot where var quot s29 quot lt abstractfloat step size advancedhmc multinomialts type struct multinomialts f lt abstractfloat lt advancedhmc abstracttrajectorysamplermultinomial trajectory sampler carried during the building of the tree it contains the weight of the tree defined as the total probabilities of the leaves fieldszcand advancedhmc phasepoint sampled candidate phasepoint w abstractfloat total energy for the given tree i e the sum of energies of all leaves advancedhmc multinomialts method struct multinomialts f lt abstractfloat lt advancedhmc abstracttrajectorysamplermultinomial sampler for a trajectory consisting only a leaf node tree weight is the unnormalised energy of the leaf advancedhmc multinomialts method struct multinomialts f lt abstractfloat lt advancedhmc abstracttrajectorysamplermultinomial sampler for the starting single leaf tree log weights for leaf nodes are their unnormalised hamiltonian energies ref https github com stan dev stan blob develop src stan mcmc hmc nuts base nuts hpp l226 advancedhmc nuts type nuts real max depth int 10 max real 1000 integrator leapfrog metric diagonal no u turn sampler nuts sampler fields target acceptance rate for dual averaging max depth maximum doubling tree depth max maximum divergence during doubling tree integrator choice of integrator specified either using a symbol or abstractintegratormetric choice of initial metric symbol means it is automatically initialised the metric type will be preserved during automatic initialisation and adaption advancedhmc partialmomentumrefreshment type struct partialmomentumrefreshment f lt abstractfloat lt advancedhmc abstractmomentumrefreshmentpartial momentum refreshment with refresh rate fields abstractfloatsee equation 5 19 1 r r sqrt 1 gwhere r is the momentum and g is a gaussian random variable referencesneal radford m quot mcmc using hamiltonian dynamics quot handbook of markov chain monte carlo 2 11 2011 2 advancedhmc slicets type struct slicets f lt abstractfloat lt advancedhmc abstracttrajectorysamplertrajectory slice sampler carried during the building of the tree it contains the slice variable and the number of acceptable condidates in the tree fieldszcand advancedhmc phasepoint sampled candidate phasepoint u abstractfloat slice variable in log space n int64 number of acceptable candidates i e those with probability larger than slice variable u advancedhmc slicets method struct slicets f lt abstractfloat lt advancedhmc abstracttrajectorysamplerslice sampler for the starting single leaf tree slice variable is initialized advancedhmc slicets method struct slicets f lt abstractfloat lt advancedhmc abstracttrajectorysamplercreate a slice sampler for a single leaf tree the slice variable is copied from the passed in sampler s andthe number of acceptable candicates is computed by comparing the slice variable against the current energy advancedhmc staticterminationcriterion type abstract type staticterminationcriterion lt advancedhmc abstractterminationcriterionabstract type for a fixed number of leapfrog integration steps advancedhmc strictgeneralisednouturn type struct strictgeneralisednouturn f lt abstractfloat lt advancedhmc dynamicterminationcriteriongeneralised no u turn criterion as described in section a 4 2 in 1 with added u turn check as described in 2 fieldsmax depth int64 max abstractfloatreferencesbetancourt m 2017 a conceptual introduction to hamiltonian monte carlo arxiv preprint arxiv 1701 02434 https github com stan dev stan pull 2800 advancedhmc temperedleapfrog type struct temperedleapfrog ft lt abstractfloat t lt union abstractarray ft lt abstractfloat 1 ft lt abstractfloat lt advancedhmc abstractleapfrog t lt union abstractarray ft lt abstractfloat 1 ft lt abstractfloat tempered leapfrog integrator with fixed step size and quot temperature quot fields union abstractvector ft ft where ft lt abstractfloat step size abstractfloat temperature parameter descriptiontempering can potentially allow greater exploration of the posterior e g in a multi modal posterior jumps between the modes can be more likely to occur advancedhmc termination type terminationtermination reasonsdynamic due to stoping criterianumerical due to large energy deviation from starting possibly numerical errors advancedhmc termination method termination s nt h0 h check termination of a hamiltonian trajectory advancedhmc termination method termination s nt h0 h check termination of a hamiltonian trajectory advancedhmc trajectory type struct trajectory ts lt advancedhmc abstracttrajectorysampler i lt advancedhmc abstractintegrator tc lt advancedhmc abstractterminationcriterion numerically simulated hamiltonian trajectories advancedhmc transition type struct transition p lt advancedhmc phasepoint nt lt namedtuple a transition that contains the phase point and other statistics of the transition fieldsz advancedhmc phasepoint phase point for the transition stat namedtuple statistics related to the transition e g energy", "title": "AdvancedHMC"},{"location": "/docs/library/", "text": "indexturing binomiallogitturing flatturing flatposturing orderedlogisticturing inference gibbsturing inference hmcturing inference hmcdaturing inference isturing inference mhturing inference nutsturing inference pgturing inference smcmodelling dynamicppl model macro model expr warn false macro to specify a probabilistic model if warn is true a warning is displayed if internal variable names are used in the model definition examplesmodel definition model function model x y 42 endto generate a model call model xvalue or model xvalue yvalue samplers dynamicppl sampler type sampler t generic sampler type for inference algorithms of type t in dynamicppl sampler should implement the abstractmcmc interface and in particular abstractmcmc step a default implementation of the initial sampling step is provided that supports resuming sampling from a previous state and setting initial parameter values it requires to overload loadstate and initialstep for loading previous states and actually performing the initial sampling step respectively additionally sometimes one might want to implement initialsampler that specifies how the initial parameter values are sampled if they are not provided by default values are sampled from the prior turing inference gibbs type gibbs algs compositional mcmc interface gibbs sampling combines one or more sampling algorithms each of which samples from a different set of variables in a model example model function gibbs example x v1 normal 0 1 v2 categorical 5 end use pg for a v2 variable and use hmc for the v1 variable note that v2 is discrete so the pg sampler is more appropriate than is hmc alg gibbs hmc 0 2 3 v1 pg 20 v2 one can also pass the number of iterations for each gibbs component using the following syntax alg gibbs hmc 0 2 3 v1 n hmc pg 20 v2 n pg where n hmc and n pg are the number of hmc and pg iterations for each gibbs iteration tips hmc and nuts are fast samplers and can throw off particle basedmethods like particle gibbs you can increase the effectiveness of particle sampling by including more particles in the particle sampler source turing inference hmc type hmc float64 n leapfrog int adtype adtypes abstractadtype autoforwarddiff chunksize 0 hamiltonian monte carlo sampler with static trajectory arguments the leapfrog step size to use n leapfrog the number of leapfrog steps to use adtype the automatic differentiation ad backend if not specified forwarddiff is used with its chunksize automatically determined usagehmc 0 05 10 tipsif you are receiving gradient errors when using hmc try reducing the leapfrog step size e g original step sizesample gdemo 1 5 2 hmc 0 1 10 1000 reduced step sizesample gdemo 1 5 2 hmc 0 01 10 1000 source turing inference hmcda type hmcda n adapts int float64 float64 float64 0 0 adtype adtypes abstractadtype autoforwarddiff chunksize 0 hamiltonian monte carlo sampler with dual averaging algorithm usagehmcda 200 0 65 0 3 argumentsn adapts numbers of samples to use for adaptation target acceptance rate 65 is often recommended target leapfrog length initial step size 0 means automatically search by turing adtype the automatic differentiation ad backend if not specified forwarddiff is used with its chunksize automatically determined referencefor more information please view the following paper arxiv link hoffman matthew d and andrew gelman quot the no u turn sampler adaptively setting path lengths in hamiltonian monte carlo quot journal of machine learning research 15 no 1 2014 1593 1623 source turing inference is type is importance sampling algorithm usage is example define a simple normal model with unknown mean and variance model function gdemo x s inversegamma 2 3 m normal 0 sqrt s x 1 normal m sqrt s x 2 normal m sqrt s return s mendsample gdemo 1 5 2 is 1000 source turing inference mh type mh space construct a metropolis hastings algorithm the arguments space can beblank i e mh in which case mh defaults to using the prior for each parameter as the proposal distribution a set of one or more symbols to sample with mh in conjunction with gibbs i e gibbs mh m pg 10 s an iterable of pairs or tuples mapping a symbol to a advancedmh proposal distribution or function that generates returns a conditional proposal distribution a covariance matrix to use as for mean zero multivariate normal proposals examplesthe default mh will use propose samples from the prior distribution using advancedmh staticproposal model function gdemo x y s inversegamma 2 3 m normal 0 sqrt s x normal m sqrt s y normal m sqrt s endchain sample gdemo 1 5 2 0 mh 1 000 mean chain alternatively you can specify particular parameters to sample if you want to combine sampling from multiple samplers model function gdemo x y s inversegamma 2 3 m normal 0 sqrt s x normal m sqrt s y normal m sqrt s end samples s with mh and m with pgchain sample gdemo 1 5 2 0 gibbs mh s pg 10 m 1 000 mean chain using custom distributions defaults to using static mh model function gdemo x y s inversegamma 2 3 m normal 0 sqrt s x normal m sqrt s y normal m sqrt s end use a static proposal for s and random walk with proposal standard deviation of 0 25 for m chain sample gdemo 1 5 2 0 mh s gt inversegamma 2 3 m gt normal 0 1 1 000 mean chain specifying explicit proposals using the advancedmh interface model function gdemo x y s inversegamma 2 3 m normal 0 sqrt s x normal m sqrt s y normal m sqrt s end use a static proposal for s and random walk with proposal standard deviation of 0 25 for m chain sample gdemo 1 5 2 0 mh s gt advancedmh staticproposal inversegamma 2 3 m gt advancedmh randomwalkproposal normal 0 0 25 1 000 mean chain using a custom function to specify a conditional distribution model function gdemo x y s inversegamma 2 3 m normal 0 sqrt s x normal m sqrt s y normal m sqrt s end use a static proposal for s and and a conditional proposal for m where the proposal is centered around the current sample chain sample gdemo 1 5 2 0 mh s gt inversegamma 2 3 m gt x gt normal x 1 1 000 mean chain providing a covariance matrix will cause mh to perform random walk sampling in the transformed space with proposals drawn from a multivariate normal distribution the provided matrix must be positive semi definite and square usage model function gdemo x y s inversegamma 2 3 m normal 0 sqrt s x normal m sqrt s y normal m sqrt s end providing a custom variance covariance matrixchain sample gdemo 1 5 2 0 mh 0 25 0 05 0 05 0 50 1 000 mean chain source turing inference nuts type nuts n adapts int float64 max depth int 10 max float64 1000 0 init float64 0 0 adtype adtypes abstractadtype autoforwarddiff chunksize 0 no u turn sampler nuts sampler usage nuts use default nuts configuration nuts 1000 0 65 use 1000 adaption steps and target accept ratio 0 65 arguments n adapts int the number of samples to use with adaptation float64 target acceptance rate for dual averaging max depth int maximum doubling tree depth max float64 maximum divergence during doubling tree init float64 initial step size 0 means automatically searching using a heuristic procedure adtype adtypes abstractadtype the automatic differentiation ad backend if not specified forwarddiff is used with its chunksize automatically determined source turing inference pg type struct pg space r lt turing inference particleinferenceparticle gibbs sampler fieldsnparticles int64 number of particles resampler any resampling algorithm source turing inference smc type struct smc space r lt turing inference particleinferencesequential monte carlo sampler fieldsresampler anysourcedistributions turing flat type flat the flat distribution is the improper distribution of real numbers that has the improper probability density function f x 1 source turing flatpos type flatpos l real the positive flat distribution with real valued parameter l is the improper distribution of real numbers that has the improper probability density function f x begin cases 0 amp text if x leq l 1 amp text otherwise end cases source turing binomiallogit type binomiallogit n logitp the binomial distribution with logit parameterization characterizes the number of successes in a sequence of independent trials it has two parameters n the number of trials and logitp the logit of the probability of success in an individual trial with the distribution p x k n choose k text logistic logitp k 1 text logistic logitp n k quad text for k 0 1 2 ldots n see also binomialsource warning quot missing docstring quot missing docstring for vecbinomiallogit check documenter s build log for details turing orderedlogistic type orderedlogistic c abstractvector the ordered logistic distribution with real valued parameter and cutpoints c has the probability mass function p x k begin cases 1 text logistic eta c 1 amp text if k 1 text logistic eta c k 1 text logistic eta c k amp text if 1 lt k lt k text logistic eta c k 1 amp text if k k end cases where k length c 1 source", "title": "API"},{"location": "/docs/library/bijectors/", "text": "indexbijectors bijectorbijectors corrbijectorbijectors couplingbijectors inversebijectors leakyrelubijectors namedcouplingbijectors namedtransformbijectors orderedbijector bijectors partitionmask dev docs library bijectors bijectors partitionmask union tuple t tuple int64 any where t bijectors partitionmaskbijectors permutebijectors rationalquadraticsplinebijectors reshapebijectors stackedbijectors transformbijectors veccholeskybijectorbijectors veccorrbijector bijectors inv link chol lkj dev docs library bijectors bijectors inv link chol lkj tuple abstractmatrix t where t bijectors link chol lkj dev docs library bijectors bijectors link chol lkj tuple abstractmatrix t where t bijectors bijector bijectors cholesky lower dev docs library bijectors bijectors cholesky lower tuple abstractmatrix t where t bijectors cholesky upper dev docs library bijectors bijectors cholesky upper tuple abstractmatrix t where t bijectors columnwise bijectors combine dev docs library bijectors bijectors combine tuple bijectors partitionmask any any any bijectors compute r dev docs library bijectors bijectors compute r tuple abstractvector var quot s46 quot where var quot s46 quot lt real any any bijectors couple dev docs library bijectors bijectors couple tuple coupling abstractvector t where t bijectors couplingbijectors elementwise bijectors find alpha dev docs library bijectors bijectors find alpha tuple real real real bijectors get u hat dev docs library bijectors bijectors get u hat tuple abstractvector var quot s35 quot where var quot s35 quot lt real abstractvector var quot s34 quot where var quot s34 quot lt real bijectors has constant bijectorbijectors isclosedformbijectors isinvertible bijectors logabsdetjac dev docs library bijectors bijectors logabsdetjac tuple any any bijectors logabsdetjac dev docs library bijectors bijectors logabsdetjac tuple any any bijectors logabsdetjacinv dev docs library bijectors bijectors logabsdetjacinv tuple any any bijectors ordered dev docs library bijectors bijectors ordered tuple distribution multivariate continuous bijectors output length dev docs library bijectors bijectors output length tuple any int64 bijectors output size dev docs library bijectors bijectors output size tuple any any bijectors partition dev docs library bijectors bijectors partition tuple bijectors partitionmask any bijectors transform dev docs library bijectors bijectors transform union tuple f tuple f any where f lt function bijectors transform dev docs library bijectors bijectors transform tuple any any bijectors transformed dev docs library bijectors bijectors transformed tuple distribution any bijectors triu1 to vec dev docs library bijectors bijectors triu1 to vec tuple abstractmatrix t where t bijectors triu mask dev docs library bijectors bijectors triu mask tuple abstractmatrix t where t int64 bijectors triu to vec dev docs library bijectors bijectors triu to vec tuple abstractmatrix t where t bijectors vec to triu dev docs library bijectors bijectors vec to triu tuple abstractvector t where t bijectors vec to triu1 dev docs library bijectors bijectors vec to triu1 tuple abstractvector t where t bijectors with logabsdet jacobian dev docs library bijectors bijectors with logabsdet jacobian tuple any any functions bijectors inv link chol lkj method inv link chol lkj y inverse link function for cholesky factor bijectors link chol lkj method function link chol lkj w link function for cholesky factor an alternative and maybe more efficient implementation was considered for i 2 k j i 1 k z i j w i j w i 1 j z i 1 j sqrt 1 z i 1 j 2 endbut this implementation will not work when w i 1 j 0 though it is a zero measure set unit matrix initialization will not work for equivalence following explanations is given by torfjelde for i j in the loop below we definez w 1 1 z and soz w 1 1 z w 1 z 1 1 z w 1 z w 1 1 z w w 1 z z w w w z 1 z which is the above implementation bijectors bijector method bijector d distribution returns the constrained to unconstrained bijector for distribution d bijectors cholesky lower method cholesky lower x return the lower triangular cholesky factor of x as a matrix rather than lowertriangular notethis is a thin wrapper around cholesky hermitian x l that returns a matrix rather than lowertriangular bijectors cholesky upper method cholesky upper x return the upper triangular cholesky factor of x as a matrix rather than uppertriangular notethis is a thin wrapper around cholesky hermitian x u that returns a matrix rather than uppertriangular bijectors columnwise method alias for base fix1 eachcolmaphcat f represents a function f which is applied to each column of an input bijectors combine method combine m partitionmask x 1 x 2 x 3 combines x 1 x 2 and x 3 into a single vector bijectors compute r method compute r y minus z0 abstractvector lt real plus hat compute the unique solution r to the equation y minus z0 2 r left 1 frac plus hat r right subject to r 0 and r since gt 0 and plus hat gt 0 the solution is unique and given by r sqrt plus hat 2 4 plus hat 2 where y minus z0 2 for details see appendix a 2 of the reference referencesd rezende s mohamed 2015 variational inference with normalizing flows arxiv 1505 05770 bijectors couple method returns the coupling law constructed from x bijectors coupling method returns the constructor of the coupling law bijectors elementwise method elementwise f alias for base fix1 broadcast f in the case where f composedfunction the result is base fix1 broadcast f outer base fix1 broadcast f inner rather than base fix1 broadcast f bijectors find alpha method find alpha wt y wt u hat b compute an approximate real valued solution to the equation wt y wt u hat tanh b the uniqueness of the solution is guaranteed since wt u hat 1 for details see appendix a 1 of the reference initial bracketfor all we have wt u hat wt y leq wt u hat tanh b wt y leq wt u hat wt y thus wt u hat wt y leq 0 leq wt u hat wt y which implies wt y wt u hat wt y wt u hat to avoid floating point issues if wt y wt u hat we use the more conservative interval wt y 2 wt u hat wt y 2 wt u hat as initial bracket at the cost of one additional iteration step referencesd rezende s mohamed 2015 variational inference with normalizing flows arxiv 1505 05770 bijectors get u hat method get u hat u abstractvector lt real w abstractvector lt real return a tuple of vector u that guarantees invertibility of the planar layer and scalar w u mathematical backgroundaccording to appendix a 1 vector u defined by u w u u log 1 exp w u 1 w u frac w w guarantees that the planar layer f z z u tanh w z b is invertible for all w u and b we can rewrite u as u u log 1 exp w u 1 frac w w additionally we obtain w u w u log 1 exp w u 1 log 1 exp w u 1 referencesd rezende s mohamed 2015 variational inference with normalizing flows arxiv 1505 05770 bijectors has constant bijector method has constant bijector dist type type returns true if the distribution type dist type has a constant bijector i e the return value of bijector does not depend on runtime information bijectors isclosedform method isclosedform b transform boolisclosedform b inverse lt transform boolreturns true or false depending on whether or not evaluation of b has a closed form implementation most transformations have closed form evaluations but there are cases where this is not the case for example the inverse evaluation of planarlayer requires an iterative procedure to evaluate bijectors isinvertible method isinvertible t return true if t is invertible and false otherwise bijectors logabsdetjac method logabsdetjac b x logjac compute log abs det j b x and store the result in logjac where j b x is the jacobian of b at x bijectors logabsdetjac method logabsdetjac b x return log abs det j b x where j b x is the jacobian of b at x bijectors logabsdetjacinv method logabsdetjacinv b y just an alias for logabsdetjac inverse b y bijectors ordered method ordered d distribution return a distribution whose support are ordered vectors i e vectors with increasingly ordered elements this transformation is currently only supported for otherwise unconstrained distributions bijectors output length method output length f len int returns the output length of f given the input length len bijectors output size method output size f sz returns the output size of f given the input size sz bijectors partition method partition m partitionmask x partitions x into 3 disjoint subvectors bijectors transform method transform b x y transform x using b storing the result in y if y is not provided x is used as the output bijectors transform method transform b x transform x using b treating x as a single input bijectors transformed method transformed d distribution transformed d distribution b bijector couples distribution d with the bijector b by returning a transformeddistribution if no bijector is provided i e transformed d is called then transformed d bijector d is returned bijectors triu1 to vec method triu1 to vec x abstractmatrix lt real extracts elements from upper triangle of x with offset 1 and returns them as a vector bijectors triu mask method triu mask x abstractmatrix k int return a mask for elements of x above the kth diagonal bijectors triu to vec method triu to vec x abstractmatrix lt real extracts elements from upper triangle of x and returns them as a vector bijectors vec to triu method vec to triu x abstractvector lt real constructs a matrix from a vector x by filling the upper triangle bijectors vec to triu1 method vec to triu1 x abstractvector lt real constructs a matrix from a vector x by filling the upper triangle with offset 1 bijectors with logabsdet jacobian method with logabsdet jacobian b x y logjac compute transform b x and logabsdetjac b x storing the result in y and logjac respetively if y is not provided then x will be used in its place defaults to calling with logabsdet jacobian b x and updating y and logjac with the result inversefunctions inverse method inverse t transform returns the inverse of transform t types bijectors bijector type abstract type of a bijector i e differentiable bijection with differentiable inverse bijectors corrbijector type corrbijector lt bijectora bijector implementation of stan s parametrization method for correlation matrix https mc stan org docs 2 23 reference manual correlation matrix transform section htmlbasically a unconstrained strictly upper triangular matrix y is transformed to a correlation matrix by following readable but not that efficient form k size y 1 z tanh y for j 1 k i 1 k if i gt j w i j 0 elseif 1 i j w i j 1 elseif 1 lt i j w i j prod sqrt 1 z 1 i 1 j 2 elseif 1 i lt j w i j z i j elseif 1 lt i lt j w i j z i j prod sqrt 1 z 1 i 1 j 2 endendit is easy to see that every column is a unit vector for example w3 w3 w 1 3 2 w 2 3 2 w 3 3 2 z 1 3 2 z 2 3 sqrt 1 z 1 3 2 2 sqrt 1 z 1 3 2 sqrt 1 z 2 3 2 2 z 1 3 2 z 2 3 2 1 z 1 3 2 1 z 1 3 2 1 z 2 3 2 z 1 3 2 z 2 3 2 z 2 3 2 z 1 3 2 1 z 1 3 2 z 2 3 2 z 1 3 2 z 2 3 2 1and diagonal elements are positive so w is a cholesky factor for a positive matrix x w wconsider block matrix representation for xx w1 w2 wn w1 w2 wn w1 w1 w1 w2 w1 wn w2 w1 w2 w2 w2 wn the diagonal elements are given by wk wk 1 thus x is a correlation matrix every step is invertible so this is a bijection bijector note the implementation doesn t follow their quot manageable expression quot directly because their equation seems wrong 7 30 2020 insteadly it follows definition above the quot manageable expression quot directly which is also described in above doc bijectors coupling type coupling f m f mask m implements a coupling layer as defined in 1 examples julia gt using bijectors shift coupling partitionmask coupling couplejulia gt m partitionmask 3 1 2 lt going to use x 2 to parameterize transform of x 1 julia gt cl coupling shift m lt will do y 1 1 x 1 1 x 2 2 julia gt x 1 2 3 julia gt cl x 3 element vector float64 3 0 2 0 3 0julia gt inverse cl cl x 3 element vector float64 1 0 2 0 3 0julia gt coupling cl get the bijector map gt b shiftjulia gt couple cl x get the bijector resulting from x shift 2 0 julia gt with logabsdet jacobian cl x 3 0 2 0 3 0 0 0 references 1 kobyzev i prince s amp brubaker m a normalizing flows introduction and ideas corr 2019 bijectors inverse type inverse b transform inverse b transform a transform representing the inverse transform of b bijectors leakyrelu type leakyrelu t t lt bijectordefines the invertible mappingx x if x 0 else xwhere gt 0 bijectors namedcoupling type namedcoupling target deps f lt abstractnamedtransformimplements a coupling layer for named bijectors see also couplingexamples julia gt using bijectors namedcoupling scalejulia gt b namedcoupling b a c a c gt scale a c julia gt x a 1 b 2 c 3 julia gt b x a 1 0 b 8 0 c 3 0 julia gt a x a b x a x c x b c x c a 1 0 b 8 0 c 3 0 bijectors namedtransform type namedtransform lt abstractnamedtransformwraps a namedtuple of key gt bijector pairs implementing evaluation inversion etc examples julia gt using bijectors namedtransform scalejulia gt b namedtransform a scale 2 0 b exp julia gt x a 1 b 0 c 42 julia gt b x a 2 0 b 1 0 c 42 0 julia gt a 2 x a b exp x b c x c a 2 0 b 1 0 c 42 0 bijectors orderedbijector type orderedbijector a bijector mapping ordered vectors in to unordered vectors in see alsostan s documentationnote that this transformation and its inverse are the opposite of in this reference bijectors partitionmask type partitionmask a a 1 a a 2 a a 3 a where a this is used to partition and recombine a vector into 3 disjoint quot subvectors quot implementspartition m partitionmask x partitions x into 3 disjoint quot subvectors quot combine m partitionmask x 1 x 2 x 3 combines 3 disjoint vectors into a single onenote that partitionmask is not a bijector it is indeed a bijection but does not follow the bijector interface its main use is in coupling where we want to partition the input into 3 parts one part to transform one part to map into the parameter space of the transform applied to the first part and the last part of the vector is not used for anything examples julia gt using bijectors partitionmask partition combinejulia gt m partitionmask 3 1 2 lt assumes input length 3partitionmask bool sparsearrays sparsematrixcsc bool int64 1 1 true 2 1 true 3 1 true julia gt partition into 3 parts the last part is inferred to be indices 3 from the fact that 1 and 2 does not make up all indices in 1 3 x1 x2 x3 partition m 1 2 3 1 0 2 0 3 0 julia gt recombines the partitions into a vector combine m x1 x2 x3 3 element array float64 1 1 0 2 0 3 0note that the underlying sparsematrix is using bool as the element type we can also specify this to be some other type using the sp type keyword julia gt m partitionmask float32 3 1 2 partitionmask float32 sparsearrays sparsematrixcsc float32 int64 1 1 1 0 2 1 1 0 3 1 1 0 bijectors partitionmask method partitionmask n int indices assumes you want to split the vector where indices refer to the parts of the vector you want to apply the bijector to bijectors permute type permute a lt bijectora bijector implementation of a permutation the permutation is performed using a matrix of type a there are a couple of different ways to construct permute permute 0 1 1 0 will map 1 2 gt 2 1 permute 2 1 will map 1 2 gt 2 1 permute 2 2 gt 1 1 gt 2 will map 1 2 gt 2 1 permute 2 1 2 gt 2 1 will map 1 2 gt 2 1 if this is not clear the examples might be of help examplesa simple example is permuting a vector of size 3 julia gt b1 permute 0 1 0 1 0 0 0 0 1 permute array int64 2 0 1 0 1 0 0 0 0 1 julia gt b2 permute 2 1 3 specify all elements at oncepermute sparsearrays sparsematrixcsc float64 int64 2 1 1 0 1 2 1 0 3 3 1 0 julia gt b3 permute 3 2 gt 1 1 gt 2 element wisepermute sparsearrays sparsematrixcsc float64 int64 2 1 1 0 1 2 1 0 3 3 1 0 julia gt b4 permute 3 1 2 gt 2 1 block wisepermute sparsearrays sparsematrixcsc float64 int64 2 1 1 0 1 2 1 0 3 3 1 0 julia gt b1 a b2 a b3 a b4 atruejulia gt b1 1 2 3 3 element array float64 1 2 0 1 0 3 0julia gt b2 1 2 3 3 element array float64 1 2 0 1 0 3 0julia gt b3 1 2 3 3 element array float64 1 2 0 1 0 3 0julia gt b4 1 2 3 3 element array float64 1 2 0 1 0 3 0julia gt inverse b1 permute linearalgebra transpose int64 array int64 2 0 1 0 1 0 0 0 0 1 julia gt inverse b1 b1 1 2 3 3 element array float64 1 1 0 2 0 3 0 bijectors rationalquadraticspline type rationalquadraticspline t lt bijectorimplementation of the rational quadratic spline flow 1 outside of the interval minimum widths maximum widths this mapping is given by the identity map inside the interval it s given by a monotonic spline i e monotonic polynomials connected at intermediate points with endpoints fixed so as to continuously transform into the identity map for the sake of efficiency there are separate implementations for 0 dimensional and 1 dimensional inputs notesthere are two constructors for rationalquadraticspline rationalquadraticspline widths heights derivatives it is assumed that widths heights and derivatives satisfy the constraints that makes this a valid bijector i e widths monotonically increasing and length widths k heights monotonically increasing and length heights k derivatives non negative and derivatives 1 derivatives end 1 rationalquadraticspline widths heights derivatives b other than than the lengths no assumptions are made on parameters therefore we will transform the parameters s t widths new b b where k length widths heights new b b where k length heights derivatives new 0 with derivatives new 1 derivates new end 1 where k 1 length derivatives examplesunivariate julia gt using stablerngs stablerng rng stablerng 42 for reproducibility julia gt using bijectors rationalquadraticsplinejulia gt k 3 b 2 julia gt monotonic spline on b b with k intermediate knots quot connection points quot b rationalquadraticspline randn rng k randn rng k randn rng k 1 b julia gt b 0 5 inside of b b transformed1 1943325397834206julia gt b 5 outside of b b not transformed5 0julia gt b rationalquadraticspline b widths b heights b derivatives julia gt b 0 5 inside of b b transformed1 1943325397834206julia gt d 2 k 3 b 2 julia gt b rationalquadraticspline randn rng d k randn rng d k randn rng d k 1 b julia gt b 1 1 2 element vector float64 1 5660106244288925 0 5384702734738573julia gt b 5 5 2 element vector float64 5 0 5 0julia gt b 1 5 2 element vector float64 1 5660106244288925 5 0references 1 durkan c bekasov a murray i amp papamakarios g neural spline flows corr arxiv 1906 04032 stat ml 2019 bijectors reshape type reshape in shape out shape a bijector that reshapes the input to the output shape example julia gt b reshape 2 3 3 2 reshape tuple int64 int64 tuple int64 int64 2 3 3 2 julia gt array transform b reshape 1 6 2 3 3 2 matrix int64 1 4 2 5 3 6 lt a id bijectors stacked href bijectors stacked gt lt a gt bijectors stacked amp mdash type juliastacked bs stacked bs ranges stack bs bijector a bijector which stacks bijectors together which can then be applied to a vector where bs i bijector is applied to x ranges i unitrange int argumentsbs can be either a tuple or an abstractarray of 0 and or 1 dimensional bijectorsif bs is a tuple implementations are type stable using generated functionsif bs is an abstractarray implementations are not type stable and use iterative methodsranges needs to be an iterable consisting of unitrange int length bs length ranges needs to be true examplesb1 logit 0 0 1 0 b2 identityb stack b1 b2 b 0 0 1 0 b1 0 0 1 0 gt true bijectors transform type abstract type for a transformation implementinga subtype of transform of should at least implement transform b x dev docs library bijectors bijectors transform union tuple f tuple f any where f lt function if the transform is also invertible required either of the following transform inverse lt mytransform x the transform for its inverse inversefunctions inverse b mytransform returns an existing transform logabsdetjac dev docs library bijectors bijectors logabsdetjac tuple any any computes the log abs det jacobian factor optional with logabsdet jacobian transform and logabsdetjac combined useful in cases where we can exploit shared computation in the two for the above methods there are mutating versions which can optionally be implemented with logabsdet jacobian dev docs library bijectors bijectors with logabsdet jacobian tuple any any logabsdetjac dev docs library bijectors bijectors logabsdetjac tuple any any with logabsdet jacobian dev docs library bijectors bijectors with logabsdet jacobian tuple any any bijectors veccholeskybijector type veccholeskybijector lt bijectora bijector to transform a cholesky factor of a correlation matrix to an unconstrained vector fieldsmode symbol controls the inverse tranformation if mode u returns a linearalgebra cholesky holding the uppertriangular factorif mode l returns a linearalgebra cholesky holding the lowertriangular factorreferencehttps mc stan org docs reference manual cholesky factors of correlation matrices 1see also veccorrbijectorexample julia gt using stablerngs rng stablerng 42 julia gt b bijectors veccholeskybijector u julia gt x rand rng lkjcholesky 3 1 u sample a correlation matrix cholesky float64 matrix float64 u factor 3 3 uppertriangular float64 matrix float64 1 0 0 937494 0 865891 0 348002 0 320442 0 384122julia gt y b x transform to unconstrained vector representation 3 element vector float64 0 8777149781928181 0 3638927608636788 0 29813769428942216julia gt x inv inverse b y julia gt x inv u x u round trip through b and its inverse true julia gt x inv l x l also works for the lower triangular factor true lt a id bijectors veccorrbijector href bijectors veccorrbijector gt lt a gt bijectors veccorrbijector amp mdash type juliaveccorrbijector lt bijectora bijector to transform a correlation matrix to an unconstrained vector referencehttps mc stan org docs reference manual correlation matrix transform htmlsee also corrbijector and veccholeskybijector example julia gt using stablerngs rng stablerng 42 julia gt b bijectors veccorrbijector julia gt x rand rng lkj 3 1 sample a correlation matrix 3 3 matrix float64 1 0 0 705273 0 348638 0 705273 1 0 0 0534538 0 348638 0 0534538 1 0julia gt y b x transform to unconstrained vector representation 3 element vector float64 0 8777149781928181 0 3638927608636788 0 29813769428942216julia gt inverse b y x round trip through b and its inverse true", "title": "Bijectors"}]} diff --git a/dev/sitemap.xml b/dev/sitemap.xml index f09ce127d..306d6d672 100644 --- a/dev/sitemap.xml +++ b/dev/sitemap.xml @@ -2,27 +2,27 @@ / - 2024-01-19 + 2024-01-20 daily /devdocs/using-turing/get-started/ - 2024-01-19 + 2024-01-20 daily /devdocs/for-developers// - 2024-01-19 + 2024-01-20 daily /devtutorials/ - 2024-01-19 + 2024-01-20 daily /devdocs/contributing/guide/ - 2024-01-19 + 2024-01-20 daily