Options
All
  • Public
  • Public/Protected
  • All
Menu

L1 weight regularization for a particular model.

example
const model = new Linear(32,1);
const regularizer = new L1Regularization(model, 0.01);
//...
const prediction = (await model.forward([x]))[0];
let loss = prediction.subtract(y).reduceSumSquare();
loss = loss.add(regularizer.getLoss());
//...
loss.backward();
//...

Hierarchy

  • L1Regularization

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

gamma

gamma: number

model

model: Module

parameters

parameters: Variable<any>[]

Methods

getLoss

Generated using TypeDoc