L2L1

open class L2L1(l1: Float, l2: Float) : Regularizer

A regularizer that applies both L1 and L2 regularization penalties. The L1 regularization penalty is computed as:

``loss = l1 * reduce_sum(abs(x))``

The L2 regularization penalty is computed as

``loss = l2 * reduce_sum(square(x))``

This is a common class which have two specific implementations: L1 and L2.

Constructors

L2L1
Link copied to clipboard
fun L2L1(l1: Float = DEFAULT_PENALTY, l2: Float = DEFAULT_PENALTY)

Functions

apply
Link copied to clipboard
open override fun apply(tf: Ops, input: Operand<Float>): Operand<Float>

Applies regularization to the input.

toString
Link copied to clipboard
open override fun toString(): String

Properties

l1
Link copied to clipboard
val l1: Float

Value of L1 regularization penalty. Could be calculated during graph computations.

l2
Link copied to clipboard
val l2: Float

Value of L2 regularization penalty. Could be calculated during graph computations.

Inheritors

L1
Link copied to clipboard
L2
Link copied to clipboard