Commit 63717f09 authored by Michael Zbyszyński's avatar Michael Zbyszyński
Browse files

testing alternate interface

parent db220457
......@@ -5,7 +5,6 @@
* @copyright Copyright © 2017 Goldsmiths. All rights reserved.
*/
#include <fstream>
#include "trainingData.h"
namespace rapidmix {
......@@ -21,6 +20,13 @@ namespace rapidmix {
return returnVal;
}
std::vector<trainingData::phrase>::iterator trainingData::createNewPhrase(std::string label) {
phrase tempPhrase = { assignCurrentId(), label };
trainingSet.push_back(tempPhrase);
std::vector<trainingData::phrase>::iterator it = --trainingSet.end();
return it;
};
uint32_t trainingData::startRecording() {
phrase tempPhrase = { assignCurrentId(), std::to_string(tempPhrase.uniqueId) }; //TODO: Is this label helpful? -MZ
trainingSet.push_back(tempPhrase);
......
......@@ -40,9 +40,16 @@ namespace rapidmix {
std::vector<std::string> columnNames; //equal to the number of inputs
std::vector<element> elements;
//TODO: This is just a design idea right now.
void addElement (const std::vector<double> &input, const std::vector<double> &output)
{
element tempElement;
// tempElement.uniqueId = assignCurrentId(); //TODO: how to do this? Do we need this?
tempElement.input = input;
tempElement.output = output;
tempElement.timeStamp = NULL;
this->elements.push_back(tempElement);
}
};
......@@ -50,8 +57,8 @@ namespace rapidmix {
//TODO: Deleting phrases (last or by label)
//Design ideas to make phrase building stateless:
//phrase& createNewPhrase();
//addElementToPhrase();
std::vector<phrase>::iterator createNewPhrase();
std::vector<phrase>::iterator createNewPhrase(std::string label);
/** Create a new phrase that can be recorded into. Returns phrase id */
uint32_t startRecording(); //FIXME: this should go away. -MZ
......
......@@ -22,6 +22,10 @@ SCENARIO("Test NN Regression", "[machineLearning]")
std::vector<double> output = { 3.0 };
REQUIRE(myData.recordSingleElement("label", input, output) == 1); //FIXME: Label is stupd here. -MZ
//testing alternate API
auto newPhrase = myData.createNewPhrase("lab1");
newPhrase->addElement(input, output);
input = { 2.0, 44.2 };
output = { 20.14 };
REQUIRE(myData.recordSingleElement("label", input, output) == 3);
......
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