L1 weight regularization for a particular model.
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(); //...
Generated using TypeDoc
L1 weight regularization for a particular model.