ml-regression
Regression algorithms.
Installation
$ npm install ml-regression
Examples
Simple linear regression
const SLR = SLR;let inputs = 80 60 10 20 30;let outputs = 20 40 30 50 60; let regression = inputs outputs;regression === 'f(x) = - 0.265 * x + 50.6';
External links
Check this cool blog post for a detailed example: https://hackernoon.com/machine-learning-with-javascript-part-1-9b97f3ed4fe5
Polynomial regression
const PolynomialRegression = PolynomialRegression;const x = 50 50 50 70 70 70 80 80 80 90 90 90 100 100 100;const y = 33 28 29 23 26 21 25 29 24 30 31 28 33 35 30;const degree = 5; // setup the maximum degree of the polynomialconst regression = x y degree;console; // Apply the model to some x value. Prints 2.6.console; // Prints the coefficients in increasing order of power (from 0 to degree).console; // Prints a human-readable version of the function.console;