calculateGADF_GVF = function(data, breakIDs){
let GADF = NaN;
let ADCM = 0;
let ADAM = 0;
let GVF = 0;
let SSDcMean = 0;
let SSDAMean = 0;
ADAM = getSumOfAbsoluteDeviationsFromMedian(data);
SSDAMean = getSumOfSquaredDifferenceFromMean(data);
for (let i = 0; i < breakIDs.length; i++) {
let min_idx = breakIDs[i];
let max_idx = -1;
if (i < breakIDs.length - 1)
max_idx = breakIDs[i + 1];
else
max_idx = data.length - 1;
let data_class = [] ;
let cnt = 0;
for (let j = min_idx; j < max_idx; j++) {
data_class.push(data[j]);
}
if (data_class.length != 0) {
ADCM += getSumOfAbsoluteDeviationsFromMedian(data_class);
SSDcMean += getSumOfSquaredDifferenceFromMean(data_class);
}
}
GADF = 1 - (ADCM / ADAM);
GVF = 1 - (SSDcMean / SSDAMean);
return [GADF, GVF];
}