Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ml-regression-multivariate-linear

mljs143.6kMIT2.0.4TypeScript support: included

Multivariate linear regression

readme

ml-regression-multivariate-linear

NPM version build status npm download

Multivariate linear regression.

Installation

npm install --save ml-regression-multivariate-linear

API

new MLR(x, y[, options])

Arguments

  • x: Matrix containing the inputs
  • y: Matrix containing the outputs

Options

  • intercept: boolean indicating if intercept terms should be computed (default: true)
  • statistics: boolean for calculating and returning regression statistics (default: true)

Usage

import MLR from "ml-regression-multivariate-linear";

const x = [
  [0, 0],
  [1, 2],
  [2, 3],
  [3, 4]
];
// Y0 = X0 * 2, Y1 = X1 * 2, Y2 = X0 + X1
const y = [
  [0, 0, 0],
  [2, 4, 3],
  [4, 6, 5],
  [6, 8, 7]
];
const mlr = new MLR(x, y);
console.log(mlr.predict([3, 3]));
// [6, 6, 6]

License

MIT

changelog

Changelog

2.0.4 (2022-06-21)

Bug Fixes

  • fix TypeScript export issue (4cba7a2), closes #18

2.0.3 (2019-12-06)

Bug Fixes

2.0.2 (2019-06-22)

Bug Fixes

  • ts: correct TypeScript definitions (f3346c4)
  • change algorithm to fix bug with some datasets (fc3e052)

2.0.1 (2019-06-02)

Bug Fixes

  • stop depending on BaseRegression (#13) (8be20a4)

2.0.0 (2019-05-01)

Bug Fixes

  • add missing fields to TS definitions (43fdf75)
  • include TS definitions in npm package (4c49609)

chore

  • update ml-matrix to 6.0.0 (4984850)

BREAKING CHANGES

  • Node.js 6 is no longer supported.

1.2.0 (2018-05-11)

Features

  • add option to make statistics calculations optional (#5) (59726a0)

1.1.0 (2018-02-16)

Features

  • add stats around the calculated betas to be able to interpret them (#2) (b2d395e)

1.0.1 (2017-07-21)

1.0.0 (2017-06-28)