E-GAN's own three named "mutation" objectives (Wang et al. 2019, "Evolutionary
Generative Adversarial Networks") plus its sample-quality/diversity fitness metric. In E-GAN, "mutation" means training a copy of a generator against a different loss function, not perturbing its weights directly – a structurally different kind of mutation than this campaign's own Phase 3 NEAT/ES operators, which do perturb weights.
More...
#include <cmath>
#include <limits>
#include <stdexcept>
#include <vector>
#include "pulsatrix/bce_with_logits_loss.hpp"
#include "pulsatrix/module.hpp"
#include "pulsatrix/mse_loss.hpp"
#include "pulsatrix/tensor.hpp"
Go to the source code of this file.
|
| class | pulsatrix::MutationLoss |
| | Computes one of E-GAN's three named mutation objectives against a discriminator's own raw logit output, and its gradient w.r.t. those logits. Every objective trains the generator to make the discriminator's output move toward the "real" (1) class – they differ only in how that pressure is shaped (saturating vs. non-saturating vs. quadratic). More...
|
| |
|
| float | pulsatrix::QualityFitness (const Tensor &logits) |
| | E-GAN's own quality fitness Fq: mean sigmoid(D(fake)) over the batch – how convincingly "real" the discriminator currently rates these samples. Higher is better (the discriminator being fooled more).
|
| |
| float | pulsatrix::DiversityFitness (Module &discriminator, const Tensor &fake, DeviceBackend *backend) |
| | E-GAN's own diversity fitness Fd = -log(||grad||): the negative log of the L2 norm of the discriminator's own parameter gradient from its fake-recognition loss term (BCEWithLogitsLoss(D(fake), 0)), evaluated on fake. A smaller discriminator gradient here means the discriminator is already close to a local optimum against these particular samples – the paper's own signal that this offspring is contributing mode coverage the discriminator can't easily exploit further (discourages mode collapse).
|
| |
| float | pulsatrix::CombinedFitness (float quality, float diversity, float gamma=0.05f) |
| | Combined E-GAN fitness: Fq + gamma*Fd (Wang et al. 2019's own weighted combination). gamma's default (0.05) is this mission's own reasonable working value, not a literal reproduction of the paper's own tuned constant (never stated precisely enough there to reproduce exactly) – a deliberate, documented choice, not an assumed one.
|
| |
| template<typename OptimizerT > |
| float | pulsatrix::RunMutationStep (Module &offspring, Module &discriminator, const Tensor &noise, MutationObjective objective, OptimizerT &g_optimizer, DeviceBackend *backend, float gamma=0.05f) |
| | Runs one E-GAN mutation training step: trains offspring (an already-independent Module instance – typically initialized as a copy of some parent's current weights, which this function does not itself construct or assume anything about) for one step against discriminator using the given objective, then scores the mutated result via CombinedFitness on offspring's own post-mutation samples.
|
| |
E-GAN's own three named "mutation" objectives (Wang et al. 2019, "Evolutionary
Generative Adversarial Networks") plus its sample-quality/diversity fitness metric. In E-GAN, "mutation" means training a copy of a generator against a different loss function, not perturbing its weights directly – a structurally different kind of mutation than this campaign's own Phase 3 NEAT/ES operators, which do perturb weights.
- Note
- Reuses this codebase's own already-shipped, tested loss primitives (BCEWithLogitsLoss, MSELoss) rather than reimplementing softplus/MSE math by hand:
- Heuristic (HG, Goodfellow's non-saturating form): BCEWithLogitsLoss(D(fake), 1) – identical to gan_integration_test.cpp's own ToyGAN::generator_step objective.
- Least-squares (LS, Mao et al. 2017's LSGAN, adapted onto a logit-output discriminator exactly as E-GAN's own paper does): MSELoss(D(fake), 1).
- Minimax (MM, the original saturating GAN objective, Goodfellow et al. 2014):
log(1 - sigmoid(x)) – algebraically exactly -BCEWithLogitsLoss(x, 0) (BCEWithLogitsLoss(x, 0) = softplus(x) = -log(1-sigmoid(x))), computed as the negation of BCEWithLogitsLoss's own numerically-stable value/gradient rather than a separate hand-rolled softplus implementation.