<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/neural-structured-learning/blob/v1.4.0/neural_structured_learning/configs/configs.py#L37-L77) |

Contains configuration for generating adversarial neighbors.

    nsl.configs.AdvNeighborConfig(
        feature_mask=attr_dict['feature_mask'].default,
        adv_step_size=attr_dict['adv_step_size'].default,
        adv_grad_norm=attr_dict['adv_grad_norm'].default,
        clip_value_min=attr_dict['clip_value_min'].default,
        clip_value_max=attr_dict['clip_value_max'].default,
        pgd_iterations=attr_dict['pgd_iterations'].default,
        pgd_epsilon=attr_dict['pgd_epsilon'].default,
        random_init=attr_dict['random_init'].default
    )

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `feature_mask` | mask w/ values in `[0, 1]` applied on the gradient. Its shape should be the same as (or broadcastable to) that of the input features. If the input features are in a collection (e.g. list or dictionary), this field should also be a collection of the same structure. Input features corresponding to mask values of 0.0 are *not* perturbed. Setting this field to `None` is equivalent to setting a mask value of 1.0 for all input features. |
| `adv_step_size` | step size to find the adversarial sample. Default set to 0.001. |
| `adv_grad_norm` | type of tensor norm to normalize the gradient. Input will be converted to [`nsl.configs.NormType`](https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/configs/NormType) when applicable (e.g., `'l2'` -\> `nls.configs.NormType.L2`). Default set to L2 norm. |
| `clip_value_min` | minimum value to clip the features after perturbation. The shape should be the same as (or broadcastable to) input features. If the input features are in a collection (e.g. list or dictionary), this field should also be a collection with the same structure. An omitted or `None`-valued entry in the collection indicates no constraint on the corresponding feature. |
| `clip_value_max` | maximum value to clip the feature after perturbation. (See `clip_value_min` for the structure and shape limitations.) |
| `pgd_iterations` | number of attack iterations for Projected Gradient Descent (PGD) attack. Defaults to 1, which resembles the Fast Gradient Sign Method (FGSM) attack. |
| `pgd_epsilon` | radius of the epsilon ball to project back to. Only used in Projected Gradient Descent (PGD) attack. |
| `random_init` | Apply a random perturbation before FGSM/PGD steps. Default set to `False` for no random initialization being applied. |

<br />

## Methods

### `__eq__`

    __eq__(
        other
    )

Method generated by attrs for class AdvNeighborConfig.

### `__ge__`

    __ge__(
        other
    )

Method generated by attrs for class AdvNeighborConfig.

### `__gt__`

    __gt__(
        other
    )

Method generated by attrs for class AdvNeighborConfig.

### `__le__`

    __le__(
        other
    )

Method generated by attrs for class AdvNeighborConfig.

### `__lt__`

    __lt__(
        other
    )

Method generated by attrs for class AdvNeighborConfig.

### `__ne__`

    __ne__(
        other
    )

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