Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
cs-677sp2010:slice-sampling [2014/12/09 09:52]
ryancha created
cs-677sp2010:slice-sampling [2014/12/11 16:49] (current)
ryancha
Line 4: Line 4:
 Suppose you want to sample some random variable ''​X''​ with distribution f(x). Suppose that the following is the graph of f(x). The height of f(x) corresponds to the likelihood at that point. Suppose you want to sample some random variable ''​X''​ with distribution f(x). Suppose that the following is the graph of f(x). The height of f(x) corresponds to the likelihood at that point.
  
-[[File:​fx_dist.png|350px|alt=alt text|]]+[[media:cs-677sp10:​350px-fx_dist.png|350px]]
  
 If you were to uniformly sample ''​X'',​ each value would have the same likelihood of being sampled, and your distribution would be of the form f(x)=y for some ''​y''​ value instead of some non-uniform function f(x). Instead of the original black line, your new distribution would look more like the blue line. If you were to uniformly sample ''​X'',​ each value would have the same likelihood of being sampled, and your distribution would be of the form f(x)=y for some ''​y''​ value instead of some non-uniform function f(x). Instead of the original black line, your new distribution would look more like the blue line.
  
-[[File:​uniform_dist.png|350px|alt=alt text|]]+[[media:cs-677sp10:​350px-uniform_dist.png|350px]]
  
 In order to sample ''​X''​ in a manner which will retain the distribution f(x), some sampling technique must be used which takes into account the varied likelihoods for each range of f(x). In order to sample ''​X''​ in a manner which will retain the distribution f(x), some sampling technique must be used which takes into account the varied likelihoods for each range of f(x).
Line 24: Line 24:
  
 ==Univariate Case== ==Univariate Case==
-[[File:​x_y.png|thumb|350px|alt=alt text|For ​a given sample x, a value for y is chosen from [0, f(x)], which defines a "​slice"​ of the distribution (shown by the solid horizontal line). In this case, there are two slices separated by an area outside the range of the distribution.]]+[[media:cs-677sp10:​350px-x_y.png|thumb|350pxFor ​a given sample x, a value for y is chosen from [0, f(x)], which defines a "​slice"​ of the distribution (shown by the solid horizontal line). In this case, there are two slices separated by an area outside the range of the distribution.]]
 To sample a random variable ''​X''​ with density f(x) we introduce an auxiliary variable ''​Y''​ and iterate as follows: ​ To sample a random variable ''​X''​ with density f(x) we introduce an auxiliary variable ''​Y''​ and iterate as follows: ​
  
Line 39: Line 39:
 *A candidate sample is selected uniformly from within this region. If the candidate sample lies inside of the slice, then it is accepted as the new sample. If it lies outside of the slice, the candidate point becomes the new boundary for the region. A new candidate sample is taken uniformly. The process repeats until the candidate sample is within the slice. (See diagram for a visual example). *A candidate sample is selected uniformly from within this region. If the candidate sample lies inside of the slice, then it is accepted as the new sample. If it lies outside of the slice, the candidate point becomes the new boundary for the region. A new candidate sample is taken uniformly. The process repeats until the candidate sample is within the slice. (See diagram for a visual example).
  
-[[Image:slice.png|thumb|center|500px|alt=alt text|Finding a sample given a set of slices (the slices are represented here as blue lines and correspond to the solid line slices in the previous graph of f(x) ). a) A width parameter ''​w''​ is set. b) A region of width ''​w''​ is identified around a given point $x_0$. c) The region is expanded by ''​w''​ until both endpoints are outside of the considered slice. d) $x_1$ is selected uniformly from the region. e) Since $x_1$ lies outside the considered slice, the region'​s left bound is adjusted to $x_1$. f) Another uniform sample $x$ is taken and accepted as the sample since it lies within the considered slice.]]+[[media:cs-677sp10:​500px-slice.png]] 
 +Finding a sample given a set of slices (the slices are represented here as blue lines and correspond to the solid line slices in the previous graph of f(x) ). a) A width parameter ''​w''​ is set. b) A region of width ''​w''​ is identified around a given point $x_0$. c) The region is expanded by ''​w''​ until both endpoints are outside of the considered slice. d) $x_1$ is selected uniformly from the region. e) Since $x_1$ lies outside the considered slice, the region'​s left bound is adjusted to $x_1$. f) Another uniform sample $x$ is taken and accepted as the sample since it lies within the considered slice.
  
 ==Multivariate Methods== ==Multivariate Methods==
Line 55: Line 56:
 In this graphical representation of reflective sampling, the shape indicates the bounds of a sampling slice. The dots indicate start and stopping points of a sampling walk. When the samples hit the bounds of the slice, the direction of sampling is "​reflected"​ back into the slice. In this graphical representation of reflective sampling, the shape indicates the bounds of a sampling slice. The dots indicate start and stopping points of a sampling walk. When the samples hit the bounds of the slice, the direction of sampling is "​reflected"​ back into the slice.
  
-[[File:​reflection_sampling.png|350px|alt=alt text]]+[[media:cs-677sp10:​350px-reflection_sampling.png|350px|alt=alt text]]
  
 ==Example== ==Example==
cs-677sp2010/slice-sampling.1418143954.txt.gz · Last modified: 2014/12/09 09:52 by ryancha
Back to top
CC Attribution-Share Alike 4.0 International
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0