Commit e24e0d34 authored by Francisco Bernardo's avatar Francisco Bernardo
Browse files

eliminated redundant trainingData2GVF method

parent 699cc1e4
//
// gvf.cpp
// rapidGVF.cpp
//
// Created by Francisco on 04/05/2017.
// Copyright © 2017 Goldsmiths. All rights reserved.
......@@ -8,7 +8,6 @@
#include "rapidGVF.h"
#include "trainingData.h"
rapidGVF::rapidGVF()
{
// Initialised with default configuration
......@@ -22,8 +21,13 @@ rapidGVF::~rapidGVF()
this->currentGesture = NULL;
}
template<>
bool rapidmix::machineLearning<rapidGVF>::train(const trainingData &newTrainingData) {
return rapidGVF::train(newTrainingData);
}
bool rapidGVF::trainingData2GVF(const rapidmix::trainingData &newTrainingData, std::vector<std::vector<float>> &trainingSet) {
bool rapidGVF::train(const rapidmix::trainingData &newTrainingData) {
if (newTrainingData.trainingSet.size() <= 1) {
// no recorded phrase (only default one)
......@@ -39,7 +43,7 @@ bool rapidGVF::trainingData2GVF(const rapidmix::trainingData &newTrainingData, s
for (int h = 0; h < newTrainingData.trainingSet.size(); ++h) {
for (int i = 0; i < newTrainingData.trainingSet[h].elements.size(); ++i) {
this->currentGesture.clear();
std::vector<double> vd = newTrainingData.trainingSet[h].elements[i].input;
......@@ -52,35 +56,6 @@ bool rapidGVF::trainingData2GVF(const rapidmix::trainingData &newTrainingData, s
return true;
}
template<>
bool rapidmix::machineLearning<rapidGVF>::train(const trainingData &newTrainingData) {
std::vector<std::vector<float>> trainingSet;
trainingData2GVF(newTrainingData, trainingSet);
return rapidGVF::train(trainingSet);
}
bool rapidGVF::train(const std::vector<std::vector<float>> &newTrainingData) {
// vector<vector<float>> trainingData;
//
// for (vector<vector<vector<float>>>::iterator trainingGesture = trainingData.begin(); trainingGesture != trainingData.end(); trainingGesture++)
// {
// currentGesture.clear();
// for (vector<vector<float>>::iterator frame = (*trainingGesture).begin(); frame != (*trainingGesture).end(); frame++)
// {
// Fill the template
// currentGesture.addObservation(*frame);
// }
// Add the template at the end of the gesture
// gvf->addGestureTemplate(currentGesture);
// }
return true;
}
template<>
std::vector<double> rapidmix::machineLearning<rapidGVF>::run(const std::vector<double> &inputVector) {
......
//
// gvf.h
// rapidGVF.h
//
// Created by Francisco on 04/05/2017.
// Copyright © 2017 Goldsmiths. All rights reserved.
......@@ -10,10 +10,8 @@
#include <vector>
#include <string>
#include "GVF.h"
namespace rapidmix { class trainingData; }
class rapidGVF {
......@@ -23,9 +21,7 @@ public:
~rapidGVF();
bool train(const std::vector<std::vector<float>> &newTrainingData);
bool trainingData2GVF(const rapidmix::trainingData &newTrainingData, std::vector<std::vector<float>> &trainingSet);
bool train(const rapidmix::trainingData &newTrainingData);
std::vector<double> process(const std::vector<double> &inputVector);
......@@ -35,5 +31,4 @@ protected:
GVFOutcomes outcomes;
};
#endif
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