synth_multimodal: Create "Multimodal" Synthetic Data

View source: R/synth_multimodal.R

synth_multimodalR Documentation

Create "Multimodal" Synthetic Data

Description

Create "Multimodal" Synthetic Data using squares and arctangents

Usage

synth_multimodal(
  n.cases = 10000,
  init.fn = "runifmat",
  init.fn.params = list(min = -10, max = 10),
  n.groups = 4,
  n.feat.per.group = round(seq(10, 300, length.out = n.groups)),
  contrib.p = 0.33,
  linear.p = 0.66,
  square.p = 0.1,
  atan.p = 0.1,
  pair.multiply.p = 0.05,
  pair.square.p = 0.05,
  pair.atan.p = 0.05,
  verbose = TRUE,
  seed = NULL,
  filename = NULL
)

Arguments

n.cases

Integer: Number of cases to create. Default = 10000

init.fn

Character: "runifmat" or "rnormmat". Use the respective functions to generate features as random uniform and random normal variables, respectively. Default = "runifmat"

init.fn.params

Named list with arguments "min", "max" for "runifmat" and "mean", "sd" for "rnormmat". Default = list(min = -10, max = 10)

n.groups

Integer: Number of feature groups / modalities to create. Default = 4

n.feat.per.group

Integer, vector, length n.groups: Number of features per group to create. Default = c(50, 100, 200, 300)

contrib.p

Float (0, 1]: Ratio of features contributing to outcome per group. Default = .33, i.e. a third of the features in each group will be used to produce the outcome y

linear.p

Float [0, 1]: Ratio of contributing features to be included linearly. Default = .1, i.e. .1 of .33 of features in each group will be included

square.p

Float [0, 1]: Ratio of contributing features to be squared. Default = .1, i.e. .1 of .33 of features in each group will be squared

atan.p

Float [0, 1]: Ratio of contributing features whose atan will be used. These will be selected from the features that were NOT sampled for squaring. Default = .1, i.e. .1 of .33 of features in each group will be transformed using atan, but given these features were not already picked to be squared (see square.p)

pair.multiply.p

Float [0, 1] Ratio of features will be divided into pairs and multiplied. Default = .05

pair.square.p

Float [0, 1] Ratio of features which will be divided into pairs, multiplied and squared.

pair.atan.p

Float [0, 1] Ratio of features which will be divided into pairs, multiplied and transformed using atan.

verbose

Logical: If TRUE, print messages to console.

seed

Integer: If set, pass to set.seed for reproducibility

filename

Character: Path to file to save output.

Details

There are no checks yet for compatibility among inputs and certain combinations may not work.

Value

List with elements x, y, index.square, index.atan, index.pair.square

Author(s)

E.D. Gennatas

Examples

xmm <- synth_multimodal(
  n.cases = 10000,
  init.fn = "runifmat",
  init.fn.params = list(min = -10, max = 10),
  n.groups = 5,
  n.feat.per.group = c(20, 50, 100, 200, 300),
  contrib.p = .33,
  linear.p = .66,
  square.p = .1,
  atan.p = .1,
  pair.multiply.p = .1,
  pair.square.p = .1,
  pair.atan.p = .1,
  seed = 2019
)

egenn/rtemis documentation built on Dec. 17, 2024, 6:16 p.m.