Commit b0e90143 authored by mzed's avatar mzed
Browse files

exposing bayes filter params

parent f387e312
......@@ -11,11 +11,16 @@
int main(int argc, const char * argv[]) {
rapidStream<double> rapidProcess;
rapidProcess.bayesSetDiffusion(-2.0);
rapidProcess.bayesSetJumpRate(-5.0);
rapidProcess.bayesSetMVC(1.);
double bayes = 0.;
for (int i = 0; i < 100; ++i) {
bayes = rapidProcess.bayesFilter(i/100.);
std::cout << "bayes: " << bayes <<std::endl;
}
assert(bayes > 0.99);
// bayes > 0.99);
//vanAllenTesting
seriesClassification testDTW;
......
......@@ -28,7 +28,7 @@ rapidStream<T>::rapidStream(int window_size) {
bayesFilt.jump_rate = powf(10., -5);
bayesFilt.mvc[0] = 1.;
bayesFilt.init();
}
template<typename T>
......@@ -139,6 +139,28 @@ T rapidStream<T>::bayesFilter(T input) {
bayesFilt.update(inputVec);
return T(bayesFilt.output[0]);
}
template<typename T>
void rapidStream<T>::bayesSetDiffusion(float diffusion) {
bayesFilt.diffusion = powf(10., diffusion);
//bayesFilt.jump_rate = powf(10., -5);
//bayesFilt.mvc[0] = 1.;
bayesFilt.init();
}
template<typename T>
void rapidStream<T>::bayesSetJumpRate(float jump_rate) {
bayesFilt.jump_rate = powf(10., jump_rate);
bayesFilt.init();
}
template<typename T>
void rapidStream<T>::bayesSetMVC(float mvc) {
bayesFilt.mvc[0] = mvc;
bayesFilt.init();
}
template<typename T>
T rapidStream<T>::minVelocity() {
T minVel = std::numeric_limits<T>::infinity();
......@@ -171,7 +193,7 @@ T rapidStream<T>::minAcceleration() {
T currentVel = calcCurrentVel(i);
T currentAccel = currentVel - lastVel;
lastVel = currentVel;
if (currentAccel < minAccel) {
if (currentAccel < minAccel) {
minAccel = currentAccel;
}
}
......
......@@ -82,6 +82,9 @@ public:
* @return current envelope value
*/
T bayesFilter(T inputValue);
void bayesSetDiffusion(float logDiffusion);
void bayesSetJumpRate(float jump_rate);
void bayesSetMVC(float mvc);
/** Calculate the minimum first-order difference over consecutive inputs in the buffer.
* @return double: minimum velocity.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment