<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#L380-L434) |

Creates an [`nsl.configs.GraphRegConfig`](https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/configs/GraphRegConfig) object.

    nsl.configs.make_graph_reg_config(
        neighbor_prefix=attr.fields(GraphNeighborConfig).prefix.default,
        neighbor_weight_suffix=attr.fields(GraphNeighborConfig).weight_suffix.default,
        max_neighbors=attr.fields(GraphNeighborConfig).max_neighbors.default,
        multiplier=attr.fields(GraphRegConfig).multiplier.default,
        distance_type=https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/configs/DistanceType#L2,
        reduction=attr.fields(DistanceConfig).reduction.default,
        sum_over_axis=attr.fields(DistanceConfig).sum_over_axis.default,
        transform_fn=attr.fields(DistanceConfig).transform_fn.default
    )

### Used in the notebooks

| Used in the tutorials |
|---|
| - [Graph regularization for sentiment classification using synthesized graphs](https://www.tensorflow.org/neural_structured_learning/tutorials/graph_keras_lstm_imdb) - [Graph regularization for document classification using natural graphs](https://www.tensorflow.org/neural_structured_learning/tutorials/graph_keras_mlp_cora) - [Graph-based Neural Structured Learning in TFX](https://www.tensorflow.org/tfx/tutorials/tfx/neural_structured_learning) |

<br />

<br />

<br />

| ## Args ||
|---|---|
| `neighbor_prefix` | The prefix in feature names that identifies neighbor-specific features. Defaults to 'NL*nbr*'. |
| `neighbor_weight_suffix` | The suffix in feature names that identifies the neighbor weight value. Defaults to '_weight'. Note that neighbor weight features will have `prefix` as a prefix and `weight_suffix` as a suffix. For example, based on the default values of `prefix` and `weight_suffix`, a valid neighbor weight feature is 'NL_nbr_0_weight', where 0 corresponds to the first neighbor of the sample. |
| `max_neighbors` | The maximum number of neighbors to be used for graph regularization. Defaults to 0, which disables graph regularization. Note that this value has to be less than or equal to the actual number of neighbors in each sample. |
| `multiplier` | The multiplier or weight factor applied on the graph regularization loss term. This value has to be non-negative. Defaults to 0.01. |
| `distance_type` | type of distance function. Input type will be converted to the appropriate [`nsl.configs.DistanceType`](https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/configs/DistanceType) value (e.g., the value 'l2' is converted to [`nsl.configs.DistanceType.L2`](https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/configs/DistanceType#L2)). Defaults to the L2 norm. |
| `reduction` | type of distance reduction. See [`tf.compat.v1.losses.Reduction`](https://www.tensorflow.org/api_docs/python/tf/compat/v1/losses/Reduction) for details. Defaults to `tf.losses.Reduction.SUM_BY_NONZERO_WEIGHTS`. |
| `sum_over_axis` | the distance is the sum over the difference along the axis. See [`nsl.lib.pairwise_distance_wrapper`](https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/lib/pairwise_distance_wrapper) for how this field is used. Defaults to `None`. |
| `transform_fn` | type of transform function to be applied on each side before computing the pairwise distance. Input type will be converted to [`nsl.configs.TransformType`](https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/configs/TransformType) when applicable (e.g., the value 'softmax' maps to [`nsl.configs.TransformType.SOFTMAX`](https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/configs/TransformType#SOFTMAX)). Defaults to 'none'. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| An [`nsl.configs.GraphRegConfig`](https://www.tensorflow.org/neural_structured_learning/api_docs/python/nsl/configs/GraphRegConfig) object. ||

<br />