tf.keras.regularizers.L1

A regularizer that applies a L1 regularization penalty.

Inherits From: Regularizer

The L1 regularization penalty is computed as: loss = l1 * reduce_sum(abs(x))

L1 may be passed to a layer as a string identifier:

dense = tf.keras.layers.Dense(3, kernel_regularizer='l1')

In this case, the default value used is l1=0.01.

l1 Float; L1 regularization factor.

Methods

from_config

View source

Creates a regularizer from its config.

This method is the reverse of get_config, capable of instantiating the same regularizer from the config dictionary.