You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
356 B
19 lines
356 B
2 years ago
|
#pragma once
|
||
|
#include "./server/libaquery.h"
|
||
|
#include "./server/aggregations.h"
|
||
|
|
||
|
auto covariance = [](auto x, auto y) {
|
||
|
auto xmean = avg(x);
|
||
|
auto ymean = avg(y);
|
||
|
return avg(((x - xmean) * (y - ymean)));
|
||
|
};
|
||
|
|
||
|
auto sd = [](auto x) {
|
||
|
return sqrt(covariance(x, x));
|
||
|
};
|
||
|
|
||
|
auto paircorr = [](auto x, auto y) {
|
||
|
return (covariance(x, y) / (sd(x) * sd(y)));
|
||
|
};
|
||
|
|