gradient-descent

1.0.4 • Public • Published

Gradient Descent

Module to iterate over a numerically function to Gradient Descent direction

API

The module expose a function with next params

GD(initialPoint,asyncNumericalFunc,stepSize,deltaSize,numSteps,presicion)->Promise(bestParams)

Iterate NUM_STEPS and stop when the norm of gradient is less that PRESICION, every step is of size STEP_SIZE and the numerical derivate is aproximated by:

derivate = [f(x + DELTA_SIZE) - f(x)]/DELTA_SIZE

Usage

const optimze = require('gradient-descent')
const func = async (x, y, z) => x * x + y * y + z * z;
const init = [3, 4, 5]; // dimension is obtained from initial point
const res = await optimize(init, func);
assert(await func(...res) < await func(...init));

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.4
    11
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.4
    11
  • 1.0.3
    0
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i gradient-descent

Weekly Downloads

11

Version

1.0.4

License

ISC

Unpacked Size

14.9 kB

Total Files

5

Last publish

Collaborators

  • cereceres