gnn (version 0.0-2)

GMMN_model: Generative Moment Matching Network

Description

Setup of a generative moment matching network (GMMN) model.

Usage

GMMN_model(dim, activation = c(rep("relu", length(dim) - 2), "sigmoid"),
           batch.norm = FALSE, dropout.rate = 0, nGPU = 0, ...)

Arguments

dim

numeric vector of length at least two, giving the dimensions of the input layer, the hidden layer(s) (if any) and the output layer (in this order).

activation

character vector of length length(dim) - 1 specifying the activation functions for all hidden layers and the output layer (in this order); note that the input layer does not have an activation function.

batch.norm

logical indicating whether batch normalization layers are to be added after each hidden layer.

dropout.rate

numeric value in [0,1] specifying the fraction of input to be dropped; see the rate parameter of layer_dropout(). Note that only if positive, dropout layers are added after each hidden layer.

nGPU

non-negative integer specifying the number of GPUs available if the GPU version of TensorFlow is installed. If positive, a (special) multiple GPU model for data parallelism is instantiated. Note that for multi-layer perceptrons on a few GPUs, this model does not yet yield any scale-up computational factor (in fact, currently very slightly negative scale-ups are likely due to overhead costs).

additional arguments passed to loss().

Value

GMMN_model() returns a list with components

model:

GMMN model (a keras object inheriting from the classes "keras.engine.training.Model", "keras.engine.network.Network", "keras.engine.base_layer.Layer" and "python.builtin.object").

type:

character string indicating the type of model ("GMMN").

dim:

see above.

activation:

see above.

batch.norm:

see above.

dropout.rate:

see above.

dim.train:

dimension of the training data (NA unless trained).

batch.size:

batch size (NA unless trained).

nepoch:

number of epochs (NA unless trained).

References

Li, Y., Swersky, K. and Zemel, R. (2015). Generative moment matching networks. Proceedings of Machine Learning Research, 37 (International Conference on Maching Learning), 1718--1727. See http://proceedings.mlr.press/v37/li15.pdf (2019-08-24)

Dziugaite, G. K., Roy, D. M. and Ghahramani, Z. (2015). Training generative neural networks via maximum mean discrepancy optimization. AUAI Press, 258--267. See http://www.auai.org/uai2015/proceedings/papers/230.pdf (2019-08-24)

See Also

VAE_model()

Examples

Run this code
# NOT RUN {
 # to avoid win-builder error "Error: Installation of TensorFlow not found"
## Example model with a 5d input, 300d hidden and 4d output layer
str(GMMN_model(c(5, 300, 4)))
# }

Run the code above in your browser using DataCamp Workspace