powered by
Generates either:
Structured (x, y) scatter data (linear, sine, circle, etc.), or
A matrix of scaled orthogonal polynomial features.
data_gen(type = "all", n = 500, degree = NULL, seed = NULL)
If type = "polynomial", returns a matrix (n x degree).
type = "polynomial"
n
degree
Otherwise a tibble with columns:
x: Numeric vector of x-values
x
y: Numeric vector of y-values
y
structure: Character name of the structure type
structure
Character string. Options:
"polynomial" for orthogonal polynomial features
"polynomial"
"linear", "sine", "circle", "cluster", "snake", "outliers", "sparse", "clumpy", "skewed", "striated", "concave", "monotonic", "doughnut", or "all" to generate all scatter structures.
"linear"
"sine"
"circle"
"cluster"
"snake"
"outliers"
"sparse"
"clumpy"
"skewed"
"striated"
"concave"
"monotonic"
"doughnut"
"all"
Integer. Number of samples to generate. Default is 500.
Integer. Degree of polynomial features (only for type = "polynomial").
Optional integer. Sets random seed for reproducibility.
data_gen("linear", n = 200) data_gen("polynomial", degree = 4, n = 200) data_gen("all", n = 200)
Run the code above in your browser using DataLab