Skip to contents

Fits a small leaky-ReLU MLP generator to an (n, 2) matrix of standardised coordinates and returns a fitted object that can sample() synthetic points. Mirrors the API of the JAX SpatialGAN class, but the fit is native base R: at most 50 seeded random-search steps of size lr on the generator weights, each kept only when it lowers the minibatch squared error (no adversarial discriminator training, no torch / JAX).

Usage

morie_fairness_spatial_gan(
  points,
  steps = 1500L,
  batch_size = 128L,
  latent_dim = 16L,
  hidden = 64L,
  lr = 0.002,
  seed = 0L
)

Arguments

points

Numeric matrix or data.frame with two columns (x, y).

steps

Integer training iterations requested (the native random-search fit runs at most 50).

batch_size

Integer minibatch size.

latent_dim

Generator noise dimension.

hidden

Hidden-layer width.

lr

Learning rate.

seed

Reproducibility seed.

Value

A morie_fairness_result with the fitted parameters in $gp, standardisation in $mean/$std, and a $sample(n, seed) closure; $backend is "native".

Examples

set.seed(1)
pts <- matrix(rnorm(60), ncol = 2L)
r <- morie_fairness_spatial_gan(pts, steps = 5L, batch_size = 8L,
  latent_dim = 4L, hidden = 8L, seed = 1L)
r$backend
#> [1] "native"