
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
exponential-regression
Advanced tools
Super fast non-iterative exponential regression with constant term (t => a + b * exp(c * t)) with no dependency
This library provides a fast and simple non-iterative way to make exponential regressions.
It also supports a non-zero constant term, that is every function of the form:
t => a + b * exp(c * t)
// (a, b, c) ϵ ℝ³
It accepts various form of input for the points, that is:
solve([x0, x1, ..], [y0, y1, ..])sovle([[t0, y0], [t1, y1], ..])solve(origin, period, [y0, y1, ..])The fastest being the first one.
Small example:
// import
const ExpReg = require('exponential-regression').ExpReg;
// create dataset (5 values)
const a = 1, b = 2, c = -0.5;
const exp = t => a + b * Math.exp(c * t);
const t = [0, 1, 2, 3, 4];
const y = t.map(exp);
// make regression
const solved = ExpReg.solve(t, y);
// output result
console.log(solved);
/*
* { a: 0.9827848677867319,
* b: 2.014213829585767,
* c: -0.4898373248074215 }
*/
The easiest way to install this is using npm
npm i --save exponential-regression
Here are the available methods to get the approximation of (a, b, c):
type RegressionResult {a: number; b: number; c: number;}
RegExp.solve(xk: number[], yk: number[]): RegressionResult
RegExp.solve(xyk: number[][]): RegressionResult
RegExp.solve(origin: number, period: number, yk: number[]): RegressionResult
Tests are made with mocha. To run them, use
npm run test
Automatic tests ensure the relative error is less than a certain percentage for every test sample.
Test samples are in test/samples.ts.
You can store the csv file corresponding to the test samples using
npm run test-manual $STORE_PATH
$STORE_PATH is the path where you would like to store the csv file.
Benchmark between different input forms have been done using these values
const A: number = 0.3;
const B: number = 0.6;
const C: number = - 1.7;
const XMIN: number = 0;
const XMAX: number = 20;
const N: number = 1000000; // number of points
function ms
solve(xk: number[], yk: number[]) [optimized] 21 ms
solve(o: number, t: number, yk: number[]) [optimized] 55 ms
solve(points: number[][]) [optimized] 30 ms
To run the benchmark, use
npm run bench
Credits to Jean Jacquelin for his paper REGRESSION & FULL EQUATIONS
FAQs
Super fast non-iterative exponential regression with constant term (t => a + b * exp(c * t)) with no dependency
The npm package exponential-regression receives a total of 1,385 weekly downloads. As such, exponential-regression popularity was classified as popular.
We found that exponential-regression 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.