top of page
Search
Writer's pictureDR.GEEK

Sampling from a Single Variable

(6th-September-2020)


• To generate samples from a single discrete or real-valued variable, X, first totally order the values in the domain of X. For discrete variables, if there is no natural order, you can just create an arbitrary ordering. Given this ordering, the cumulative probability distribution is a function of x, defined by f(x)=P(X ≤ x).

• Figure 6.9: A cumulative probability distribution

• To generate a random sample for X, select a random number y in the range [0,1]. We select y from a uniform distribution to ensure that each number between 0 and 1 has the same chance of being chosen. Let v be the value of X that maps to y in the cumulative probability distribution. That is, v is the element of dom(X) such that f(v)=y or, equivalently, v=f-1(y). Then, X=v is a random sample of X, chosen according to the distribution of X.


Forward Sampling in Belief Networks

• Forward sampling is a way to generate a sample of every variable of a belief network so that each sample is generated in proportion to it probability. Suppose X1,...,Xn is a total ordering of the variables so that the parents of a variable come before the variable in the total order. Forward sampling draws a sample of all of the variables by drawing a sample of each variable X1,...,Xn in order. First, it samples X1 using the aforementioned method. For each of the other variables, due to the total ordering of variables, when it comes time to sample Xi, it already has values for all of Xi's parents. It now samples a value for Xi from the distribution of Xi given the values already assigned to the parents of Xi. Repeating this for every variable generates a sample containing values for all of the variables. The probability of selecting a particular assignment to all of the variables will be the probability of the assignment.



4 views0 comments

Recent Posts

See All

Comments


bottom of page