Library to calculate potential, exponential, logarithmic, lineal and logistic regression in Arduino.
Lineal: Y = a*X + b
Exponential: Y = b * e^(a*X)
Logarithmic: Y = a*ln(X) + b
Potential: Y = b * x^a
Logistic: Y = 1 / (1 + e^-(a*x+b))
Graphs with a = 2 and b = 3:
Logistic regression:
#include <LinearRegression.h>
LinearRegression lr = LinearRegression();
#include <ExponentialRegression.h>
ExponentialRegression er = ExponentialRegression;
#include <LogarithmicRegression.h>
LogarithmicRegression lr = LogarithmicRegression();
#include <PotentialRegression.h>
PotentialRegression pr = PotentialRegression();
#include <LogisticRegression.h>
LogisticRegression pr = LogisticRegression();
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 parameters(double values[]);
Return parameters of the regression
- values[0] = a;
- values[1] = b;
double error(double x, double y);
Return estimation error.
void samples();
Return number of examples learned