Commit b591064d authored by mzed's avatar mzed

getters for gvf

parent c5735b8f
......@@ -89,7 +89,7 @@ set(RAPIDMIX_FULL_SRC ${RAPIDMIX_SRC}
${JSON_SRC}
)
add_library(RAPID-MIX_API ${RAPIDMIX_FULL_SRC})
add_library(RAPID-MIX_API SHARED ${RAPIDMIX_FULL_SRC})
add_executable(rapidmixTest tests/rapidMixTest.cpp )
......
......@@ -78,9 +78,25 @@ std::vector<double> rapidGVF::run(const std::vector<double> &inputVector){
output.push_back(this->outcomes.likeliestGesture);
output.insert(output.end(), this->outcomes.likelihoods.begin(), this->outcomes.likelihoods.end());
output.insert(output.end(), this->outcomes.alignments.begin(), this->outcomes.alignments.end());
// output.insert(output.end(), this->outcomes.dynamics.begin(), this->outcomes.dynamics.end());
// output.insert(output.end(), this->outcomes.scalings.begin(), this->outcomes.scalings.end());
// output.insert(output.end(), this->outcomes.rotations.begin(), this->outcomes.rotations.end());
//
return output;
}
const std::vector<float> rapidGVF::getLikelihoods() {
return outcomes.likelihoods;
};
const std::vector<float> rapidGVF::getAlignments() {
return outcomes.alignments;
};
const std::vector<std::vector<float> > * rapidGVF::getDynamics() {
return &outcomes.dynamics;
};
const std::vector<std::vector<float> > * rapidGVF::getScalings() {
return &outcomes.scalings;
};
const std::vector<std::vector<float> > * rapidGVF::getRotations() {
return &outcomes.rotations;
};
......@@ -28,6 +28,12 @@ public:
std::vector<double> run(const std::vector<double> &inputVector);
//TODO: needs a "reset" message
const std::vector<float> getLikelihoods();
const std::vector<float> getAlignments();
const std::vector<std::vector<float> > * getDynamics();
const std::vector<std::vector<float> > * getScalings();
const std::vector<std::vector<float> > * getRotations();
protected:
GVF * gvf;
GVFGesture currentGesture;
......
......@@ -11,13 +11,13 @@
#include "rapidMix.h"
TEST_CASE( "Tests default GVF ctor.", "[GVF]" ) {
GVF * gvf = new GVF();
gvf->translate(false);
gvf->segmentation(false);
REQUIRE(gvf != NULL);
}
TEST_CASE( "Tests default GVFGesture ctor.", "[GVF]" ) {
......@@ -33,7 +33,7 @@ TEST_CASE( "Tests default GVFGesture ctor.", "[GVF]" ) {
gvf->setTolerance(0.2f);
gvf->setScalingsVariance(0.00001f); //0.00001f); //0.000002f); //0.00004f);
gvf->setDynamicsVariance(0.0001f);
vector<vector<float>> trainingData;
if(gvf->getState() == GVF::STATE_LEARNING)
......@@ -64,12 +64,12 @@ TEST_CASE( "Tests default GVFGesture ctor.", "[GVF]" ) {
gvf->update(gesture.getLastObservation());
}
// float phase = gvf->getOutcomes().estimations[0].alignment;
// float speed = gvf->getOutcomes().estimations[0].dynamics[0];
//
// getDynamicsVariance();
// getScalingsVariance();
// getRotationsVariance();
// float phase = gvf->getOutcomes().estimations[0].alignment;
// float speed = gvf->getOutcomes().estimations[0].dynamics[0];
//
// getDynamicsVariance();
// getScalingsVariance();
// getRotationsVariance();
REQUIRE( gvf != NULL);
......@@ -144,26 +144,27 @@ SCENARIO("Test GVF Regression", "[machineLearning]")
// The assumtion for the test is that the outcome of the last segment of the test gesture must converge
REQUIRE(outcomes[0] == 0); // outcomes[0] - likeliestGesture must be equal to first gesture '0'
REQUIRE(outcomes[1] > 0.5); // outcomes[1] - likelihood gesture '0' must be greater than 50%
REQUIRE(outcomes[2] < 0.5); // outcomes[2] - likelihood gesture '1' must be lesser than 50%
// REQUIRE(outcomes[3] < 0.5); // outcomes[3] - alignment gesture '0' must be lesser than 50%
// REQUIRE(outcomes[4] < 0.5); // outcomes[4] - alignment gesture '1' must be lesser than 50%
REQUIRE(gvf.getLikelihoods()[0] > 0.5); // outcomes[1] - likelihood gesture '0' must be greater than 50%
REQUIRE(gvf.getLikelihoods()[1] < 0.5); // outcomes[2] - likelihood gesture '1' must be lesser than 50%
REQUIRE(gvf.getAlignments()[0] < 0.5); // outcomes[3] - alignment gesture '0' must be lesser than 50%
// REQUIRE(outcomes[4] < 0.5); // outcomes[4] - alignment gesture '1' must be lesser than 50%
}
}
WHEN("when gvf is trained with two gestures")
{
THEN("gvf follows the test gesture (first gesture scaled) and confirm it is the likeliestGesture and likelihoods anc reasonable ")
WHEN("when gvf is trained with two gestures")
{
THEN("gvf follows the test gesture (first gesture scaled) and confirm it is the likeliestGesture and likelihoods anc reasonable ")
{
}
}
}
WHEN("when gvf is trained with two gestures")
{
THEN("gvf follows the test gesture (first gesture scaled) and confirm it is the likeliestGesture and likelihoods anc reasonable ")
WHEN("when gvf is trained with two gestures")
{
THEN("gvf follows the test gesture (first gesture scaled) and confirm it is the likeliestGesture and likelihoods anc reasonable ")
{
}
}
}
}
......
......@@ -66,6 +66,10 @@
319C94BB1FC5C1200055BE40 /* rta_int.c in Sources */ = {isa = PBXBuildFile; fileRef = 319C940E1FC49C990055BE40 /* rta_int.c */; };
319C94BC1FC5C1200055BE40 /* rta_util.c in Sources */ = {isa = PBXBuildFile; fileRef = 319C94141FC49C990055BE40 /* rta_util.c */; };
31A8F1971F4ECF3300CA8CEC /* rapidXMM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31A8F1941F4ECD1200CA8CEC /* rapidXMM.cpp */; };
BE0AC6251FD17669008056E6 /* BayesianFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 319C93ED1FC49B5C0055BE40 /* BayesianFilter.cpp */; };
BE0AC6261FD1766D008056E6 /* filter_utilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 319C93EF1FC49B5C0055BE40 /* filter_utilities.cpp */; };
BE0AC6271FD1768D008056E6 /* BayesianFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 319C93ED1FC49B5C0055BE40 /* BayesianFilter.cpp */; };
BE0AC6281FD17690008056E6 /* filter_utilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 319C93EF1FC49B5C0055BE40 /* filter_utilities.cpp */; };
BE5733061F505ECC0063F4D1 /* machineLearning.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE2C5EBE1ED8459300E9FAFA /* machineLearning.cpp */; };
BE5733071F505F190063F4D1 /* rapidGVF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0BE2E7351EE56F4F00722712 /* rapidGVF.cpp */; };
BE5733081F505F310063F4D1 /* GVF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0BE2E72F1EE56E6D00722712 /* GVF.cpp */; };
......@@ -1235,6 +1239,8 @@
0BA41BAD1EE6E0ED00B74667 /* trainingData.cpp in Sources */,
BE5733061F505ECC0063F4D1 /* machineLearning.cpp in Sources */,
BE5733111F505FDC0063F4D1 /* libsvm.cpp in Sources */,
BE0AC6271FD1768D008056E6 /* BayesianFilter.cpp in Sources */,
BE0AC6281FD17690008056E6 /* filter_utilities.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1299,6 +1305,8 @@
BE9286491EF015AE006847CF /* test_signalProcessing.cpp in Sources */,
BEA7B71E1EDD963E0003E84B /* maximilian.cpp in Sources */,
BE92864D1EF01622006847CF /* rapidStream.cpp in Sources */,
BE0AC6251FD17669008056E6 /* BayesianFilter.cpp in Sources */,
BE0AC6261FD1766D008056E6 /* filter_utilities.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
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