splitDoE: Training/test data generator according to a given Design of...

Description Usage Arguments Value Comments Author(s) Examples

View source: R/lineqGPutils.R

Description

Split the data in training/test sets according to a given DoE.

Usage

1
2
3
4
5
6
7
8
splitDoE(
  x,
  y,
  DoE.idx = NULL,
  DoE.type = c("rand", "regs"),
  ratio = 0.3,
  seed = NULL
)

Arguments

x

a vector (or matrix) with the input locations.

y

a vector with the output observations.

DoE.idx

the numeric indices of the training data used in the design.

DoE.type

if is.null(DoE.idx), a character string corresponding to the type of DoE. Options: rand (random desings), regs (regular-spaced desings).

ratio

if is.null(DoE.idx), a number with the ratio nb_train/nb_total (by default, ratio = 0.3).

seed

an optional value corresponding to the seed for random methods.

Value

A list with the DoE: list(xdesign, ydesign, xtest, ytest).

Comments

This function is in progress. Other types of DoEs will be considered using the DiceDesign package.

Author(s)

A. F. Lopez-Lopera.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# generating the toy example
x <- seq(0, 1, length = 100)
y <- sin(4*pi*x)

# regular DoE
DoE <- splitDoE(x, y, DoE.type = "regs", ratio = 0.3)
plot(x,y)
points(DoE$xdesign, DoE$ydesign, col = "red", pch = 20)
points(DoE$xtest, DoE$ytest, col = "blue", pch = 20)
legend("topright", c("training data", "test data"),
       pch = rep(20, 2), col = c("red", "blue"))

# random DoE
DoE <- splitDoE(x, y, DoE.type = "rand", ratio = 0.3, seed = 1)
plot(x,y)
points(DoE$xdesign, DoE$ydesign, col = "red", pch = 20)
points(DoE$xtest, DoE$ytest, col = "blue", pch = 20)
legend("topright", c("training data", "test data"),
       pch = rep(20, 2), col = c("red", "blue"))

lineqGPR documentation built on Jan. 11, 2020, 9:23 a.m.