Files
Dirigent/java/src/main/java/bpmEstimation/BpmHistory.java
toni 49042a0cfb added ground truth to java method
fixed some bugs
improved algo and results
2019-01-27 10:47:46 +01:00

58 lines
1.3 KiB
Java

package bpmEstimation;
import utilities.Utils;
import java.util.LinkedList;
/**
* Created by toni on 03/08/18.
*/
public class BpmHistory extends LinkedList<Double> {
private double mMean = 0.0;
private double mVar = 0.0;
private double mStdDev = 0.0;
public boolean add(double val){
if(val != -1){
super.add(val);
return true;
}
return false;
}
public boolean add(BpmHistory vals){
if(!vals.isEmpty()){
for(double val : vals){
super.add(val);
}
return true;
}
return false;
}
public double getMean(){
if(this.size() > 2){
return Utils.mean(this);
} else {
return this.getFirst(); //TODO: das ist natürlich quatsch und faulheit. mal schaun wie man das am besten löst.
}
}
public double getVariance(){
if(this.size() > 2){
return Utils.var(this);
} else {
return 0; //TODO: das ist natürlich quatsch und faulheit. mal schaun wie man das am besten löst.
}
}
public double getStd(){
return Utils.stdDev(this);
}
public void removeOutliers(){
Utils.removeOutliersZScore(this, 3.4);
}
}