A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/RobertMenke/JS-Polynomial-Regression below:

RobertMenke/JS-Polynomial-Regression: A javascript library that predicts the value of a dependent variable using polynomial regression (Gaussian-Jordan elimination)

This library can make predictions about data using a technique called polynomial regression.

Polynomial regression uses a technique called Gaussian-Jordan elimination, which creates a predictive model that more accurately fits non-linear data.

Let's say you have your typical cartesian coordinates (x and y coordinates)

const data = [
    {
        x : 5,
        y : 8
    },
    {
        x : 9,
        y : 12
    }
    // and so on...
];         

This library will read this data, and then make a prediction about a y value, given an x.

//This library is a UMD module (thanks webpack!)
import PolynomialRegression from "js-polynomial-regression";

//Factory function - returns a PolynomialRegression instance. 2nd argument is the degree of the desired polynomial equation.
const model = PolynomialRegression.read(data, 3);
//terms is a list of coefficients for a polynomial equation. We'll feed these to predict y so that we don't have to re-compute them for every prediction.
const terms = model.getTerms();
//10 is just an example of an x value, the second argument is the independent variable being predicted.
const prediction = model.predictY(terms, 10);

That's it! I've created an example using random data in the example folder of this repo. Please use the issues section to communicate any bugs, questions, or feature requests.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4