Learn R Programming

stagedtrees (version 2.3.0)

generate_linear_dataset: Generate a random binary dataset for classification

Description

Randomly generate a simple classification problem.

Usage

generate_linear_dataset(
  p,
  n,
  eps = 1.2,
  gamma = runif(1, min = -p, max = p),
  alpha = runif(p, min = -p, max = p)
)

Value

A data.frame with n independent random variables and one class variable C computed as sign(sum(x * alpha) + runif(1, -eps, eps) + gamma).

Arguments

p

number of variables.

n

number of observations.

eps

noise.

gamma

numeric.

alpha

numeric vector of length n.

Examples

Run this code
DD <- generate_linear_dataset(p = 5, n = 1000)

Run the code above in your browser using DataLab