You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<spanid="cb3-7"><ahref="#cb3-7" aria-hidden="true" tabindex="-1"></a><spanclass="fu">sample</span>(m2, <spanclass="fu">NUTS</span>(), <spanclass="fl">100</span>) <spanclass="co"># This doesn't work!</span></span></code></pre></div><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></div>
783
783
<p>The key insight is that <code>filldist</code> creates a single distribution (not N independent distributions), which is why you cannot condition on individual elements. The distinction is not just about what appears on the LHS of <code>~</code>, but whether you’re dealing with separate distributions (<code>.~</code> with univariate) or a single distribution over multiple values (<code>~</code> with multivariate or <code>filldist</code>).</p>
784
-
<p>To understand more about how Turing determines whether a variable is treated as random or observed, see: - <ahref="../core-functionality">Core Functionality</a> - basic explanation of the <code>~</code> notation and conditioning</p>
784
+
<p>To understand more about how Turing determines whether a variable is treated as random or observed, see:</p>
785
+
<ul>
786
+
<li><ahref="../core-functionality">Core Functionality</a> - basic explanation of the <code>~</code> notation and conditioning</li>
<p>Turing.jl fully supports sampling multiple chains in parallel: - <strong>Multithreaded sampling</strong>: Use <code>MCMCThreads()</code> to run one chain per thread - <strong>Distributed sampling</strong>: Use <code>MCMCDistributed()</code> for distributed computing</p>
794
+
<p>Turing.jl fully supports sampling multiple chains in parallel:</p>
795
+
<ul>
796
+
<li><strong>Multithreaded sampling</strong>: Use <code>MCMCThreads()</code> to run one chain per thread</li>
797
+
<li><strong>Distributed sampling</strong>: Use <code>MCMCDistributed()</code> for distributed computing</li>
798
+
</ul>
792
799
<p>See the <ahref="../core-functionality/#sampling-multiple-chains">Core Functionality guide</a> for examples.</p>
<spanid="cb4-7"><ahref="#cb4-7" aria-hidden="true" tabindex="-1"></a><spanclass="kw">end</span></span></code></pre></div><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></div>
804
-
<p><strong>Important limitations:</strong> - <strong>Observe statements</strong>: Generally safe to use in threaded loops - <strong>Assume statements</strong> (sampling statements): Often crash unpredictably or produce incorrect results - <strong>AD backend compatibility</strong>: Many AD backends don’t support threading. Check the <ahref="https://turinglang.org/ADTests/">multithreaded column in ADTests</a> for compatibility</p>
811
+
<p><strong>Important limitations:</strong></p>
812
+
<ul>
813
+
<li><strong>Observe statements</strong>: Generally safe to use in threaded loops</li>
814
+
<li><strong>Assume statements</strong> (sampling statements): Often crash unpredictably or produce incorrect results</li>
815
+
<li><strong>AD backend compatibility</strong>: Many AD backends don’t support threading. Check the <ahref="https://turinglang.org/ADTests/">multithreaded column in ADTests</a> for compatibility</li>
816
+
</ul>
805
817
<p>For safe parallelism within models, consider vectorized operations instead of explicit threading.</p>
<h2class="anchored" data-anchor-id="how-do-i-check-the-type-stability-of-my-turing-model">How do I check the type stability of my Turing model?</h2>
810
-
<p>Type stability is crucial for performance. Check out: - <ahref="../usage/performance-tips">Performance Tips</a> - includes specific advice on type stability - Use <code>DynamicPPL.DebugUtils.model_warntype</code> to check type stability of your model</p>
822
+
<p>Type stability is crucial for performance. Check out:</p>
823
+
<ul>
824
+
<li><ahref="../usage/performance-tips">Performance Tips</a> - includes specific advice on type stability</li>
825
+
<li>Use <code>DynamicPPL.DebugUtils.model_warntype</code> to check type stability of your model</li>
<h2class="anchored" data-anchor-id="how-do-i-debug-my-turing-model">How do I debug my Turing model?</h2>
814
-
<p>For debugging both statistical and syntactical issues: - <ahref="../usage/troubleshooting">Troubleshooting Guide</a> - common errors and their solutions - For more advanced debugging, DynamicPPL provides <ahref="https://turinglang.org/DynamicPPL.jl/stable/api/#Debugging-Utilities">the <code>DynamicPPL.DebugUtils</code> module</a> for inspecting model internals</p>
830
+
<p>For debugging both statistical and syntactical issues:</p>
831
+
<ul>
832
+
<li><ahref="../usage/troubleshooting">Troubleshooting Guide</a> - common errors and their solutions</li>
833
+
<li>For more advanced debugging, DynamicPPL provides <ahref="https://turinglang.org/DynamicPPL.jl/stable/api/#Debugging-Utilities">the <code>DynamicPPL.DebugUtils</code> module</a> for inspecting model internals</li>
<h2class="anchored" data-anchor-id="what-are-the-main-differences-between-turing-bugs-and-stan-syntax">What are the main differences between Turing, BUGS, and Stan syntax?</h2>
<h2class="anchored" data-anchor-id="which-automatic-differentiation-backend-should-i-use">Which automatic differentiation backend should I use?</h2>
848
-
<p>The choice of AD backend can significantly impact performance. See: - <ahref="../usage/automatic-differentiation">Automatic Differentiation Guide</a> - comprehensive comparison of ForwardDiff, Mooncake, ReverseDiff, and other backends - <ahref="../usage/performance-tips#choose-your-ad-backend">Performance Tips</a> - quick guide on choosing backends - <ahref="https://turinglang.org/ADTests/">AD Backend Benchmarks</a> - performance comparisons across various models</p>
868
+
<p>The choice of AD backend can significantly impact performance. See:</p>
869
+
<ul>
870
+
<li><ahref="../usage/automatic-differentiation">Automatic Differentiation Guide</a> - comprehensive comparison of ForwardDiff, Mooncake, ReverseDiff, and other backends</li>
871
+
<li><ahref="../usage/performance-tips#choose-your-ad-backend">Performance Tips</a> - quick guide on choosing backends</li>
872
+
<li><ahref="https://turinglang.org/ADTests/">AD Backend Benchmarks</a> - performance comparisons across various models</li>
<h2class="anchored" data-anchor-id="i-changed-one-line-of-my-model-and-now-its-so-much-slower-why">I changed one line of my model and now it’s so much slower; why?</h2>
852
-
<p>Small changes can have big performance impacts. Common culprits include: - Type instability introduced by the change - Switching from vectorized to scalar operations (or vice versa) - Inadvertently causing AD backend incompatibilities - Breaking assumptions that allowed compiler optimizations</p>
877
+
<p>Small changes can have big performance impacts. Common culprits include:</p>
878
+
<ul>
879
+
<li>Type instability introduced by the change</li>
880
+
<li>Switching from vectorized to scalar operations (or vice versa)</li>
881
+
<li>Inadvertently causing AD backend incompatibilities</li>
882
+
<li>Breaking assumptions that allowed compiler optimizations</li>
883
+
</ul>
853
884
<p>See our <ahref="../usage/performance-tips">Performance Tips</a> and <ahref="../usage/troubleshooting">Troubleshooting Guide</a> for debugging performance regressions.</p>
0 commit comments