Join us at TensorFlow World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

nsl.configs.VirtualAdvConfig

View source on GitHub

Class VirtualAdvConfig

VirtualAdvConfig contains configs for virtual adversarial training.

Attributes:

  • adv_neighbor_config: an AdvNeighborConfig object for generating virtual adversarial examples. Default set to AdvNeighborConfig.
  • distance_config: a DistanceConfig object for calculating virtual adversarial loss. Default set to DistanceConfig.
  • num_approx_steps: number of steps used to approximate the calculation of Hessian matrix required for creating virtual adversarial examples. Default set to 1.
  • approx_difference: the finite difference to approximate the calculation of Hessian matrix required for creating virtual adversarial examples. (The xi in Equation 12 in the paper: https://arxiv.org/pdf/1704.03976.pdf) Default set to 1e-6.

__init__

__init__(
    adv_neighbor_config=attr_dict['adv_neighbor_config'].default,
    distance_config=attr_dict['distance_config'].default,
    num_approx_steps=attr_dict['num_approx_steps'].default,
    approx_difference=attr_dict['approx_difference'].default
)

Initialize self. See help(type(self)) for accurate signature.

Methods

__eq__

__eq__(other)

Return self==value.

__ge__

__ge__(other)

Automatically created by attrs.

__gt__

__gt__(other)

Automatically created by attrs.

__le__

__le__(other)

Automatically created by attrs.

__lt__

__lt__(other)

Automatically created by attrs.

__ne__

__ne__(other)

Check equality and either forward a NotImplemented or return the result negated.