1.0.1 • Published 1 year ago

lin-regression-js v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

npm version

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

See also the list of contributors who participated in this project.

License

MIT License © Amukh1

1.0.1

1 year ago

1.0.0

1 year ago