Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
learning-rate-scaler
Advanced tools
Learning rate scaler callback for @tensorflow/tfjs
Package available via:
npm install learning-rate-scaler
Module exports LearningRateCallback
and example function sineWaveRateScaler = (min, max, frequency, maxLearningRateDecay, earningRateDecayPerEpoch)
to use with it. (also a default LearningRateCallback
scaler function).
LearningRateCallback
with defaults
import {
LearningRateCallback,
sineWaveRateScaler,
} from "learning-rate-scaler";
const learningRateCallback = new LearningRateCallback()
const inputs = input({
shape: [1],
});
const y1 = dense({ units: 1, name: "y1" }).apply(inputs);
let layersModel = model({
inputs: inputs,
outputs: [y1],
});
layersModel.compile({
optimizer: train.sgd(0.001),
loss: {
y1: "meanAbsoluteError",
},
});
const history = await layersModel.fitDataset(trainingDataset, {
epochs: 1,
callbacks: [learningRateCallback],
});
This would produce a sine-wave-looking learning-rate curve for each sample in the batch (for batch size of 2048 items with default settings).
const frequency = 1 / 25; // a fraction - fraction lim -> 0 produces wider periods.
const maxLearningRateDecay = 1.0001 // a number slightly higher than 1
const sineWaveRateScaler = sineWaveRateScaler(0.0001, 1, frequency, )
const learningRateCallback = new LearningRateCallback({scalerFunction: sineWaveRateScaler})
[...]
const history = await layersModel.fitDataset(trainingDataset, {
epochs: 1,
callbacks: [learningRateCallback],
});
This would produce a sine-wave-looking learning-rate curve with decaying of the initial max learning rate for each sample in the batch (for batch size of 2048 items with default settings).
Also it's possible to decay epoch-wise also by providing
const sineWaveRateScaler = sineWaveRateScaler(0.0001, 1, frequency, 1.0001, 1.0001)
Prepared by Webplan.pro
FAQs
Learning rate scaler callback for @tensorflow/tfjs
We found that learning-rate-scaler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.