Commit dff383de authored by mzed's avatar mzed

normalising format

parent 2989fd0e
......@@ -15,7 +15,8 @@ rapidGVF::~rapidGVF() {}
bool rapidGVF::train(const rapidmix::trainingData &newTrainingData)
{
if (newTrainingData.trainingSet.size() < 1) {
if (newTrainingData.trainingSet.size() < 1)
{
// no recorded phrase
return false;
}
......@@ -31,12 +32,13 @@ bool rapidGVF::train(const rapidmix::trainingData &newTrainingData)
}
//Go through every phrase
for (int h = 0; h < newTrainingData.trainingSet.size(); ++h) {
for (int h = 0; h < newTrainingData.trainingSet.size(); ++h)
{
gvf.startGesture();
for (int i = 0; i < newTrainingData.trainingSet[h].elements.size(); ++i) {
for (int i = 0; i < newTrainingData.trainingSet[h].elements.size(); ++i)
{
std::vector<double> vd = newTrainingData.trainingSet[h].elements[i].input;
// Using template <class InputIterator> vector to change for vec<double> to vec<float>
std::vector<float> vf(vd.begin(), vd.end());
this->currentGesture.addObservation(vf);
......@@ -49,7 +51,8 @@ bool rapidGVF::train(const rapidmix::trainingData &newTrainingData)
std::vector<double> rapidGVF::run(const std::vector<double> &inputVector)
{
if (inputVector.size() == 0) {
if (inputVector.size() == 0)
{
return std::vector<double>();
}
......
......@@ -69,7 +69,6 @@ SCENARIO("Test kNN classification", "[machineLearning]")
GIVEN("kNN object and training dataset")
{
rapidmix::staticClassification myKnn;
rapidmix::trainingData myData;
REQUIRE(myData.recordSingleElement("cat", { 0.2, 0.7 }) == 1);
REQUIRE(myData.recordSingleElement("dog", { 2.0, 44.2 }) == 3); // This is not 2, because phrases get numbers, too.
......
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