GenerativeAdversarialNetwork uses two neural networks to generate new contents from noise.
The Generator and Discriminator models must be created separately. Then use setGeneratorModel() and setDiscriminatorModel() to put it inside the GenerativeAdversarialNetwork model.
Generator and Discriminator models must be a part of NeuralNetwork model. If you decide to use linear regression or logistic regression, then it must be constructed using NeuralNetwork model.
Ensure the output layer of the Discriminator model has only one neuron and its activation function set to “Sigmoid”. It is the default setting for all Discriminator models in research papers.
The number of neurons at the Generator’s output layer must be equal to the number of neurons at the Discriminator’s input layer.
It is recommended that the learning rate for the Generator is higher than the Discriminator.
Create new model object. If any of the arguments are nil, default argument values for that argument will be used.
GenerativeAdversarialNetwork.new(maximumNumberOfIterations: number): ModelObject
Set model’s parameters. When any of the arguments are nil, previous argument values for that argument will be used.
GenerativeAdversarialNetwork:setParameters(maximumNumberOfIterations: number)
Sets the Generator into the model.
GenerativeAdversarialNetwork:setGeneratorModel(GeneratorModel: Model)
Sets the Discriminator into the model.
GenerativeAdversarialNetwork:setDiscriminatorModel(DiscriminatorModel: Model)
Gets the Generator from the model.
GenerativeAdversarialNetwork:getGeneratorModel(): Model
Gets the Discriminator from the model.
GenerativeAdversarialNetwork:getDiscriminatorModel(): Model
Trains the model.
GenerativeAdversarialNetwork:train(realFeatureMatrix: matrix, noiseFeatureMatrix: matrix)
realFeatureMatrix: The matrix containing the features of the real contents. The number of columns must be equal to number of neurons at the output layer of the Generator.
noiseFeatureMatrix: The matrix containing the noise in order to generate fake contents. The number of columns must be equal to number of neurons at the input layer of the Generator.
Generates the output from Discriminator.
GenerativeAdversarialNetwork:evaluate(featureMatrix: matrix): matrix
Generates the output from Generator.
GenerativeAdversarialNetwork:generate(noiseFeatureMatrix: matrix): matrix