Learn R Programming

JOUSBoost (version 2.1.0)

circle_data: Simulate data from the circle model.

Description

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) \le inner_r\), then \(p(y=1|x) = 1\), if \(r(x) \ge 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).

Usage

circle_data(n = 500, inner_r = 8, outer_r = 28)

Arguments

n

Number of points to simulate.

inner_r

Inner radius of annulus.

outer_r

Outer radius of annulus.

Value

Returns a list with the following components:

y

Vector of simulated response in c(-1,1).

X

An nx2 matrix of simulated predictors.

p

The true conditional probability \(p(y=1|x)\).

References

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.

Examples

Run this code
# NOT RUN {
# 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')
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab