[apps/regression] Use a new helper to compute linear regression coefficients

This commit is contained in:
Ruben Dashyan
2019-05-28 18:55:58 +02:00
committed by Léa Saviot
parent 13c63f495c
commit ea4dd33826
5 changed files with 40 additions and 4 deletions

View File

@@ -0,0 +1,17 @@
#include "linear_model_helper.h"
namespace Regression {
namespace LinearModelHelper {
double Slope(double covariance, double variance) {
return covariance / variance;
}
double YIntercept(double meanOfY, double meanOfX, double slope) {
return meanOfY - slope * meanOfX;
}
}
}