lin-regression-js
v1.0.1
Published
[![npm version](https://badge.fury.io/js/Ritchie.svg)](https://www.npmjs.com/package/lin-regression-js)
Downloads
5
Readme
lin-regression-js
Linear Regression in JavaScript
This is a simple linear regression implementation in JavaScript. It uses the gradient descent algorithm to find the best fit line for a set of data points and mean squared error to calculate the error.
Usage
const regression = require('lin-regression-js');
regression.gradientDescent(data, weightsbias,iterations, learningRate);
The weights and biases can be initialized to random values.
const data = [[1,2],[2,4],[3,6],[4,8],[5,10],[6,12],[7,14],[8,16],[9,18],[10,20]];
const weightsbias = [Math.random(), Math.random()];
regression(data, weightsbias, 1000, 0.01); // returns [slope, intercept]
Contributing
You can contribute to the project by making a pull request on GitHub.
Credits
Amukh1.
Built With
Authors
- Amukh1 - Github
See also the list of contributors who participated in this project.
License
MIT License © Amukh1