# Memoization in mcmc

**URL:** https://discourse.julialang.org/t/memoization-in-mcmc/109694
**Category:** Machine Learning
**Tags:** question, package, turing, rxinfer, mcmc
**Created:** [February 4, 2024, 9:13am UTC](https://discourse.julialang.org/t/memoization-in-mcmc/109694 "2024-02-04T09:13:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![swsw](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@swsw](https://discourse.julialang.org/u/swsw)
#### Post date: [February 4, 2024, 9:13am UTC](https://discourse.julialang.org/t/memoization-in-mcmc/109694/1 "2024-02-04T09:13:04Z")

</div>

Hi there,

I wondered if how Turing or RxInfer deals w/ the following situation.

For example, I have 10 parameters x1,…x10, the likelihood function is as follows.

> x1^2 + … + x10^2

Apparently, when updating x1, the other parts of the likelihood function

> x2^2+…+x10^2

need not be re-calculated. I wondered if Turing will automatically reuse previously calculated result or does it recalculate the whole likelihood updating each of the parameters. Thanks in advance!
