Description Usage Arguments Value References Examples
Simulate draws from a bernoulli distribution over c(-1,1)
. First, the
predictors x are drawn i.i.d. uniformly over the square in the two dimensional
plane centered at the origin with side length 2*outer_r
, and then the
response is drawn according to p(y=1|x), which depends
on r(x), the euclidean norm of x. If
r(x) ≤ inner_r, then p(y=1|x) = 1, if r(x) ≥ outer_r
then p(y=1|x) = 1, and p(y=1|x) = (outer_r - r(x))/(outer_r - inner_r)
when inner_r <= r(x) <= outer_r. See Mease (2008).
1 | circle_data(n = 500, inner_r = 8, outer_r = 28)
|
n |
Number of points to simulate. |
inner_r |
Inner radius of annulus. |
outer_r |
Outer radius of annulus. |
Returns a list with the following components:
y |
Vector of simulated response in |
X |
An |
p |
The true conditional probability p(y=1|x). |
Mease, D., Wyner, A. and Buha, A. (2007). Costweighted boosting with jittering and over/under-sampling: JOUS-boost. J. Machine Learning Research 8 409-439.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Generate data from the circle model
set.seed(111)
dat = circle_data(n = 500, inner_r = 1, outer_r = 5)
## Not run:
# Visualization of conditional probability p(y=1|x)
inner_r = 0.5
outer_r = 1.5
x = seq(-outer_r, outer_r, by=0.02)
radius = sqrt(outer(x^2, x^2, "+"))
prob = ifelse(radius >= outer_r, 0, ifelse(radius <= inner_r, 1,
(outer_r-radius)/(outer_r-inner_r)))
image(x, x, prob, main='Probability Density: Circle Example')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.