fixed function names
This commit is contained in:
parent
4c2220d148
commit
a53d8d13ca
1 changed files with 2 additions and 2 deletions
|
|
@ -572,14 +572,14 @@ function calculateCorrelation(x: number[], y: number[]): number {
|
||||||
return denominator > 0 ? numerator / denominator : 0;
|
return denominator > 0 ? numerator / denominator : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Variance(values: number[]): number {
|
function calculateVariance(values: number[]): number {
|
||||||
if (values.length < 2) return 0;
|
if (values.length < 2) return 0;
|
||||||
|
|
||||||
const mean = values.reduce((sum, val) => sum + val, 0) / values.length;
|
const mean = values.reduce((sum, val) => sum + val, 0) / values.length;
|
||||||
return values.reduce((sum, val) => sum + Math.pow(val - mean, 2), 0) / (values.length - 1);
|
return values.reduce((sum, val) => sum + Math.pow(val - mean, 2), 0) / (values.length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Covariance(x: number[], y: number[]): number {
|
function calculateCovariance(x: number[], y: number[]): number {
|
||||||
if (x.length !== y.length || x.length < 2) return 0;
|
if (x.length !== y.length || x.length < 2) return 0;
|
||||||
|
|
||||||
const n = x.length;
|
const n = x.length;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue