/LinearRegressino

LinearRegression for arduino

Primary LanguageC++GNU General Public License v3.0GPL-3.0

LinearRegressino     Buy Me a Coffee at ko-fi.com

Library to calculate linear regression in arduino ( Better use Regressino a new library with linear regression and more )

Create

LinearRegression lr = LinearRegression();
LinearRegression lr = LinearRegression(0,100);

Methods

LinearRegression();  

Initializes object

LinearRegression(int min, int max);  

Initializes the object with limits to the value of X

  • min: min value of X
  • max: max value of X
void learn(int x, int y);  

Learns one example.

  • x: value of X
  • y: value of Y
double calculate(int x);  

Estimates value of Y for X

  • x: value of x
double correlation();  

Return actual correlation value

void reset();  

Reset values. Start learning since zero.

void getValues(double values[]);

Returns parameters of the linear regression

  • values[0] = m;
  • values[1] = b;
  • values[2] = n;

Y = m*X + b

n is the number of examples