simple-ml-regression

1.0.0 • Public • Published

Simple ML Regression

npm npm bundle size CI

A simple library for training a polynomial regression model from csv training data.

It uses an iterative training algorithm to optimise the model parameters and will return a model that has been trained on all available data.

Install

npm install simple-ml-regression

Usage

Given csv training data for the function x1^2 + 4x2 + x3:

X1,X2,X3,Y1
1,1,1,6
2,3,4,20
2,1,1,8
0,1,0,3
etc...

Train a polynomial model based on this training data:

import { loadDataCSV, train, predict } from 'simple-ml-regression';

loadDataCSV('data.csv', ['X1', 'X2', 'X3'], ['Y1']).then((data) => {
	const model = train(data, {
		testSplit: 0.2,
		maxDegree: 12,
		epochs: 50
	});

	const predictedResult = predict(model, [2, 5, 4]);

	console.log(predictedResult);
});

Result:

[23]

Package Sidebar

Install

npm i simple-ml-regression

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

8.7 kB

Total Files

8

Last publish

Collaborators

  • joshargent