Description Usage Arguments Value Author(s) See Also Examples
For a given information channel and input, draw random samples of the conditional probability distribution over the channel output.
1 |
channel |
An information channel, as returned by |
n |
The number of random samples to generate. |
index |
The channel input, specified as its index in the source alphabet. |
show.progress |
Logical value. Show a progress bar during sampling? |
A list with two elements:
x |
A matrix with n rows containing the channel input. |
y |
A matrix containing random samples of the channel output for the given index. |
Chris R. Sims
BlahutAlgorithm
, FindOptimalChannel
, FindRate
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Define a discretized Gaussian information source
x <- seq(from = -10, to = 10, length.out = 100)
Px <- dnorm(x, mean = 0, sd = 3)
Px <- Px / sum(Px) # Ensure that probability sums to 1
y <- x # The destination alphabet is the same as the source
# Define a quadratic cost function
cost.function <- function(x, y) {
(y - x)^2
}
# Slope of the rate-distortion curve
s <- -1
# Compute the rate-distortion value at the given point s
channel <- BlahutAlgorithm(x, Px, y, cost.function, s)
# Draw random samples from the output of this channel, for a given input
samples <- Sample(channel, 1000, 50, show.progress = TRUE)
# Plot a histogram of the output
hist(samples$y)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.